
A dedicated structure in the input
*.hex
file is used to define the area where the CRC will be calculated. All necessary information
for the CRC will be read by the
crc-hex.bat
file from this structure.
Information table in the *.hex file
It is necessary to add a dedicated marker structure to the memory
*.hex
file to use the presented
crc-hex.bat
file.
The presented
crc-hex.bat
file parses the last 16 bytes from the input
*.hex
file to the found information table.
This information table must have a dedicated structure and it must be placed at the end of the input
*.hex
file.
The structure of the information table is as follows:
/* The safety-related FLASH CRC value. */
fs_crc_t c_sfsCRC =
{
.ui16Start = 0xA55AU,
.ui32FlashStart = (uint32_t)__ROM_start__,
.ui32FlashEnd = (uint32_t)&Load$$ER_IROM3$$Limit,
.ui32CRC = (uint32_t)FS_CFG_FLASH_TST_CRC,
.ui16End = 0x5AA5U
};
• 0x5AA5 - the start/end marker for the information table
• ui32FlashStart - the start address for the CRC calculation
• ui32FlashEnd - the end address for the CRC calculation
• ui32CRC - the seed value
This table must be placed at the end of the
*.hex
file. This can be assured by a linker script. The linker script depends on the IDE
used. The exact description for the supported IDE is in the following chapter.
5.1.2 Arm uVison Keil IDE postbuild CRC
The safety example in the uVision Keil used Srecord to generate the postbuild for the invariable memory test.
To use the presented
crc-hex.bat
file, it is necessary to have correct settings in the IDE.
From the start, all necessary settings are added in the example project by default:
• The Flash test is turned on in the
safety_config.h
file.
• The output
*.hex
file is turned on and the postbuild CRC is calculated by the
crc-hex.bat
file with the Srecord.
• The final post-processed image is downloaded to the ROM memory using the "Download" button.
5.1.2.1 Postbuild CRC settings
Postbuild in IEC60730B safety example
, for the presented
crc-hex.bat
file, it is necessary to do some settings
also in the IDE.
1. Set the IDE to generate the output
*.hex
file. Go to "Options → Output" and check the "Create HEX File" box.
2. Enable the afterbuild options in "Options->User → After Build/Rebuild", check "Run #1", and fill it with the following command:
..\..\..\..\..\middleware\safety_iec60730b\tools\crc\crc_hex.bat
-..\..\..\..\boards\<YOUR_BOARD>\demo_apps\safety_iec60730b\mdk\debug\dev_safety_iec60730b.hex
Post-build CRC calculation
i.MX8M Safety Example , Rev. 3, 07/2021
NXP Semiconductors
15