NOTICE: This website will be shut down in the near future. Product content has moved to nxp.com. Forum content and FAQs have been moved to community.nxp.com. We encourage you to create a user account on nxp.com to use the new community forums and access NXP microcontroller content. We greatly appreciate your contributions and look forward to seeing you at our new web location.

 

Post-processing your linked application

lpcxpresso-support's picture

It is sometimes useful to be able to automatically post-process your linked application, typically to run one or more of the GNU 'binutils'.

For example, any application project that you create using the Project wizard will have least one such "post-build step" - typically to display the size of your application.



Note: Additional commands may also be listed (for example to create a binary and to run a checksum command), but be commented out by use of a # character and hence not executed. Any commands following a comment #command will be ignored

Adding addition steps is very simple.

In this example we are going to carry out three post-link steps:

  • displaying the size of the application
  • generate an interleaved C / assembler listing
  • create a hex version of the application image.

To do this:

  • Open the Project properties. There are a number of ways of doing this. For example, make sure the Project is highlighted in the Project Explorer view then open the menu "Project -> Properties".
  • In the left-hand list of the Properties window, open "C/C++ Build" and select "Settings".
  • Select the "Build steps" tab
  • In the "Post-build steps - Command" field, click 'Edit...'
    • paste in the lines below and click 'OK'
arm-none-eabi-size ${BuildArtifactFileName};
arm-none-eabi-objdump -S ${BuildArtifactFileName} > ${BuildArtifactFileBaseName}.lss;
arm-none-eabi-objcopy -O ihex ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.hex;

Note that the above is actually a single line with each post-build step separated from the next by a ";" (semi-colon) character. 

  • Click apply
  • Repeat for your other Build Configurations (Debug/Release)

Next time you do a build, this set of post-link steps will now run, displaying the application size in the console, creating you an interleaved C/assembler listing file called <projectname>.lss and a hex file called <projectname>.hex.

Temporarily removing post-build steps

If you want to temporarily remove a step from your post-build process, rather than deleting it completely - move that entry to the end of the line and pre-fix it with a "#" (hash) character. This acts as a comment, causing the rest of the post-build-step line to be ignored.


Related FAQs

0
Your rating: None
feedback