
LR_IROM3 m_fs_flash_crc_start __size_flash_crc__{
; Safety-flash CRC region
ER_CRC (m_fs_flash_crc_start) FIXED (__size_flash_crc__)
{
*(.flshcrc)
}
}
Where "m_fs_flash_crc_start" and "__size_flash_crc__" are the user-defined address. This address must be at the end of the flash.
After defining this section in the ROM, a correct structure must be defined in the C language:
/* The safety-related FLASH CRC value. */
fs_crc_t c_sfsCRC __attribute__((used, section(".flshcrc"))) =
{
.ui16Start = 0xA55AU,
.ui32FlashStart = (uint32_t)__ROM_start__,
.ui32FlashEnd = (uint32_t)&Load$$ER_IROM3$$Limit,
.ui32CRC = (uint32_t)FS_CFG_FLASH_TST_CRC,
.ui16End = 0x5AA5U
};
5.2.3 MCUxpresso postbuild CRC
The invariable memoty test example uses the
crc-hex.bat file for the post-build calculation, so this example does
not work on Unix/Mac operating systems.
NOTE
To use the
crc-hec.bat
file in the MCUXpresso IDE, do some settings in the IDE.
1. Set the "Options → C/C++ Build → Settings → Build steps → Post-build steps" options correctly.
2. Set the debug sesion (or the GUI Flash tool) configuration correctly.
3. Put the "Information table" at the end of the invariable memory.
5.2.3.1 Post-build configuration
It is necessary to set the post-build string, so go to the "Options → C/C++ Build → Settings → Build steps → Post-build steps" menu.
Copy and paste the following post-build string into it:
arm-none-eabi-objcopy -v -O ihex "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.hex"
${ProjDirPath}/crc_hex.bat -${ConfigName}/${BuildArtifactFileBaseName}.hex -${ConfigName}/$
{BuildArtifactFileBaseName}_crc.hex -tools\\srecord\\srec_cat.exe
Post-build CRC calculation
LPC CM0 Safety Example , Rev. 3, 07/2021
NXP Semiconductors
19