
Chapter 5
Running example
For the first run of the example on your hardware, it is recomended to turn off Flash, WDOG, Clock, AIO, and DIO test. In the next
step, turn on step by step.
When the WDOG is turned off and a safety error happens, the example stays in an endless loop.
5.1 Post-build CRC calculation
The post-build CRC calculation can be used in several ways, depending on the IDE's built-in options. In IDEs that do not have the
built-in options, use the SRecord tool.
SRecord is a standalone utility for memory manipulation. This utility and all information about it are available at Peter Miller’s
http://srecord.sourceforge.net/
webpage.
In the SDK package, the SRecord tool is in the
<sdk_pack>/tools/srecord
folder.
In the IEC60730B Safety example, the SRecord tool is used for the post-build CRC calculations in the MCUXpresso and uVision
Keil IDEs.
In the IAR IDE, use the "ielftool" integrated feature.
The SRecord utility is used to calculate the post-build CRC without any changes. In the postbuild, an additional
*.bat
file that uses
the SRecord tool is called.
The invariable memory test can be turned off/on in file
safety_config.h file.
NOTE
5.1.1 Postbuild in IEC60730B safety example
The approach with SRecord is used in the safety examples for the MCUXpresso and uVision Keil IDEs, when the post-build
command calls the
crc-hex.bat
file, which supports the CRC16 and CRC32 calculations.
The
crc-hex.bat
file is in your SDK package, in the
<sdk_package>/middleware/safety_iec60730b/tools/crc
folder.
The complete post-build command, which is used in the safety example to calculate CRC32 in the uVision Keil IDE is as follows:
..\..\..\..\..\middleware\safety_iec60730b\tools\crc\crc_hex.bat
-..\..\..\..\boards\<YOUR_BOARD>\demo_apps\safety_iec60730b\mdk\debug\safety_iec60730b.hex
-..\..\..\..\boards\<YOUR_BOARD>\demo_apps\safety_iec60730b\mdk\debug\safety_iec60730b_crc.hex
-..\..\..\..\tools\srecord\srec_cat.exe -CRC32
"<YOUR_BOARD>" is the name of your SDK development board, e.g. "frdmk22f".
The first line is the path from the project root path (IDE project file) to the
crc_hex.bat
file. The other lines are the parameters for
the
crc_hex.bat
file.
The
crc-hex.bat
file has three mandatory parameters and one optional parameter:
• The first paramater is the path from the
crc-hex.bat
file to your application's
*.hex
file (
safety_iec60730b.hex
). It is the input
for the calculation.
• The second parameter is the path for the generated output file. This file (with the specified name) is stored as a result of
the script (
safety_iec60730b_crc.hex
) with the calculated CRC.
• The third parameter is the path from the
crc-hex.bat
file to the
srec_cat.exe
file.
• The fourth parameters is optional. When it is filled with"-CRC32", the result will be CRC32. Otherwise, the CRC16
calculation happens.
NXP Semiconductors
i.MX8M Safety Example , Rev. 3, 07/2021
User's Guide
14 / 26