Hi
Im using a STM32F429ZI and have the folowing problem:
In my assembler program i initialize the following variables:
AREA myVars, DATA, READWRITE op1_table DCW 0x0001, 0x0017, 0xffff, 0x73a4, 0x43cc, 0xe372, 0xdd22, 0x7fff op2_table DCW 0xffff, 0x0004, 0xffff, 0x4c28, 0xc3bf, 0x0234, 0xbcde, 0x7fff
Then i want to acces them:
AREA myCode, CODE, READONLY THUMB main PROC EXPORT main LDR R0, =op1_table LDR R1, =0xff LDRH R2, [R0, #0] ; After this R2 contains 0xbe (should be 0x1) STRH R1, [R0, #0] LDRH R2, [R0, #0] ; After this R2 contains 0xff (as it should)
I can write and read from the variable, but they're not initialized as the suposed to be (with the DCW directive).
What am i missing? I wrote a c example with global variables and couldn't find a difference...
1) I'm using the debugger, this program never runs on the uc standalone.
2) Why does it work on the 8051 or the c167 (with Keil)?
3) What is the difference between DCD and SPACE?
I guess i solved my initial problem...
What am i missing?
Answer: Constants go into "READONLY"
AREA myVars, DATA, READONLY op1_table DCW 0x0001, 0x0017, 0xffff, 0x73a4, 0x43cc, 0xe372, 0xdd22, 0x7fff op2_table DCW 0xffff, 0x0004, 0xffff, 0x4c28, 0xc3bf, 0x0234, 0xbcde, 0x7fff
Thanks Per after all you pointed me in the right direction. I probably should have posted the original code and not this (hideous) example trying to write to a constant...