
5.2.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.2.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
-..\..\..\..\boards\<YOUR_BOARD>\demo_apps\safety_iec60730b\mdk\debug\dev_safety_iec60730b_crc.hex
-..\..\..\..\tools\srecord\srec_cat.exe
The meaning of this afterbuild command is described in
Postbuild in IEC60730B safety example
The product of the postbuild operation with the
crc-hex.bat
file is the
<your_project_name>_crc.hex
edited file, which must be
loaded to the target. The best way to do this is to create a debug initialization file.
5.2.2.2 Debug initialization settings
By default, the uVision Keil IDE downloads the output file specified in "Options->output". Due to this, it is necessary to create an
alternative debug initialization file. In our case, a
*.hex
file with an added CRC is dedicated for the download to the target.
In the uVision Keil IDE, it is necessary to select the following options:
• "Options ->Debug->Initialization file" - fill it with the "safety_debug.ini" pattern.
• "Options->Utilities->Init File" - fill it with the "safety_debug.ini" pattern.
Use a text editor to create the
safety_debug.ini
file. Create an empty file, save it with the
*.ini
extension, and copy the following
command into the file: "LOAD .\debug\<YOUR_PROJECT>_crc.hex INCREMENTAL".
This command loads the
<YOUR_PROJECT>_crc.hex
file from the
.\debug\
relative path and this address is relative to the project
file (
<YOUR_PROJECT>.uvprojx
in the presented case). It means that the file is in the
debug
folder.
It is necessary to save this file to the project root path (to the folder with
<YOUR_PROJECT>.uvprojx
in the presented case).
After these IDE settings, the IDE calls the
crc-hex.bat
file after the build and it uses the alternative hex file
<YOUR_PROJECT>_crc.hex
as the source for programming during the download.
5.2.2.3 Linker settings for information table
The
crc-hex.bat
postbuild file expects the information table at the end of the
*.hex
file. For this purpose, it is good to define your
own section in the linker. In the uVision Keil IDE, it can be the following:
Post-build CRC calculation
LPC CM0 Safety Example , Rev. 3, 07/2021
NXP Semiconductors
18