We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I see options for target
default start size Noinit 0x20000000 0x200 V 0x20000200 0xffff v
and still a variable @ 0x20001348 zeroes out on reset/run
Erik
what then is the meaning of the noinit checkbox? the variable zeroes out on startup
Hi Erik,
The program below, compiled with "use micro-lib", uVision 4.22.22:
#include <stdio.h> #include <stdint.h> #include "stm32f10x.h" int32_t NoInit____zero_init __attribute__( ( section( "NoInit"),zero_init) ) ; int32_t NoInit __attribute__( ( section( "NoInit")) ) ; int32_t simpleGlobal; int main(void) { printf("NoInit-zero_init is %d at %x\n", NoInit____zero_init, (int)&NoInit____zero_init); printf("NoInit is %d at %x\n", NoInit, (int)&NoInit); printf("simpleGlobal is %d at %x\n", simpleGlobal, (int)&simpleGlobal); return 1; }
prints out:
NoInit-zero_init is 103643149 at 20000004 NoInit is 0 at 20000000 simpleGlobal is 0 at 20000200
using this scatter-load:
LR_IROM1 0x08000000 0x00100000 { ; load region size_region ER_IROM1 0x08000000 0x00100000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 UNINIT 0x00000200 { ;no init section *(NoInit) } RW_IRAM2 0x20000200 0x00018000 { ; RW data .ANY (+RW +ZI) } }
If you single step in the assembly view before you hit main you'll see that the scatterloader adds code to initialize the NoInit variable but not the NoInit____zero_init variable.
Andrew
thanks a bunch, I'm stuck in meetings for the next 2 days, will report back