The problem of jumping between Bootloader and Application

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

The problem of jumping between Bootloader and Application

2,923 Views
zjgchenzhen
Contributor II

Board:S32K144 EVB,IDE:S32 DS

I want to realize that , for example, the variable "Currentsession" is shared between Bootloader and Application, the Currentsession is a "ennum: 0, 1, 2", the init value is 0. When the Currentsession is changed to 2 in the App, then "reset" command, the program return to Bootloader and read the value of Currentsession (it is equal to 2). Only when the program restarts due to power on and power off, the Currentsession can be inited. Other "reset"(such as watchdog, reset command) can't make the variable Currentsession change.

 

Problem 1: How to set the value  "Currentsession" is shared between Bootloader and Application, can you give me a demo?

Problem 2: How to realize the variable  "Currentsession"  to be persistent which meets the above requirements. In the past, I use resenus chip, othes use the "#pragma location ="CURRENTSESSION""  to meet the requirements, as far as I am concerned.

Labels (1)
0 Kudos
Reply
4 Replies

2,801 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

I would like to suggest document AN12323 S32K1xx Firmware updates

https://www.nxp.com/docs/en/application-note/AN12323.pdf 

SW

https://www.nxp.com/docs/en/application-note-software/AN12323SW.zip 

"There is a space of 4 bytes reserved in ram memory to share a status variable between the loader and the application."

I hope it helps.

Best regards,

Diana

0 Kudos
Reply

2,801 Views
zjgchenzhen
Contributor II

Hi Diana,

You mean the following( 0x55AA55AA) which is from your attachment?

pastedImage_4.png

This method is that the value is stored in the memory, when Power off and on, the value will not changed. If I use the method, this method will let me store the value to the memory every time, it is not convinient.

However, I want to have the method that "I want to realize that , for example, the variable "Currentsession" is shared between Bootloader and Application, the Currentsession is a "ennum: 0, 1, 2", the init value is 0. When the Currentsession is changed to 2 in the App, then "reset" command, the program return to Bootloader and read the value of Currentsession (it is equal to 2). Only when the program restarts due to power on and power off, the Currentsession can be inited. Other "reset"(such as watchdog, reset command) can't make the variable Currentsession change."

0 Kudos
Reply

2,801 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello

This question is a pure user affair. You can create a constant somewhere in flash or you can use for inspiration the fw_header in AN12323 Boot.c.

The status register below will help you with recognizing the source of the reset  "26.4.3 System Reset Status Register (RCM_SRS)" see RM rev 12.1

However, since we have no example code according to your requirements the implementation is up to you.

Best regards,

Diana

0 Kudos
Reply

2,801 Views
zjgchenzhen
Contributor II

Hi Diana,

Thank you very much for your help.

0 Kudos
Reply