This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

program run from different RAM address (ARM)

I want to write a function (ARM) that will run in a different initial RAM addresses. Part of the program in ASM, and part of C. The problem is that variables declared in the ASM, as seen in C are still in the same address.

EXP:

in asm file:

test_val  dcd     0x5555555
          export  test_val
          BLX     main_c_code


in C file:

extern  int test_val;
void main_c_code(void){
...
  test_val = 0xAAAAAAAA;
...
}

after build everything works, when it loads the applications to address eg 0x1000 (default)
test_val is at addr. eg. 0x1004
but when you want to load applications to address eg 0x2000, Part C test_val still fits the data to addr 0x1004 instead of 0x2004. how to force the compiler to the use of

ADR R0, test_val


instead of

LDR R0, = 0x4