...
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, but which forces using a big software solution, or using the outdated WinAVR tools, which is incompatible with more recent JTAG devices such as jtagice3JTAGICE3. 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).
...
To fix this, download Zadig and run it. Select your JTAGICE3 from the list of devices and install the libusbK driver.
Normally, you You should now be able to use avrdude to flash your firmware using a JTAGICE3.
AVR Toolchain on Linux
The adjusted Sconscript has also been used on Linux, on Ubuntu 14.04Using the AVR-toolchain is much simpler on Linux.
Simply install the avr toolchain using:
...
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.
...
If you see this, your Zigduino has been correctly flashed with the OpenWSN firmware.
Note that Sconscript needs the adjusted Sconscript can also flash using an ISP interface. To use JTAG, simply do the above with a a 'jtag=' command to work with a jtag programmer. The variable . To use ISP, simply replace that command with 'isp='.
The variable included does not actually matter; the jtag port itself is automatically detected and will simply flash the board it is connected to.
...
and uncomment the following line:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#+ ' -U lfuse:w:0xf7:m -U hfuse:w:0xd7:m -U efuse:w:0xf5:m', #if you need to do fuses |
Remember that you only need to set the fuses once per change. Once changed, you can recomment the line again.
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.
Note, that I have not been able to get debugging working on Windows due to the lack of support for a recent standalone AVR-toolchain version on this platform. E.g., the JTAGICE3 has no support.
Therefore, only Linux is described. Thanks goes out to http://www.mikrocontroller.net/topic/301030#postform.
If you want to debug with the JTAGICE3, you aren't finished yet.
...
Finally, you can pick your desired gdb front-end. This has been tested with both regular GDB through the command line interface and with Eclipse.
In both cases, you need to have started avarice as above.
GDB in the command line interface
...
The first Tab (Main) should be configured like this, with the C/C++ application pointing towards your file.
For the Debugger tab. Most options have been set to reasonable defaults by Eclipse. The only options that need to be changed have been marked in the screenshotConfigure your options as shown.
GDB Command: change this to "avr-gdb". The preselected "gdb" does not work, as it would try to debug the target as an i386.
Next continue on the Startup tab and also configure it as shown.
Now the configuration is finished. Click on the Debug button to save everything and if all is well the debugging session should start and your application should stop at the beginning of your your mote_main() function in the loaded program.
View file | ||||
---|---|---|---|---|
|
...