2312513_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2312513_en-US

2312513_en-US

Sharing data between bootloader and app

Is there a way to hold ram data after a function reset?

Statement of Need:

The MCU model used is the S32K364, which is required to maintain state during the upgrade process between the bootloader and the app.

1. When the app needs to be upgraded, write flags to the flag memory;

2. Executive function reset;

3, MCU reset into the bootloader query this state, if you need to upgrade to perform the upgrade;


For now, I'm reserving a slice of RAM space.

SHARE_RAM : ORIGIN = 0x2000ee00, LENGTH = 0x200


.share_ram (NOLOAD) .

{

. = ALIGN (4); /* 4-byte alignment */

KEEP (*(.share_ram))

. = ALIGN (4).

} > SHARE_RAM


But ram is cleaned up after a functional reset;

Is there a way to reset the specified ram without clearing it, or another feasible solution, or is it only possible with dataFlash.

Re: bootloader 和app共享数据方案

Hi @caigangwu 


SRAM content is lost after Power-On reset or after any type of destructive reset. SRAM content is retained after functional reset. This is mentioned in Table 185 (S32K3 RM rev. 12):

https://www.nxp.com/webapp/Download?colCode=S32K3XXRM


Then there are two things to consider.


First, SRAM memory must be initialized due to ECC after power-on and after destructive resets. In any project with RTD, there’s file startup_cm7.s. Here you can find “RamInit” section. There’s already a code which conditionally initializes standby RAM memory. You can implement something similar for your new RAM segment created in linker file. Your segments should be initialized only after POR or destructive resets.

read the DES register in MC_RGM module to see if the last reset was destructive or not. If it was destructive reset, initialize this SRAM segment by 64bit writes. If not, you can skip this initialization – i.e. retain the content during functional reset.

This register is read and cleared later by RTD drivers, so do not clear it here.


Second, there’s a code in the same file for copying and zeroing of variables. There are tables init_table and zero_table. Your RAM segment should not be included in these tables, so your data are not overwritten. It won’t be a problem if you create new segment for your data.


Regards,

Lukas

タグ(1)
評価なし
バージョン履歴
最終更新日:
‎02-06-2026 04:25 AM
更新者: