Flash memory availability & use

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

Flash memory availability & use

Jump to solution
1,267 Views
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 Kudos
1 Solution
1,204 Views
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

 

 

View solution in original post

0 Kudos
5 Replies
1,216 Views
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 Kudos
1,205 Views
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 Kudos
1,254 Views
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 Kudos
1,246 Views
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 Kudos
1,221 Views
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 Kudos