EXAMPLE: S32K144 .noinit section usage

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EXAMPLE: S32K144 .noinit section usage

No ratings

EXAMPLE: S32K144 .noinit section usage

Example introduction:

After startup - uninitialized RAM is set to 0 by startup code (startup_S32K144.S). If you need access to data stored in the RAM after reset is performed, you can  add these variables into .noinit section. You need to update your linker file and add .noinit section aligned to 1024 bytes before _RAM_START is defined: 

pastedImage_1.png

In code assign your variable into .noinit section: 

pastedImage_2.png

Example usage: 

Import attached example into S32DS for ARM, build in and start debug session. Resume target

pastedImage_6.png

and suspend program execution: 

pastedImage_7.png

In semihosting debug console you can see that noinit_data are set to 0. The board is in state after power ON:

pastedImage_8.png

Reset board and let's check if data remains in RAM memory: 

pastedImage_9.png

After resume, you can see in semihosting console (or expressions view), that data remains unchanged:

pastedImage_10.png

Attachments
Comments

Hi Jiri Kral,

 I followed all the above steps of Noinit example in my project.But my code is stuck in default ISR as show in the image.I am using s32DS and s32k144 contoller. I would greatly appreciate it if you could help me with this.

 Kindly,find the attachment .Capture.PNG

Hi, 

there is a bug in example - .noinit section needs to be aligned to 0x400.

Jiri

Hi Jiri,

    I have diffrent opinion. At startup code, S32K will Init ECC RAM and it will clear all RAM(_RAM_START  to _RAM_END) . So,when I reset S32K, the Value is 0.  

   pastedImage_1.png

This code is jump !

/* Specify the memory areas */
MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0

/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00007000

/* SRAM_L2 */
m_data_3 (RW) : ORIGIN = 0x1FFFF000, LENGTH = 0x00001000

/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000

}

.noinit ORIGIN(m_data_3):
{
KEEP(*(.noinit))
. = ALIGN(0x4);
} > m_data_3

/* WatchDog IRQ handler */
void WDOG_ISR(void)
{
__NOP();
__NOP();
__NOP();
}

void wdog_initialization(void)
{
/* Install IRQ handlers for WDOG and SysTick interrupts */
INT_SYS_InstallHandler(WDOG_EWM_IRQn, WDOG_ISR, (isr_t *)0);

/* Enable Watchdog IRQ */
INT_SYS_EnableIRQ(WDOG_EWM_IRQn);

/* Initialize WDOG */
WDOG_DRV_Init(INST_WATCHDOG1, &watchdog1_Config0);

}

__attribute__ ((section(".noinit"))) int noinit_data[5];

when  the s32k144  is  reset  by  wdog,   the noinit_data  is  keep  old value!    

Version history
Last update:
‎11-22-2018 05:16 AM
Updated by: