NXP Semiconductors LPC CM0 Series Скачать руководство пользователя страница 18

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

As mentioned in 

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

Содержание LPC CM0 Series

Страница 1: ...LPC CM0 Safety Example NXP Semiconductors Document identifier IEC60730BLPCCM0EUG User s Guide Rev 3 07 2021...

Страница 2: ...guide 3 Chapter 2 Hardware settings 4 Chapter 3 File structure 8 Chapter 4 Example application 10 Chapter 5 Running example 14 Chapter 6 IEC60730B tests 24 Chapter 7 Revision history 27 NXP Semiconduc...

Страница 3: ...gh the MCUXpresso SDK website This example user s guide describes how to set the hardware correctly and how to use the example code with the IEC60730B Safety library The library user s guide is the ma...

Страница 4: ...USB connector is open Short this jumper to use an external debug connector The default debugger in the example project is set to CMSIS DAP FreeMASTER FreeMASTER communication is used via an onboard d...

Страница 5: ...use the on board debugger make sure that jumper JP1 next to the USB connector is open Short this jumper to use an external debug connector The default debugger in the example project is set to CMSIS D...

Страница 6: ...wer the board via USB make sure that jumper JP2 is set to Loc Then connect the USB to connector J6 The default debugger in the example project is set to CMSIS DAP If downloading to the device does not...

Страница 7: ...expected value of the custom bandgap can be set in the safety_config h file define ADC_BANDGAP_LEVEL 2 5 Figure 3 Hardware connection of LPCXpresso51U68 The test voltage of 2 5 V is provided by a resi...

Страница 8: ...tains the source files for the peripheral test this is a common cross core These tests are compiled to library libIEC60730B_ core _COM_ compiler _ version a The compiler folder contains compiler suppo...

Страница 9: ...ure 5 Figure 5 Example of project structure in example folder This folder contains the example source file and three folders for the IDE project file iar mcux mdk The following files are generated by...

Страница 10: ...library and safety example related folders The safety related folders are the following Board this folder contains the files related to the board used clock_config h pin_config h board h and so on CP...

Страница 11: ...The project_setup_ your_board c file contains the setup functions clock port UART and so on The safety_cm0_lpc c file contains the handling function for safety routines from the IEC60730B library and...

Страница 12: ...NABLED 1 define FMSTR_SERIAL_ENABLE 1 Other defines are used to configure the safety test as a parameter to a function or to fill structures 4 3 safety_test_items c file The safety_test_items c and h...

Страница 13: ...file and the corresponding h file contain a library handling function Each function contains a detection If a safety error ocurrs the SafetyErrorHandling function is called Source file safety_cm0_lpc...

Страница 14: ...ng Running FreeMASTER Download and install FreeMASTER from www nxp com freemaster The example project is in the safety pmp file Open it Check the project settings for your application Open Project Opt...

Страница 15: ...Figure 9 Setting UART speed Now you can connect to the development board by pressing CTRL G or clicking the GO button FreeMASTER monitoring LPC CM0 Safety Example Rev 3 07 2021 NXP Semiconductors 15...

Страница 16: ...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 b...

Страница 17: ...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 t...

Страница 18: ...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...

Страница 19: ...t 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...

Страница 20: ..._cat exe the path to the screcat exe utility Because the name of your poject is set as the BuildArtifactFileBaseName variable this postbuild is independent on your project name Figure 10 Configuration...

Страница 21: ...fined address but this section must be placed at the end of the output hex file 5 2 3 3 Flash loader configuration It is necessary to set a correct output file for the download to the target There are...

Страница 22: ...g GUI Flash Tool Only the SEGGER J Link probes in the GUI Flash Tool support hex files In the GUI Flash Tool settings select Workspace Configuration PROJECT_NAME _crc hex file for download Post build...

Страница 23: ...Figure 10 GUI Flash Tool SEGGER J Link Post build CRC calculation LPC CM0 Safety Example Rev 3 07 2021 NXP Semiconductors 23...

Страница 24: ...s set up correctly before calling the AIO test In some cases it is necessary to connect this signal externally by a wire to the corresponding pin The test is perfomed in a sequence as defined in the s...

Страница 25: ...ld result The post build calculation is different for each IDE In the IAR IDE the CRC is calculated by the IDE directly using the linker see Options Build Action The Flash test is fully integrated to...

Страница 26: ...tack is covered by the variable memory test The overflow or underflow of the stack can occur if the stack is incorrectly controlled or by defining the too low stack area for the given application Choo...

Страница 27: ...r SDK Description 0 2 9 0 Intial release 1 2 10 0 Change devices supported in SDK rel 2 10 2 2 10 0 Post build description added 3 Version cover SDK 2 9 and SDK 2 10 release document for web NXP Semic...

Страница 28: ...ould implement appropriate design and operating safeguards to minimize the risks associated with their applications and products NXP the NXP logo NXP SECURE CONNECTIONS FOR A SMARTER WORLD COOLFLUX EM...

Отзывы: