I am using LPC2138. I write a simple assembler program and I find the data defined in data area cannot be initialized. the following is my code. I find the TEST is placed on the address 0x40000000, but when I watch the address, the data on the address is not 100 which i have wished. why? please help me.
AREA TESTCODE,CODE,READONLY CODE32 ENTRY EXPORT START START LDR R0,=TEST LDR R1,[R0] LDR R0,=START BX R0 AREA TESTDATA,DATA,READWRITE TEST DCB 100 END
Who or what do you expect will initialize the RAM?
The loader when you download your application? The processor itself after a reset?
Note that the RAM region is volatile, so everytime you power up your processor, someone must take care of initializing all variables.
When writing in C, the compiler/linker includes a helper function that will zero-fill uninitialized variables and unused RAM and will copy the initial state for initialized variables from a region in flash.