How to generate RAM NVM driver based on the SDK FLash driver?

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

How to generate RAM NVM driver based on the SDK FLash driver?

382 Views
qinxk
Contributor I

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)?

0 Kudos
Reply
9 Replies

346 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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.

danielmartynek_0-1726562262204.png

 

 

Regards,

Daniel

0 Kudos
Reply

335 Views
qinxk
Contributor I

Hi, it's S32SDK_S32K1xx_RTM_3.0.0

0 Kudos
Reply

321 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Same for RTM 3.0.0

 

Regards,

Daniel

0 Kudos
Reply

301 Views
qinxk
Contributor I

Yeah, so what's the solution?

0 Kudos
Reply

285 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply

281 Views
qinxk
Contributor I

 

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?

qinxk_0-1726729983942.png

 

0 Kudos
Reply

276 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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).

danielmartynek_0-1726734447986.png

 

 

BR, Daniel

0 Kudos
Reply

268 Views
qinxk
Contributor I

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!

0 Kudos
Reply

249 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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:

danielmartynek_0-1726742170554.png

Again, if this is not what you mean, you would need to implement it yourself.

 

BR, Daniel

0 Kudos
Reply