How do I place library functions in a specific location?
Technical Note 33441
Architectures:
ARM, RH850, RX, SH, STM8
Component:
linker
Updated:
2018/5/31 9:14
Introduction
When IAR ILINK Linker links the output, the linked sections and blocks, including library functions, will be in arbitrary order. (This is so by design).
Solution
The linker directive "define block", complemented with a "fixed order" parameter, can be used to group for example DLIB functions using "section selectors" with the keyword "object".
For more information, see the chapter Section-selectors in the Development Guide.
Example
This example will group library functions in a specified order and place them last in the ROM region.
With the following lines added to the .icf file ...
define block LIB_CODE with fixed order
{
readonly object xreportassert.o,
readonly object iarttio.o,
readonly object ABImemcpy.o,
readonly object cmain.o
};
place in ROM_region { readonly, last block LIB_CODE };
... the .map file will show something like ...
LIB_CODE 0x0800cd98 0x192 <Block>
.text ro code 0x0800cd98 0xa0 xreportassert.o [3]
.text ro code 0x0800ce38 0x6c iarttio.o [6]
.text ro code 0x0800cea4 0x70 ABImemcpy.o [5]
.text ro code 0x0800cf14 0x16 cmain.o [5]
All product names are trademarks or registered trademarks of their respective owners.