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

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

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

Jump to solution
816 Views
yiyiyinyi
Contributor II

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.

 

Tags (2)
0 Kudos
Reply
1 Solution
761 Views
Senlent
NXP TechSupport
NXP TechSupport

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

View solution in original post

0 Kudos
Reply
6 Replies
775 Views
Senlent
NXP TechSupport
NXP TechSupport

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

 

0 Kudos
Reply
772 Views
yiyiyinyi
Contributor II

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.

 

0 Kudos
Reply
762 Views
Senlent
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply
707 Views
yiyiyinyi
Contributor II

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.

Tags (1)
0 Kudos
Reply
766 Views
yiyiyinyi
Contributor II

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

0 Kudos
Reply
785 Views
yiyiyinyi
Contributor II
Is 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?
0 Kudos
Reply