Command Line Pinguino — The Sequel!

Talk about bad timing… not less than two days after my original posting, does a new release of Pinguino IDE arrive! LOL. :)

It now includes a command line option but it still does not provide you with the means to upload the HEX file on a successful build. I have spoken with Jean-Pierre and we have both agreed that the way forward is a separation of concerns; to produce separate modules for editing, building and uploading. I will leave that to JP and his team as I have other things to do.

But… being a sad Unix hacker I decided that I still prefer using Emacs and I still want auto-uploading but this time I decided to get it without modifying pinguinobeta8.py in any way what-so-ever!

I have created a real simple bash script (Cygwin compatible in theory but I have not tested it as I don’t use/want/like Windows) that takes the first parameter and attempts to use the now present command line compile option and if that works it will upload it for me. If it fails then it dumps out the output it captured during the build which will contain the errors messages at the bottom.

For some reason it also seems to echo out the processed lines of the source file which is a little busy on the screen, it would be nice to be able to turn that off.

Here is the bash script, save it in a file called ‘pgmake’ then do

chmod +x pgmake

. This file must be in the same folder as the Pinguino IDE as it makes a relative reference to the tools folder.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
#
# This uses the Pinguino 8 release to command line compile a file and
# if that succeeds it will prompt the user and then upload the HEX
# file to the Pinguino
#
# If the build fails we display the output from the build.
#
upload()
{
    read -p "Press RETURN to upload the HEX file $1.HEX"
    ./tools/bin/docker -v 04d8 write $1.hex
}
 
./pinguinobeta8.py -nogui $1.pde &> $1.log && upload $1 || cat $1.log

The usage is as follows and please note that you only need specify the basic part of the filename, i.e. omit the PDE extension. This is a bare-bones, no error checking just get the bleeding job done script.

So, for example, to compile and upload a file called ERIC,

$ ./pgmake eric
Press RETURN to upload the HEX file eric.HEX
Processing device 009
erasing section [2000, 7fff]
writing section [2000, 7fff]
$

Cheers. :)

Published: May 1st, 2010 at 22:39
Categories: Pinguino, Python