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.
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
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
To find out more about the commands:
- type the command
- or type the command with the option -h
- use the Linux man pages 🙂

help
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:
Happy Shelling 🙂
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.
LikeLiked by 1 person
Hi Jeff,
yes, it is provided by the busybox. I did not try to rebuild things myself, but this would be certainly doable.
LikeLike
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?
LikeLiked by 1 person
Hi Rhys,
at your service: https://mcuoneclipse.com/2021/04/20/play-a-sound-at-the-end-of-the-build-with-eclipse/
I hope this helps,
Erich
LikeLike
Wow Erich, thank you, what a champion!!
LikeLiked by 1 person
You are welcome 🙂
LikeLike
Pingback: Play a Sound at the End of the Build with Eclipse | MCU on Eclipse
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,
Andrew
LikeLiked by 1 person
The pre- and post-build actions itself do not have a condition associated: they are part of the ‘flow’ and executed as part of the build. If you would like to do things as you described you could use a make file instead. See https://mcuoneclipse.com/2017/07/22/tutorial-makefile-projects-with-eclipse/
LikeLike
Okay, thank you 🙂
LikeLiked by 1 person