DolphinV4 API
1.6.1.0
|
The flash memory size is 64kB and it can used for both program and data storage. The flash is organised in pages of 512 bytes which results in 128 pages. The smallest block that can be erased is 1 page = 512 bytes. A freshly erased page contains all their bytes initialised to 0xFF. Any location within the page can be written. However, once one bit has been written (either to 1 or 0), only the erasure of the whole page enables the possibility of writing the same bit location again. Failing to do so the data consistency of the the flash can't be ensured!
The flash memory is organised into two parts:
Flash Build In Self Test (BIST)
The Dolphin platform contains a Flash Built In Self Test (BIST) logic. It is useful to verify the program and static data integrity in the flash. The FLASH region on which the BIST integrity check is executed is defined by the user upon compilation time. It is recommended to exclude parts of the flash where dynamic data is stored - i.e. data that keeps changing during application execution. The BIST CRC value is stored as the last byte of the last page of the BIST region. EOPX2 Postbuild Tool saves the program size in pages to the u8PrgSize variable in SWI_AREA.val.u8PrgSize. The following figure shows how is the BIST structured in the flash.
To calculate the program BIST the compiled hex file generated with Keil has to be patched using the EOPX2 postbuild tool. For this purpose the following steps have to be executed:
If you the application have predefined constants in your data area (specified by the BL51 linker and a constant object file) the IntelHex file contains these values. In such case the EOPX2 postbuild tool needs to differentiate between the program and data part in the IntelHex file. This can be done by defining the object of the constant in the postbuild.txt. Use the setBist FLASH_DATA2_MOD - where FLASH_DATA2_MOD is the object where the constants are stored. EOPX2 postbuild will parse the MAP file of the linker to determine where the data starts and program finishes. As an example see the TCM300 source code.
The following example explains how the <setBist> operates:
Code Protection Bit
The Program and Data area can be protected against readout with the Codeprotection bit (CFG_AREA is not affected by code protection bit and can always be read). When this bit is set the FLASH program can't be read with an extern programmer. To delete this bit the Program-Data area has to be erased. For more information about the Codeprotection bit please read the DolphinStudio manual.