Linking blocks in a specified order

Technical Note 92924

Arkitekturer:

ARM, RL78, RX, SH, STM8

Komponent:

linker

Uppdaterad:

2018-05-31 09:14

Introduction

This tech note covers how to get IAR ILINK Linker to link the output in a specified order.

Background

When linking the linked sections and blocks are linked in an arbitrary order, (this is so by design).

Solution

The linker directive define block can be complemented with a fixed order parameter to get fixed order.

Example 1

Often (in the .icf files) the directive for placement in RAM looks like:

place in RAM_region { readwrite,
 block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
 block UND_STACK, block ABT_STACK, block HEAP };

To get fixed placement replace the above directive with these two directives:

define block FIXED_ORDER_RAM with fixed order { block CSTACK,
 block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
 block UND_STACK, block ABT_STACK, block HEAP};

place in RAM_region { readwrite, last block FIXED_ORDER_RAM };

Example 2

The example project ( Example 2 (ARM).zip , Example 2 (RX).zip , Example 2 (SH).zip) contains a buildable example placing blocks in a specified order in both the ROM and RAM regions.

Further reading

The define block directive is documented in the Section handling chapter in the Development Guide.

All product names are trademarks or registered trademarks of their respective owners.

Det här innehållet finns tyvärr inte på svenska.

Vår webbplats finns främst på vårt koncernspråk engelska, förutom det innehåll för investerare som vi är lagstadgade att kommunicera på svenska. Vi rekommenderar att du besöker vår globala webbplats på engelska för att få en bättre upplevelse.

Vi stöder inte längre Internet Explorer. För att få bästa möjliga upplevelse av iar.com rekommenderar vi att du uppgraderar till en modern webbläsare som Chrome eller Edge.