...
Currently, the OpenWSN Zigduino fork (available at https://github.com/SvenAkk/openwsn-fw ) contains adjusted Sconstruct and Sconscript files that allow working with this toolchain for AVRDUDE based programming of a Zigduino (an Arduino board) using a JTAGICE3 on a configured Windows Machine. These files are also included to on this page but the most recent versions are always on the fork.
Using this guide allows a Windows 8.1 or Linux machine, using a JTAGICE3 programmer, to flash the Zigduino platform with the OpenWSN Zigduino port firmware. No guarantees are made for other software or hardware although this will likely be similar.
AVR-GCC and AVRDUDE for Windows
There are no official easy-to-use recent avr-gcc versions available. The easiest way to work with AVR for Windows is using Atmel Studio, which forces using a big software solution, or using the outdated WinAVR tools, which is incompatible with more recent JTAG devices such as the JTAGICE3. In addition, most online resources are (partly) outdated, though still useful (See also: http://m8051.blogspot.be/2015/01/avrdude-on-windows-long-time-after.html ). This guide describes how to easily get a more recent version of AVRDUDE working with Windows. Alternatively, you can always compile the most recent version of AVRDUDE yourself (from http://www.nongnu.org/avrdude/ ) but this is a fairly painful process on an unconfigured Windows computer (see also).
...
The AVR toolchain itself should now be working on your computer. Test it out by opening the command line terminal and doing and seeing the following:
...
Code Block |
---|
> avrdude -v avrdude: Version 6.1-svn-20131205, compiled on Dec 5 2013 at 17:34:22 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch System wide configuration file is "C:\avr-gcc\bin\avrdude.conf" |
JTAGICE3 with Windows
Unfortunately, AVRDUDE relies on the JTAGICE3 programmer to be connected to a Linux USB port such as LibUSB (source). In addition, depending on the firmware of the JTAGICE3 the USB descriptors might be totally different (source and source).
...
You should now be able to use avrdude to flash your firmware using a JTAGICE3.
AVR Toolchain on Linux
Using the AVR-toolchain is much simpler on Linux.
...
Note also that this does not install the most recent versions of this software. Therefore, it is sufficient to program but, for example, lacks debugging support with the JTAGICE3.
See the "Debugging" section for more info on how to make this work.
Tying it together – integrating it all and flashing the Zigduino firmware
As a reference on how you can use this toolchain for your own port, we describe how to do it for the Zigduino platform.
...
The variable included does not actually matter; the port itself is automatically detected and will simply flash the board it is connected to.
Adjusting fuses
If you need to adjust the fuses, simply go to the following code in Sconscript:
...
Note that if you flash over ISP, you need to adjust the same lines but in the "==== upload over ISP ====" section.
Alternative ports
If you have another board and want to use the same toolchain and programmer, you only need the Sconstruct and Sconscript files with some small additions.
...
For the Sconscript file look for all mentions of 'zigduino' and follow that example to add the relevant code for your (type of) board.
Debugging with the JTAGICE3 on Linux
This section explains how to debug an atmel board with a JTAGICE3 on Linux.
...
In both cases, you need to have started avarice as above.
GDB in the command line interface
Simple, point GDB to the project file you want to debug, for example, oos_openwsn, and then attach it to avarice. Then you can start debugging away.
Code Block |
---|
sven@ubuntu:~/Desktop/OpenWSN_Sven/openwsn-fw$ gdb /home/sven/Desktop/OpenWSN_Sven/openwsn-fw/build/zigduino_avr/projects/common/03oos_openwsn_prog GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/sven/Desktop/OpenWSN_Sven/openwsn-fw/build/zigduino_avr/projects/common/03oos_openwsn_prog...done. (gdb) target remote localhost:4242 Remote debugging using localhost:4242 0x0041ff00 in ?? () (gdb) list 30 extern uint8_t radio_trx_end_isr(); 31 extern uint8_t radiotimer_compare_isr(); 32 extern uint8_t radiotimer_overflow_isr(); 33 34 //=========================== main ============================================ 35 uint8_t mcusr_backup; 36 37 extern int mote_main(void); 38 39 int main(void) { |
Debugging through Eclipse
Debugging through a graphical front-end can be easier. This has been tried out with Eclipse. This section has been copied mostly from http://avr-eclipse.sourceforge.net/wiki/index.php/Debugging with some relevant adjustments.
...