Flash memory availability & use

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

Flash memory availability & use

跳至解决方案
1,795 次查看
Pete66
Contributor I
We are using a S32K114 & trying to determine exactly what memory is available i.e. if 'memory' headings are additional or a window. The device has 128KB FLASH and 16KB RAM. As I read the datasheet the device also has 32KB FlashNVM and 2KB of FlexRAM. The FlexRAM is backed up to the 32KB FlashNVM in the background when enabled. Following are the confirming questions: (1) Is the 32KB FlashNVM in addition to the 128KB FLASH, so do we have up to 160KB FLASH (with loss of Flex)? (2) The 32KB FlashNVM is also referred to as D-FLASH and is often used to hold a bootloader? We intend to add a secure bootloader & I wonder how cmac might work within a system with bootloader, application and FlashNVM. I understand that I can map a bootloader pretty much anywhere I want using the vector table, just not sure if cmac will come & bite me. Thanks
0 项奖励
回复
1 解答
1,732 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

yes, those are erase and program operations. Plus Program Partition command which must be executed from RAM.

lukaszadrapa_0-1618299411200.pnglukaszadrapa_1-1618299432641.png

If interrupts are disabled during erase/program operations, it is sufficient to have only erase/program functions in RAM.

Regards,

Lukas

 

 

在原帖中查看解决方案

0 项奖励
回复
5 回复数
1,744 次查看
Pete66
Contributor I

Thanks. Is it only the FLASH erase & write commands that have to go in RAM or Flex-NVM? Can we have our Bootloader at address 0 with all the serial code and S-REC decoding and simple place the FLASH erase/write commands in RAM? 

0 项奖励
回复
1,733 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

yes, those are erase and program operations. Plus Program Partition command which must be executed from RAM.

lukaszadrapa_0-1618299411200.pnglukaszadrapa_1-1618299432641.png

If interrupts are disabled during erase/program operations, it is sufficient to have only erase/program functions in RAM.

Regards,

Lukas

 

 

0 项奖励
回复
1,782 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,
FlexNVM is separate memory, so in total you have normal flash + FlexNVM.
Yes, you can map the bootloader anywhere including FlexNVM.
Notice that secure boot always uses start address 0. But the bootloader can be still protected by secure boot. It can be relatively easily solved by chain of trust. You can place simple piece of code to the first sector of flash. This can be protected directly by secure boot. This piece of code can check CMAC of the bootloader in FlexNVM and then jump to the bootloader. The same can be done with user application.
The vector table can be easily relocated using NVIC VTOR register.
Regards,
Lukas

 

0 项奖励
回复
1,774 次查看
Pete66
Contributor I

Thanks. That makes sense. We will be using FlashNVM so the bootloader will go in A-FLASH. We might as well keep the bootloader starting in sector 0 and have the bootloader check?

One last question: How big are FLASH sectors?

0 项奖励
回复
1,749 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

Yes, it's possible to keep bootloader at 0x0. However, an advantage of FlexNVM is that it's separate partition. So, you can run the code from FlexNVM while code flash is being programmed/erased.

If the bootloader is placed to 0x0, the flash commands need to be launched from RAM (or FlexNVM). Also if you need to process interrupts during the erase/program operations, the interrupt resources (interrupt vector table, handlers...) must be placed to RAM or FlexNVM too.

This is not problem when using S32K146 or S32K148 because there are more partitions in code flash.

Sector size is 2KB for devices with 256KB code flash and less or 4KB for 512KB code flash and more.

Regards,

Lukas

 

0 项奖励
回复