using IAR Tools getting a table to be put in flash

Dear Forum,

Im running IAR workbench 3.10.1.  Im trying to get a table put in to flash instead of sram.  I read there was a switch in the IAR tools to have const string go to flash, but I have not been able to find it.  How is this normally done?  Below is how I structured the code.  Does this also need to be done differently?

const uint16_t ui16Table[] = {
0X0020, 0X30C1, 0XC951, 0X0121, 0XF001, 0X0744, 0XFFEE, ... 0XFFFF};


Also will this show up in the map file as const or something like that?

1 237 bytes of readonly code memory
180 bytes of readonly data memory
204 bytes of readwrite data memory (+ 86 absolute)

Thanks for any help!


  • Hi Matt,

    I'm not familiar with that switch or tool in IAR but maybe you can ideas from this thread

    RenesasRulz Forum Moderator
  • By default const data is placed in the mirror area, which is flash memory.
    But if the array is not being used the linker will delete it. If you define it as __root the linker will always keep it.
    __root const uint16_t ui16Table[] = {0X0020, 0X30C1, 0XC951, 0X0121, 0XF001, 0X0744, 0XFFEE, 0XFFFF};
  • In reply to FrankL:

    Hi Frank and JB,

    So I gave __root a try and it looks like its placing the into ram.  Im using the 1026AA part.  Ram begins at 0xFF900, and the map files has my table starting at 0xff900.

    Should I be doing anything else when specifying the __root? Thanks you guys!!





  • In reply to rupertm:

    __root has nothing to do with data placement. __root is only used that the linker does not remove this data when it thinks it is not being used.
    Placement is defined by const.
    I would need to see the complete project for some further proposals.
  • In reply to FrankL:

    Hi Frank,

    Sorry I misunderstood what you were saying about __root.

    Do you have a place I can email you the project or prefer another method?

  • In reply to rupertm:


    Have you found a solution to your issue?

    Mike Clements
    RenesasRulz Moderator
  • In reply to rupertm:

    This thread will be archived due to inactivity.

    Mike Clements
    RenesasRulz Moderator