This is the Other Machine Co production fork of Synthetos's g2 firmware.
This project requires gcc 4.8.
You can install the toolchain using any of the following commands:
make
make toolchain
cd Tools && make
The firmware is contained in the TinyG2/
directory.
When compiling the TinyG firmware, you need to specify a platform:
make PLATFORM=Othermill
make PLATFORM=OthermillPro
make PLATFORM=G2v9i
You must build the firmware from the TinyG2/
directory:
cd TinyG2 && make PLATFORM=OthermillPro
cd TinyG2 && make PLATFORM=G2v9i
Alternatively, you can use the top-level Makefile shim:
make fw
This command build the G2v9i
version of firmware, which is targeted for boards in V2 machines.
Firmware binaries can be found in the TinyG2/bin
folder. Output is organized by PLATFORM
.
The build puts both an ELF and a binary. ELF is the executable linker format and has symbols for debugging. The .bin is the binary image that we supply to BOSSA.
To clean, run make clean
at the top-level. By default, this will run a clean build for the G2v9i
platform.
If you need to clean another platform, specify it as you would during compilation:
cd TinyG2 && make PLATFORM=OthermillPro clean
cd TinyG2 && make PLATFORM=G2v9i clean
To get TinyG2 to reboot into SAM-BA mode, you can issue the json command {"boot":1}. You can also open & close the serial port at 1200 baud. The easiest way to do the latter is with the command stty -f /dev/tty.usbserial* 1200.
When in SAM-BA mode, we update firmware with the open source utility BOSSA (the SAM-BA version of avrdude). Our branch of it is here, though the open-source version can be used for standalone flashing.
To flash the program using BOSSA, use the following command template:
bossac -p tty.usbserialXX -e -w -v -b -R path/to/firmware.bin
Example:
bossac -p tty.usbmodem1411 -e -w -v -b -R g2/TinyG2/bin/G2v9i/G2v9i.bin
-p
specifies the serial port. It is likely to be/dev/tty.usbserialXX
.- Important:
-p
prepends "/dev/
", so if you supply the/dev/
, it won't find the serial port.
- Important:
-e
is erase-w
is write,-v
is verify (aka read back and check that it's valid).-b
sets the machine to boot into firmware next time it reboots-R
tells it to reboot.- The last argument is the filename of the firmware, in .bin format.
You can debug the TinyG through JTAG using a SAMA-ICE adapter and the JLink tools.
You will need to download and install the JLink software package from here. This will provide JLinkGDBServer
, which we use for talking to the SAMA-ICE adapter.
You can start the JLinkGDBServer from the command line:
JLinkGDBServer -USB -device ATSAM3X8C -endian little -if JTAG -speed auto -noir
Once the server is running, you can connect to the device using arm-none-eabi-gdb
.
In the TinyG/
directory, run arm-none-eabi-gdb
. gdb
will mention that it connected to JLinkGDBServer.
We recommend running arm-none-eabi-gdb
inside of the TinyG/
folder so that the .gdbinit
file is detected.
You can build the code and open a debug terminal by adding debug
to the build command:
make PLATFORM=OthermillPro debug
This will automatically connect to gdb
. The JLinkGDBServer
needs to be running.