**** Advance Notice ****

This site will be closed on 31 December 2015,

Important Information for users of NXP LPCXpresso

This site is for users of Code Red branded products.

NXP LPCXpresso users should visit the LPCXpresso FAQ's for up-to-date information relevant to that product.

Generating srec (Motorola S format), binary, ihex (Intel Hex) files

When building a project, the Code Red tools suite will create an ARM executable format (AXF) file - which is actually ELF/DWARF. This file can be programmed directly down to your target using the Code Red debug functionality. But it may also be converted into a variety of formats suitable for use in other external tools. The objcopy (arm-none-eabi-objcopy) utility is used for this. Objcopy can convert into the following formats:

For example, to convert example.axf into binary format, use the following command:

arm-none-eabi-objcopy -O binary example.axf example.bin

If you Ctrl-click on the projectname on the right hand side of the bottom bar of the IDE, this will launch a command prompt in the project directory with appropriate paths set up. All you need to do before running the objcopy command is change into the directory of the required Build configuration.

You can also select the .axf file in the Project Explorer, right-click and select "Binary Utilities->Create binary". You can change the options used to create a binary file in this way on the "Windows->Preferences, [LPCXpresso/RedSuite]/Utilites" preference page.

Automatically converting the file during a build

Objcopy may be used to automatically convert an axf file during a build. To do this, create an appropriate Post-build step. For more details please see FAQ Post-processing your linked application.

Image Checksums (NXP LPC families)

NXP parts use a word in the vector table of the processor to store a checksum that is examined by the bootloader to identify a valid image. For ARM7/ARM9 based parts this checksum word is stored at offset 0x14, for Cortex-M based parts it is stored at offset 0x1C.

When downloading code via the debugger, this checksum word will be filled in automatically as the image is downloaded.

When creating a binary file, you will need to ensure that you run the supplied checksum utility to post-process the binary yourself. If you modify the supplied post-build step to create your binary (as per the FAQ Post-processing your linked application, then this will normally be done automatically by the post-build step:

checksum -p ${TargetChip} -d ${BuildArtifactFileBaseName}.bin;  

But if you need to create a hex file for use by FlashMagic care needs to be taken that you do not run the checksum utility on the hex file itself. The checksum utility only works on binary files, not hex files. Therefore, the checksum utilty will corrupt your hex file if you use the hex file as input.

Note that FlashMagic will automatically set the checksum word for you when you use it to program a hex file to an LPC device. But if you wish to set the checksum yourself, then the recommend way of creating such a hex file is as follows:

Generating other types of checksum

There are many different types of checksums that users may want to perform on an image. A great tool for manipulating image files and generating a variety of checksums is the Open Source SRecord Tool.

OutputFormats (last edited 2012-01-15 20:36:13 by DerekMorris)