I want to call the API which operate the Flash such as erase, init flash from RAM NVM, but S32K1xx SDK Flash driver is stored in the P-flash, so how to re-locate these API into RAM NVM? who can know the detailed process how to generate RAM NVM driver file(s19 file)?
Hi @qinxk,
If the operation requires the driver to work from SRAM, the only function that has to be in SRAM is FLASH_DRV_CommandSequence(). This is a blocking function, it blocks the execution while CCIF = 0.
You did not specify the SDK version.
In SDK 4.0.1, the function is in SRAM by default.
Regards,
Daniel
Hi, it's S32SDK_S32K1xx_RTM_3.0.0
Same for RTM 3.0.0
Regards,
Daniel
Yeah, so what's the solution?
Hi @qinxk,
The solution is that the APIs do not have to be in SRAM.
Only the function that clears CCIF and waits while CCIF = 0 has to be in SRAM.
And by default, it is in SRAM.
Regards,
Daniel
Hi, thanks for your support!
but I notice that this macro doesn't have value as follow, how do you know it is in SRAM defautly?
I'm testing the flash_partitioning_s32k146 example (SDK 4.0.3, gcc 6.2).
Debug_Flash target
The FLASH_DRV_CommandSequence() function is in SRAM (.code_ram).
BR, Daniel
Ok, from the debug info, it's really in SRAM.
Hi buddy, I want to clarify my requirement as follow:
For function secure system. Flash Driver, especially erase API , shouldn't be existent in P-flash. because:
1. may erase the application if erase API is excuted abnormally, the system will crash.
2. API provided by flash Driver can be used in the case we need to re-program.
3. Our the system architecture would be Flash Driver module should be removed from Application system. It will be loaded in SRAM and then call the related service when bootloader want to upgrade the application.
Please feed back if any isn't clear!
This is just a low-level SDK driver where one function is placed in SRAM, if you need the APIs to be in SRAM, you need to place it there yourself, like the FLASH_DRV_CommandSequence() is, for example.
You may use the Autosar MCAL RTD FSL driver, there is this option:
Again, if this is not what you mean, you would need to implement it yourself.
BR, Daniel