HWA
Bare metal programming with style
Diabolo (Diabolo Is A BOot LOader)

Diabolo is a bootloader developed using HWA for assembler programming for the device side, and Python for the host application.

The source code of Diabolo is in the atmel/avr/examples/diabolo/ directory.

Installing Diabolo on an AVR

In order to install Diabolo on the microcontroller, you must edit the file device/diabolo.sx to either include a preconfigured target definition or define the following symbols:

#define DIABOLO_PIN_RX (pin,2)
#define DIABOLO_PIN_TX (pin,2)
#define HW_DEVICE_SELF_PROGRAMMING enabled

Optionnally, you can also define additionnal fuses:

#define HW_DEVICE_CLK_SRC rc_8MHz
#define HW_DEVICE_CLK_PSC 1
#define HW_DEVICE_EXTERNAL_RESET enabled
#define HW_DEVICE_DEBUG_WIRE disabled
#define HW_DEVICE_WATCHDOG_ALWAYS_ON no
#define HW_DEVICE_CLOCK_OUTPUT disabled
#define HW_DEVICE_BROWNOUT_DETECTION 2500_2900mV

Then, you must include the HWA header that suits your target:

If you have avrdude installed on your system and your ISP is usbasp you just have to wire the target device to your programmer and that will program the Flash memory and the fuse bytes:

make install

Otherwise, you'll have to edit the device/Makefile to suit your programming tools.

Using the Diabolo host application

Once you have installed Diabolo on your microcontroller, you can check that everything works with the software/diabolo.py application.

Assuming you have only one USB-Serial adapter, that should display the status of your device:

python diabolo.py

and that should dump the program memory entirely:

python diabolo.py --read-flash --full --hexdump

Type python diabolo.py --help for a description of the command line arguments.

Known problems

Diabolo launches the application by jumping to the address the immediately follows the interrupt vectors. That fails if the application uses PROGMEM data and GCC stores it at that address.

atmega328p_au.h
ATmega328P-AU.