how does write data to flash memory in s32k314?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

how does write data to flash memory in s32k314?

192 次查看
rlaxortn
Contributor IV

I am trying to develop a bootloader for the NXP S32K314. and s32ds IDE version is 3.6.1, RTD is 4.0.0.
From what I understand, I need to divide the internal flash memory into two separate regions: one for the bootloader and one for the application.


1. If that is correct, how can I determine the bootloader region and the application region, and how do I allocate and separate those areas?I think this can be done through the linker (.ld) file, but I want to know exactly how the flash memory address ranges are organized.


2.  how do I program the bootloader code into the bootloader region?

 

3. how do I perform flash-writing operations on the S32K314?

 

4. if you have bootloader source code example for writing flash memory, would i get?

标记 (3)
0 项奖励
回复
3 回复数

155 次查看
rlaxortn
Contributor IV

@Julián_AragónM 

 

i have to develope a bootloader by low-level driver. 

1. i included C40_IP. and do i need a Cache_IP driver for writing flash memory?

 

2. does s32k314 has a cache? so when i write data to flash memory, do i have to control cache memory?

 

3. what is AB Swap of HSE firmware and OTA? would you explain about that?

 

0 项奖励
回复

107 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @rlaxortn,

1. & 2. Yes. It's better to manage the cache coherency so the CPU does not read stale data. You can refer to the C40_Ip_Example provided by the RTD package; it shows how to initialize the driver, clear the sectors before E/W, and reads the data.

Julin_AragnM_0-1763594350125.png

Also, you can refer to chapter 4.1.55 (Parameter MemSynchronizeCache) from RTD_MEM_43_INFLS_UM.pdf (MCAL layer of C40_Ip driver):

...\S32DS\software\PlatformSDK_S32K3\RTD\Mem_43_INFLS_TS_T40D34M60I0R0\doc\

3. A/B swap is HW assisted, managed by HSE firmware. When OTA is enabled in the part, device flash is divided in 2 blocks.

  • Active block, where the application code is located.
  • Passive blocks, where the rollback image is located

You can find some information in the previous links I've shared, as well as this presentation: S32K3 OTA AB SWAP DEMOSTRATION.

There is also the Unified bootloader Demo, which is a UDS bootloader solution for S32K3xx, however it is provided as is with no further support.

Best regards,
Julián

0 项奖励
回复

161 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @rlaxortn,

1. Yes, this can be done through the linker file, however, I suggest going through the HSE Firmware and OTA presentation under "Documentation -> Secure Files" from S32K3's product page. Silde 82 shows the S32K3XX Memory Architecture, as well as FOTA overview through the A/B swap use case.

2. Please refer to the community post shared below. AB swap is performed by HSE service, so it's necessary to have AB swap version of HSE firmware installed. Solved: Re: s32k3 flash swap requirements? - NXP Community.

3. You can use C40_Ip (low-level driver) flash interface or Mem_Infls (MCAL driver) for flash operations. There is AN13388 which you can use as introduction.

4. You can refer to the S32K3 OTA demo under S32K3 Reference Software package. It can be downloaded by searching "Automotive SW - S32K3 - OTA Demo".

Best regards,
Julián

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2206456%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%A6%82%E4%BD%95%E5%9C%A8%20s32k314%20%E4%B8%AD%E5%B0%86%E6%95%B0%E6%8D%AE%E5%86%99%E5%85%A5%E9%97%AA%E5%AD%98%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2206456%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E5%B0%9D%E8%AF%95%E4%B8%BA%E6%81%A9%E6%99%BA%E6%B5%A6%20S32K314%20%E5%BC%80%E5%8F%91%E4%B8%80%E4%B8%AA%E5%BC%95%E5%AF%BC%E5%8A%A0%E8%BD%BD%E7%A8%8B%E5%BA%8F%E3%80%82%E8%80%8C%20s32ds%20IDE%20%E7%9A%84%E7%89%88%E6%9C%AC%E6%98%AF%203.6.1%E3%80%81RTD%20%E4%B8%BA%204.0.0%E3%80%82%3CBR%20%2F%3E%E6%8D%AE%E6%88%91%E6%89%80%E7%9F%A5%EF%BC%8C%E6%88%91%E9%9C%80%E8%A6%81%E5%B0%86%E5%86%85%E9%83%A8%E9%97%AA%E5%AD%98%E5%88%86%E6%88%90%E4%B8%A4%E4%B8%AA%E7%8B%AC%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