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
at the top of the scatter file the noinit CLARLY should work, but does not. so how do you modify/generate a "scatter file"
eRIK
Go to "options for target", linker tab, then select "Edit".
from the .scf file
RW_IRAM2 0x20000200 UNINIT 0x0000FE00 { ; RW data Pic_Etcs.o (+RW) .ANY (+RW +ZI) }
the +ZI must be it thus something done elsewhere must be the cause of the zero init anyone any ideas?
from various sources I have picked the below up
scatter
; ************************************************************* ; *** Scatter-Loading Description File generated by uVision *** ; ************************************************************* LR_IROM1 0x08020000 0x00040000 { ; load region size_region ER_IROM1 0x08020000 0x00040000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 UNINIT 0x00000200 { ;no init section *(NoInit) } RW_IRAM2 0x20000200 UNINIT 0x0000FE00 { ; RW data Pic_Etcs.o (+ZI +RW) .ANY (+RW) } RW_RAM1 0x68000000 UNINIT 0x00080000 { Dortmund_BIOS_ShadowRAM.o (+ZI +RW) } } LR_IROM2 0x08060000 0x00020000 { ER_IROM2 0x08060000 0x00020000 { ; load address = execution address Dortmund_BIOS_LCD.o (+RO) .ANY (+RO) } } C DWORD dwPuppyMunch __attribute__( ( section( "NoInit"),zero_init) ) ; DWORD dwPuppyFood __attribute__( ( section( "NoInit")) ) ; #pragma arm section zidata = "NoInit" DWORD dwPuppyChow; //uninit (in non_init section) #pragma arm section zidata //back to default (.bss section)
this is as far as it seems I can get, but all 3 zeroes out :(
It the varialble "dwPuppyChow" located in the right execution region? Is the execution region itself indeed of type UNINIT?
Try just the dwPuppyMunch, the same approach you have for the scatter file and the attribute for dwPuppyMunch worked for me. You need the zero_init in the attribute to force a small global into a specific segment but I think you might be assigning conflicting attributes by dropping the zero_init in the next line and then using the #pragma.
The confusing part is that even though you tell the linker to UNINIT the segment, zero_init is needed to override the default placement algorithm. The default is to silently put small globals into the normal data segment.
Andrew
DWORD dwPuppyMunch __attribute__( ( section( "NoInit"),zero_init) ) ; //DWORD dwPuppyFood __attribute__( ( section( "NoInit")) ) ; DWORD dwPuppyFood ; //#pragma arm section zidata = "NoInit" DWORD dwPuppyChow; //uninit (in non_init section) //#pragma arm section zidata //back to default (.bss section)
andrew, please do me the favor of checking your reference, the above still initializes dwPuppyMunch
thanx,
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.
thanks a bunch, I'm stuck in meetings for the next 2 days, will report back