FlashLink File Format (FLP)

Introduction

FlashLink is able to program data content into a huge set of different devices. The data to be programmed is prepared by the software development and is provided by one or more files to be flashed into device embedded memory. This files can be in different format depending on the IDE used.

Every device has a so called, memory map. This means that embedded memory starts from a specific start address and ends on a specific end address. This range is described into device datasheet. A single device can have embedded inside multiple embedded memories dedicated to different purposes and of course each one of them will be memory mapped into a specific address range.

Output file types

Although there is no standard officially adopted by silicon manufacturers, there are at least three output file types which are commonly adopted. They are:

  • Binary (.bin)
  • Intel Hex (.hex)
  • Motorola SREC (.s19, .srec, .s37)

Each format has different features, and they are suitable for different purposes. They act like a “container” which stores the firmware to flash and, in some cases, much more. There are also other output file formats, usually designed from silicon manufacturer itself which are designed to fit some particular device features. By creating a dedicated file format, silicon producers aim to store inside the output file format specific device information which can be then automatically parsed by other tools and be translated in actions on target device to be flashed.

FlashLink desing and use use a unique, common file format which let you combine together all advantages of all file format described above with not drawbacks. Moreover FlashLink project file can store all the information required for the programmer to correctly connect to the device an to write the data on the memories. The use of a proprietary file format has the advantage to be able to assure the data integrity of the data inside that file from accidentally and/or on purpose changes.

Structure of the FLP files

FLP is structured as a list of block of data, each block defined by an header of fixed length of 64 bytes followed by a data section of variable length. Every header has 2 fixed field at the beginning, the first (32bits) is used to identify the type of the block and the second one (64 bits) record the total length of the block (Header + data). The block can be present in any order and in any number. only the first block must be of type Main.

  • The first header must be of type Main
  • The second header must be of type DevId
  • The third file

All the information inside the header are stored in Little Endian representation.

Header strucure

Type Name Description
uint32_t h_type Header type
uint64_t blockLen Length of this block of data (This header of 64 bytes + the following data section)
(48 bytes) headers Information on this specific block
uint32_t hdrCrc CRC32 of the previous 60 bytes

The structure of field headers depends on the type of this header ha defined by the h_type field:

Block types ID

h_type Name Description
0x1B00U Null Empty data block used to signal the end of the file
0x1B01U Main Main data block, must be the first of the file
0x1B02U Data Block of data to be programmed
0x1B03U Fill Instruction to fill a portion of memory with a constant value
0x1B04U Crypto Present if the file is crypted
0x1B05U License License (TBD)
0x1B06U Var Variable data (TBD)
0x1B07U Script The script with the instruction to program the target device
0x1B08U DevId Device Identification
0x1B09U AlgoId Driver identification
0x1B0AU Notes User notes on the project
0x1B0BU Opt Option (TDB)
0x1B0CU SnTab Serial numbering (TBD)
0x1B0DU SrcInfo Information on the source file imported
0x1B0EU LuaPrg Lua Script
0x1B0FU UserFile User added file
0x1B10U Drv Driver code
0x1B11U PinMap Pin map for connect the programmer to the target board

Block types headers structure

Main

Type Name Description
uint32_t version FLP Format version (For compatibilty check)
uint32_t time Timestamp of the file creation (unix epoch format)
uint32_t file_crc32 CRC32 of the all file excluding the main header itself
uint8_t crypted Flag to signal if the file content is crypted

Data

Type Name Description
uint64_t startAddr Target device address for this data block
uint64_t len Length of the data to program
uint64_t OrigStartAddr Start address of the data as imported
uint32_t OrigLen Length of the data as imported
uint32_t offset Offset into the data section of the first byte to program
uint32_t srcCrc32 CRC32 of the original imported file
uint32_t dataCrc32 CRC32 of the data of this block
char memType Flag of the Memory type to program on the target device
uint8_t dataSize Addressing mode of the target device memory (1 => Byte addressed, 2 => 16 bits word addressed, 4 => 32 bits word addressed)
int8_t extFileIdx Idx of the external file with the data (For big data block)
uint32_t srcCrc32_0 CRC32 of the original imported file with different algo