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.
Note 1 define function index table in main.c
2.Modify the link file
Note 2 modified S32K142_32_flash.ld file
Note 3 modified S32K142_32_flash.ld file
3.Add “attribute” commands for the functions necessary to operate flash
Note 4 add "attribute" to function,like this
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.
Note 5 check Flash_Driver_Source_Project.map
5.Make flash driver
Note 6 create flash image
Note 7 choose image format
Note 8 make flash driver image
New a “xx.s19” file and then copy the data which range of 0x1fffe000~0x1ffffffff into this file
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
Note 10 make sure Function_TABLE already put on the right place
5.Enter debug section, import the prepared flash driver image.
Note 12 import flash driver image before operate flash module
6.Test whether the flash driver can work normally.
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.
Can we have an updated version for S32K3XX with new RTD 3.0.0?
你好,我按照你的方法去设置,但是他生成的map文件地址不对,如何修改链接文件的编译顺序?