Hello,
This is my first post, so please let me know if I have done something wrong in regards to the forum.
I recently made my laptop dual boot Windows 10 and Ubuntu and have found that the picaxe preprocessor has been one of the few remaining things requiring me to boot into Windows due to my latest project having several linked files using
This thread in the forums outlined the situation: https://picaxeforum.co.uk/threads/macros-with-axepad.29809/
To partially work around this, I have written a python script that will process
When given a picaxe basic file, it will create a file with the given and all included files merged into one, then calls the correct compiler to compile or upload the code to the picaxe. It will also process the
All other command line arguments attempt to emulate those used by the compilers (
For example, an 18m2 could be programmed as follows:
Currently, macros,
The script and a simple set of picaxe files to test with can be found here: https://github.com/jgOhYeah/PICAXE-Libraries-Extras
This preprocessor is aimed at linux, however I don't think there is anything particularly platform specific, so it may work on other things as long as the filepaths and names of the compilers are set correctly. I am not sure if it is the correct place to locate them, but I copied the script into
There may be bugs and there definitely will be things to improve on, so feedback and or improvements are welcome.
This is my first post, so please let me know if I have done something wrong in regards to the forum.
I recently made my laptop dual boot Windows 10 and Ubuntu and have found that the picaxe preprocessor has been one of the few remaining things requiring me to boot into Windows due to my latest project having several linked files using
#include "filename.basinc"
.This thread in the forums outlined the situation: https://picaxeforum.co.uk/threads/macros-with-axepad.29809/
To partially work around this, I have written a python script that will process
#include
, #com
and #picaxe
directives and start one of the picaxe command line compilers from here: https://picaxe.com/software/drivers/picaxe-compilers/When given a picaxe basic file, it will create a file with the given and all included files merged into one, then calls the correct compiler to compile or upload the code to the picaxe. It will also process the
#picaxe
and #com
directives to select the compiler to use and serial port (although I think that the compiler can use the #com
anyway). The picaxe chip can also be selected as an argument when calling the script through the use of -vPART
.All other command line arguments attempt to emulate those used by the compilers (
-s, -f, -c
...) and are passed onto them (with the exception of the serial port, which may be overwritten by any #com
in the files. In terms of usage, hopefully it is fairly similar to using the compilers directly.For example, an 18m2 could be programmed as follows:
Code:
picaxe.py -v18m2 -c/dev/ttyUSB0 test.bas
#DEFINE
, #IF
and #ELSEIF
are not processed and are left exactly as they are, which may or may not cause the compiler to misbehave if they are used (I haven't tested them as I have not used them too much myself).The script and a simple set of picaxe files to test with can be found here: https://github.com/jgOhYeah/PICAXE-Libraries-Extras
This preprocessor is aimed at linux, however I don't think there is anything particularly platform specific, so it may work on other things as long as the filepaths and names of the compilers are set correctly. I am not sure if it is the correct place to locate them, but I copied the script into
/usr/local/bin
and the compilers to /usr/local/lib/picaxe/picaxe****
, where picaxe****
is each compiler file. This means that I can access it anywhere on the system without needing to remember where the script is saved.There may be bugs and there definitely will be things to improve on, so feedback and or improvements are welcome.