Hi Alice,
Yes, I created a small example project to show what is working and what is nt working as expected.
this is what I did:
- I took the hello world example as basis
- I splitted the RAM (SRAM) memory, to have a very small section for my noinit at the very end:
- RAM (SRAM): address: 0x20000000, size: 0xFFF8
- RAM4 (SRAM_NOINIT): address: 0x2000FFF8, size: 0x8
- I created a noinit section in this new memory area in the loader file:
/* NOINIT section for SRAM_NOINIT */
.noinit_RAM4 (NOLOAD) : ALIGN(4)
{
PROVIDE(__start_noinit_RAM4 = .) ;
PROVIDE(__start_noinit_SRAM_NOINIT = .) ;
*(.noinit.$RAM4)
*(.noinit.$SRAM_NOINIT)
*(.noinit.$RAM4.*)
*(.noinit.$SRAM_NOINIT.*)
. = ALIGN(4) ;
PROVIDE(__end_noinit_RAM4 = .) ;
PROVIDE(__end_noinit_SRAM_NOINIT = .) ;
} > SRAM_NOINIT AT> SRAM_NOINIT
- I created 3 noinit variables, using macro's from cr_section_macros.h:
- This is the preferred variable, added at the very beginning of the normal SRAM memory
__NOINIT_DEF uint32_t noinit_var_DEFAULT
2. This variable is placed in the USB_RAM memory.
Because we want to use USB in our application, this is not a workable solution for us.
__NOINIT(USB_RAM) uint32_t noinit_var_USB_RAM;
3. This one will end up in the new memory area, at very end of the normal SRAM
__NOINIT(SRAM_NOINIT) uint32_t noinit_var_NOINIT;
- I enabled the USB FS0 Device clock (needed for USB RAM) in clock_config:
CLOCK_EnableUsbfs0DeviceClock(kCLOCK_UsbfsSrcFro, CLOCK_GetFroHfFreq());
- After the hello world message over UART I show the value of the 3 noinit variables:
PRINTF("noinit_var_DEFAULT: 0x%08x\r\n", noinit_var_DEFAULT);
PRINTF("noinit_var_USB_RAM: 0x%08x\r\n", noinit_var_USB_RAM);
PRINTF("noinit_var_NOINIT: 0x%08x\r\n", noinit_var_NOINIT);
- And then I increase each variable by 1:
noinit_var_DEFAULT++;
noinit_var_USB_RAM++;
noinit_var_NOINIT++;
My expected results are:
- At powerup each variable will have 'random' values
- After a software reset (without a power cycle), each variable will be increased by one
But this is the result:

- The variables in USB_RAM and my new SRAM_NOINIT area are increased by 1 on reset: OK
- The preferred variable noinit_var_DEFAULT stays the same: NOK
Actually also after a power cycle this variable remains the same
I attached my example project.
Thanks in advance for your help!
BR, Jan Pieter de Ruiter