Hi everybody,
My question is regarding a Cortex-M0 NXP's LPC1114/301.
I am having trouble with the initialization sections that sets the initial values of variables. For example:
int x = 20;
int main(void) { if(x==20) do_something();
.....
}
When I run this code, the value of x is undefined and has actually a random value. I know I have to copy the etext section to edata, and also initialize the bss section to 0. But how do I do this in Keil with a scatter file + startup file in assembler? The default startup file from Keil for the LCP1114 doesn't do it...
Thanks in advance,
R.
> (I think/guess) You don't have to do anything, it is done by KEIL's __main automagically.
Yeah, that was it! I remember getting a "main not found" error and I changed the startup assembler code to call "main" directly, instead of the original "__main". But now, for some reason, I am not getting this error, and as a result, the variable initialization is working fine, as it should be.
Thanks a lot!
Oops - you forgot to mention that you changed the startup code...