S32K-How to make Flash Driver image.

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

S32K-How to make Flash Driver image.

S32K-How to make Flash Driver image.

What is “Flash Driver”

(The following content is taken from Klaus Emmert->FLASH Bootloader User Manual Version 2.7)

“The Flash Driver(actual flash algorithm) is the hardware dependent code for performing the flash functions.In most cases, programming flash memory from flash is not possible.Therefore the Flash Driver is downloaded and executed into RAM to allow programming of the application.The advantage of downloading the flash algorithm into RAM is that updates to the flash algorithms are possible without the need to reprogram the primary bootloader. The algorithm is cleared from RAM upon completion of the download to avoid accidental calls to the flash functions while in application.

In special cases the flash algorithms are kept in flash memory and copied to RAM when needed. Of course the possibility of changing the flash algorithms is no longer available when this configuration is used. Moreover, there is a risk that the flash memory will be unintentionally erased from an accidental call to these functions. A remedy to correct this would be to encrypt the corresponding program code, such as e.g an XOR or the like.”

 

Regarding the demos

-The software is using “S32 Design Studio for S32 Platform V3.4” and the SDK is “RTM 4.0.3”

- Hardware based on S32K142-EVB

-two demo provided, one for making “flash driver”, another is for testing the flash driver image

    ·“Flash_Driver_Source_Project”  this routine used for making flash driver image.

    ·“Flash_Driver_Source_Project_Test” this routine used for testing flash driver image.

 

·Flash driver image making process

1.Create a new project and add the flash component

      Refer to the demo provided and modified main.c file.

Senlent_0-1681178869405.png

Note 1 define function index table in main.c

2.Modify the link file

Senlent_1-1681178869440.png

Note 2 modified S32K142_32_flash.ld file

Senlent_2-1681178869446.png

 

Note 3 modified S32K142_32_flash.ld file

3.Add “attribute” commands for the functions necessary to operate flash

Senlent_3-1681178869590.png

 

Note 4 add "attribute" to function,like this

Senlent_4-1681178869619.png

 

      If another function is referenced in a function, then we also need to add “attribute” to the referenced function.

4.Compile the project and check the xx.map file to confirm whether the allocated address space is correct.

Senlent_5-1681178869676.png

 

Note 5 check Flash_Driver_Source_Project.map

5.Make flash driver

Senlent_6-1681178869728.png

 

Note 6 create flash image

Senlent_7-1681178869783.png

 

Note 7 choose image format

Senlent_8-1681178869825.png

 

Note 8 make flash driver image

      New a “xx.s19” file and then copy the data which range of 0x1fffe000~0x1ffffffff into this file

Senlent_9-1681178869900.png

 

Note 9 change link order if necessary

      If some functions are distributed in different files, the function address allocated can be changed by changing the link order.

 

The process of testing the flash driver image

1.Create a new project without adding flash component.

      You still need to create a new project, but you don’t need to add the Flash component to it.

2.Modify the link file as before.

3.Refer to the provided demo and modify main.c file.

4.Compile the project, check the .map file, and confirm whether the address space of the allocated array location is correct

Senlent_10-1681178869941.png

 

Note 10 make sure Function_TABLE already put on the right place

5.Enter debug section, import the prepared flash driver image.

Senlent_11-1681178870007.png

 

Note 12 import flash driver image before operate flash module

6.Test whether the flash driver can work normally.

Senlent_12-1681178870042.png

 

Note 13 check the test result

So far, we know how to make a flash driver image and how to test the flash driver image. This method is not limited to making functions related to flash operations, and other functions can also be used in this way, but there are few applications with such application scenarios.

Attachments
Comments

Can we have an updated version for S32K3XX with new RTD 3.0.0?

No ratings
Version history
Last update:
‎04-10-2023 11:26 PM
Updated by: