Technical Note 36121 Absolute placement (v.5.xx) (in C source) EW targets: ARM EW component: C/C++ compiler Keywords: "@" / #pragma locate, absolute address Last update: February 17, 2009
Background - general There are major changes in the EWARM between version 4.x and version 5.x. The link to the right gives some more information.
Background - specific Absolute placement of constants are no longer allowed:
int const a @ 102030;
Problem There is no way of express the above in an output file in the elf/dwarf format.
Solution 1 - (if you must use const) The solution consists of two changes. In the .c file place the variable in a named segment. In the .icf (for the linker) place the segment at a specific location.
place at address mem: 0x0000FF10 { readonly section ConstSection1 }; place at address mem: 0x0000FF20 { readonly section ConstSection2 };
The Ilink will then place the sections ConstSection1 at address 0x0000FF10, and the section ConstSection2 is placed at address 0x0000FF20.
Solution 2 - (if you dare not to use const) The solution consists of a change from..
int const a @ 102030;
...to...
int a @ 102030;
...the drawback of this solution is that you disable the ICCARM which make checks for "do not write to const object". So this solution can lead to run-time errors.
Migration It is also highly recommended that you have a look at the "The migration process" in the above guide. This will give you a good picture of what has to be done to migrate from version 4 to version 5 of the ARM IAR Embedded Workbench.