Quantcast
Channel: Bare Metal ARM linker script: How to relocate initialized data from ROM to RAM? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Bare Metal ARM linker script: How to relocate initialized data from ROM to RAM?

$
0
0

I would like to put initial values of global variables in ROM section, and then, relocate their addresses and copy their values to RAM (so it can be edited by the program).

My linker script SECTIONS:

/* code */.text :{    __text_start = .;    *(.text)    __text_end = .;} > ROM/* Initialized global and static variables */.data : AT ( __text_end ){     __data_start = . ;     *(.data);     __data_end = . ;  } > RAM

My Boot ROM code:

int global_var = 0xAAA;void main(){    global_var = 0xBBB;}

The problem: The initial value 0xAAA is located at RAM address in the compiled bin file instead of ROM

How can I define initial .data values in ROM, and then relocate their address to RAM?

Thank you for your help


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images