Flash Test : FLSTST module of AUTOSAR

Padmanabh
0


After reading this article you will understand
1. What is flash test? Why it is required?
2. How to perform flash test
3. Autosar flstst configurations.

1. Introduction:

Flash test is a way test flash memory of micro-controller. Flash test will detect whether there is an error in flash memory (i.e. memory cell is damaged).
Flash test is performed to check data integrity after flashing/downloading the code into controllers flash memory. Flash memory test compares the contents which are in .hex file (which is generated after compilation process) before flashing .hex  with contents of flash memory in micro-controller after downloading .hex file. Flash test is safety test and generally performed at time of initialization of controller, to make sure invariable memory is not corrupted.  






In AUTOSAR two  kinds of flash test mentioned.

1. Foreground flash test
2. Background flash test

Foreground flash test: Complete flash memory is tested in one shot, with all interrupts are disabled. So that no other task will interrupt flash test task.

Background flash test: Flash memory is tested but in parts. Flash test task will get called periodically (e.g every 20ms) and in every call part of flash memory is tested. when flash memory end address is reached test result will get generated and will restart from initial address.

2. How to perform flash test :

Aim of flash test module is to check flash memory contents are same as contents .hex file. But how to do this? Have you heard about CRC? Calculate CRC of hex and calculate CRC of flash memory and compare both if result is same flash memory is good else it is corrupted.

2.1 Algorithm:


step 1 : Calculate CRC of .hex file using some tool (Which tool? Refer section 2.2) and store calculated CRC in particular memory location. ( How to do this? Refer section 2.2 )

step 2 :  Calculate CRC of flash memory ( assuming that .hex is downloaded to micro-controller) at run time.Write your own function which will calculate CRC at run time.

step 3  : Compare CRC at step 1 and CRC at step 2 at run time.If both are same then there is no error.Else there is an error in flash memory.

Note  :  Algorithm used at step 1 and step 2 must be same !! There are many algorithms available  for CRC calculation. Most popular CRC algorithm  is CRC32.   You can use CRC32  algorithm at step 1 and step 2.

2.2 Tool for CRC calculation of hex file :

To calculate CRC of .hex file you can use SREC tool. To calculate CRC of .hex file and how to store calculated CRC at particular memory location use srec manual.






3. Autosar Flash test (flstst) configurations :

Fig. 1 Flash Test Module in AUTOSAR Architecture



Flash test module is named as flstst module in AUTOSAR architecture. To configure flstst in AUTOSAR below points are important.
  •  Size of flash memory to be tested. (e.g 1.5MB)
  •  Type of flash memory p-flash or d-flash memory (e.g. p-flash)
  •  Start address of flash memory (e.g. 0x00000000)
  •  No of bytes to be tested in one call of flstst (in case  of background test e.g. 512       bytes)
  • CRC algorithm (e.g CRC 32)
  • Memory location (signature address) of stored CRC (CRC of hex file calculated using SREC tool and store at particular memory location e.g 0x0017FFFC).
Fig 2. Memory Map of Micro-controller                   


Description:


Consider above configuration and fig 2, which explains micro-controller has flash memory of 1.5MB. Starting address of flash memory is 0x00000000 and in one call of flstst function will test 512 bytes (in case of background test). To calculate CRC, CRC32 algorithm is used. CRC calculated at run time using your own function will check against CRC stored at particular address 0x0017FFFC








Post a Comment

0 Comments
Post a Comment (0)
To Top