Executing Multiple Commands as Post-Build Steps in Eclipse

The GNU ARM Eclipse plugins from Liviu already offer several built-in actions which can be performed at the end of a build: creating flash image, create listing file and printing the code and data size:

GNU ARM Eclipse Extra Post Build Steps

GNU ARM Eclipse Extra Post Build Steps

But what if I need different things, or even more things?

Post-Build Steps

For this there is the ‘Post-build steps’ settings I can use: that command is executed at the end of the build:

Print Size PostBuild Step

Print Size Post-Build Step

❗ The post build step is only executed if sources files have been compiled and linked. If you want to enforce that there is always a ‘true’ post build, then you need to delete some files in the Pre-build step to enforce a compilation and a link phase.

Multiple Post-Build Steps

But what I need more than one action in the post-build step? I could call a batch or script file, but this is probably an overkill in too many cases, and adds a dependency to that script file. A better approach is to directly execute multiple commands as post-build step.

Unfortunately, the documentation found about the post-build step with a web-search is misleading (e.g. in the Eclipse Luna documentation):

“Command: Specifies one or more commands to execute immediately after the execution of the build. Use semicolons to separate multiple commands.”

Unfortunately, semicolons is plain wrong (at least did not work for me) :-(. The solution is to use ‘&‘ (ampersand) to separate multiple commands on Windows:

💡 On Linux, use the ‘;’ to separate commands as noted in the documentation/help, and use ‘&’ on Windows. Unfortunately, this makes project not cross-platform.

Multiple Post-Build Commands

Multiple Post-Build Commands

And this works for me, at least under Windows 7 :-).

Links related to that topic:

Happy Post-Stepping 🙂


8 thoughts on “Executing Multiple Commands as Post-Build Steps in Eclipse

  1. The “&” (ampersand) symbol is the windows command line equivalent of the linux “;” (semicolon) command line to continue to the next command in the list.
    So in Windows we have:
    cmd1 & cmd2 & … cmdN

    In most Linux (BASH / DASH) the equivalent is:
    cmd1; cmd2; … cmdN

    The “pre-build” and “post-build” steps are just echo’d to a CLI.
    You’re absolutely correct Eric, the documentation is too centric on the *inx world for those build options.


    • Hi Jonathan,
      I had no time to try it on Linux, but I already expected something like this. Thanks for the confirmation, I will add a note to the article about that it indeed works with “;” on Linux. Thanks!


  2. Pingback: CRC Checksum Generation with ‘SRecord’ Tools for GNU and Eclipse | MCU on Eclipse

  3. Pingback: GNU Static Stack Usage Analysis | MCU on Eclipse

  4. Pingback: Aligning S19 Records to 64-bit Boundaries | MCU on Eclipse

  5. Pingback: Merging S19 Files | MCU on Eclipse

  6. I use winxp. The & doesn’t help when I want to run multiple post-build commands. Only the last command after & runs, the previous commands are reported as wrong argument. Any suggestion on how to fix this problem?


What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s