Using Linux Shell Commands on Windows with MCUXpresso Pre-/Post-Build Steps

In “Touch & Build: Auto-Update of Firmware Date and Time” I’m using commands as ‘touch’ in a pre-build script with the NXP Eclipse based MCUXpresso IDE. That ‘touch’ command is not a Windows shell command, but common on Linux: it updates the time/date of a file.

Build Step Dialog in MCUXpresso IDE

Build Step Dialog in MCUXpresso IDE

As a Windows user you might wonder what is about this ‘Linux compatible shell’?

It is actually the ‘sh.exe’ located in

<IDE Installation>\ide\buildtools\bin
sh executable

sh executable

The files are actually from the Eclipse Embedded CDT (GNU MCU Eclipse Windows Build Tools). It comes with a bunch of utilities to make cross platform development easier on Windows as many scripts depend on Linux tools, and for this they are provided in this package.

So what commands and tools can I use? A simple way to find out is to run the sh.exe in a Windows cmd shell and type the command ‘help’:

sh in Windows cmd

sh in Windows cmd

To find out more about the commands:

  • type the command
  • or type the command with the option -h
  • use the Linux man pages 🙂


That’s it 🙂 With this I can do powerful things in the including doin hexdumps, moving files or creating new ones, calculating checksums or doing a ftp or scp (secure copy) to transfer the binary file to a remote host:

post build step with scp in MCUXpresso IDE

Happy Shelling 🙂


10 thoughts on “Using Linux Shell Commands on Windows with MCUXpresso Pre-/Post-Build Steps

  1. I use MCUXpresso post-build scripting to create downloadable firmware package with a SHA256 digest added, and for making factory firmware by calling a PEMicro script that uses a .dll file to create and name the .sap file for a Cyclone programmer, as well as to get the CRC for that file. I could even copy those build artifacts to where they’re needed, if I wanted to.

    The Linux utilities appear to be provided by busybox, so commands may not have all the options available that you want. I haven’t tried this, but I imagine you could build your own version of busybox with the options you want to use, if they’re not already availabole.

    Liked by 1 person

  2. Erich, I’m using CodeWarrior atm so it’s not identical, but I’d really like to make a ‘beep’ after compilation just so I don’t miss the event. I haven’t been able to find a way; any thoughts?

    Liked by 1 person

  3. Pingback: Play a Sound at the End of the Build with Eclipse | MCU on Eclipse

  4. Hi Erich,
    I’m a beginner at dealing with these pre-build commands and could use some tips.
    I am using MCUXpresso, and in the pre-build I am calling a ZPSConfig.exe which outputs two files: zps_gen.c and zps_gen.h
    These files are generated every time when I build the code even if I didn’t change anything to the .zpscfg file.
    I would like to call this executable only when the .zpscfg file gets modified or the zps_gen.c/h files are missing.

    Any idea on how to do that ?
    Thank you very much,

    Liked by 1 person

What do you think?

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

You are commenting using your 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.