Absolute placement in assembler source

Technical Note 17934



1/16/2018 12:26 PM


This technical note describes how to place an assembler symbol at an absolute memory address.


Placing an assembler symbol at an absolute memory address can be done in two ways:

  • With IAR Embedded Workbench for Arm version 7.40 (or newer), assembler data can be placed using the ASEGN directive.
  • Placing code needs two actions: First, in assembler source code associate the code label with a named section. Second, when linking, place that named section at an absolute memory address.

Example project for this technical note

TN_17934_test_project_IAR_Embedded_Workbench_for Arm_7_70_1.zip

Placing data with the ASEGN directive:

Use ASEGN to start a named absolute section placed at the memory address address. This can be used for both constant and read/write data, as in this source example:

        ASEGN `.rodata`:CONST:NOROOT,08000H
        DC32 42

        ASEGN `.bss`:DATA:NOROOT,020008000H
        DS8 4

The result is that my_const is placed at 0x8000 and my_var is placed at 0x20008000.

Placing the symbol, through a named section, at link time:

These two actions are needed:

  • In the assembler source code: Associate the assembler symbol with a named section.
  • In the linker configuration file: Place the named section at an absolute memory address.

In the following example, the symbol my_func is associated with the section .my_func_section.

        PUBLIC my_func

        SECTION .my_func_section:CODE:NOROOT(1)
        MOV      R0,#+32768
        LDR      R0,[R0, #+0]
        BX       LR               ;; return
        REQUIRE my_const

By adding these lines in the linker configuration file, the named section will be placed (at link time) at the absolute memory address 0x00010000.

define symbol __MY_CODE__   = 0x00010000;
place at address mem:__MY_CODE__ { readonly section .my_func_section };


  • Absolute placement of data can be done with the ASEGN directive.
  • Absolute placement of code (can also be used for data) is performed in two steps.

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

Related Tech Notes

© IAR Systems 1995-2019 - All rights reserved.

We use cookies on this website to provide you with a better experience. You need to accept cookies to continue using this site. Cookies