1982461_en-US

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

1982461_en-US

1982461_en-US

The s32k312 retains part of the SRAM interval to store data, causing the system to crash

first i did some changes in the linker doc "linker_flash_s32k312.ld"

yiyiyinyi_0-1730013552568.pngyiyiyinyi_1-1730013594160.png

then i use this section likes follow:

yiyiyinyi_2-1730013788934.png

when i did a line like this " if( eBootFlag == 0xAA) ", i got data from this section when power off the MCU and then power it on 5v. This line of code will crash the system. i want to know if there some wrong thing i did.


Re: The s32k312 retains part of the SRAM interval to store data, causing the system to crash

thanks @Senlent 

I chose the area where SRAM starts and then i choose not to  I chose not to initialize the SRAM at the time of the function event reset . the sram data i put in doesn't change.

Re: The s32k312 retains part of the SRAM interval to store data, causing the system to crash

Hi@yiyiyinyi

So your first problem is that "int_sram_ebotflg" is not initialized, right?

You can try to modify it in this way.

You still modify the link file as in the first problem, and then:

The program enters main()

1. Determine the reason for the MCU reset

2. If the last reset of the MCU is a functional reset, do not initialize "int_sram_ebotflg"

3. Otherwise, initialize the "int_sram_ebotflg" area

This should be able to solve your problem

Re: The s32k312 retains part of the SRAM interval to store data, causing the system to crash

so i need to change Sd32? Where do you suggest I should change it?

Re: The s32k312 retains part of the SRAM interval to store data, causing the system to crash

Hi Senlent

thanks for your reply.

yiyiyinyi_0-1730096923672.png

i did some changes , _INT_SRAM_END which single is in the  startup file . _INT_SRAM_END equal to ram_rsvd2 , so it is can't be initialized.

but if i distribute the SRAM as shown in the figure below  :

yiyiyinyi_2-1730098240139.png

After the following code is executed, the value in SRAM will be initialized to 0, but will Function Event Reset not change the value in SRAM?

yiyiyinyi_1-1730097999283.png

so where should i to change make sure this data can‘t be changed if i choose "ram_rsvd2 : ORIGIN = 0x20418000, LENGTH = 0", The selection of SRAM is distributed in this way.


Re: The s32k312 retains part of the SRAM interval to store data, causing the system to crash

Hi@yiyiyinyi

1. Make sure that the SRAM must be initialized before use

The link file provided by NXP has already initialized the SRAM in the startup file. If the user modifies the link file, then it is necessary to ensure that the modified SRAM area is initialized.


2. Is the MPU configured correctly? You can turn off the MPU and try again

you can disable MPU like below shows and try again.

Senlent_0-1730082631441.png


Re: The s32k312 retains part of the SRAM interval to store data, causing the system to crashIs it because of the power failure and rewriting the SRAM region? But if I take a value in this area, why does it crash? I spent a lot of time, but I still haven't solved this problem. Can you tell me, where is my problem?
Tags (1)
No ratings
Version history
Last update:
‎11-21-2025 03:45 PM
Updated by: