uCon HomePage

Script Cmd: AVRLOADER


AVRLOADER [-dDRvp:] {dld|vfy|vsn} [filename]

Why in the world would I add a command to hook to the Arduino Optiboot bootloader when I can just use avrdude?  Good question!  I had a need for an RTS-based reset (instead of the typical DTR-based reset built into most Arduino compatible boards) and found it easier to write my own uCon based loader than to figure out how to build avrdude on a windows machine....

Options:
-d                    Enable uCon's delay-between-character during the transfer.
-D                    Use DTR to reset the target.
-R                    Use RTS to reset the target.
-p {pgsize}     Specify the page size (default=128).  Should be coordinated with the device's flash-erase block size.
-v                     Additive verbosity.

Commands:

dld:
Download the intel-hex formatted file specified by "filename" to the target assumed to be running the optiboot bootloader.
vsn:
Display the version of the bootloader
vfy:
Verify that the loaded image matches the file specified.

For example...

Assume you're using Arduino IDE to build a sketch called serial_blink.ino.  The IDE will typically place the .hex file in the user's AppData/Local/Temp area under a directory that will only exist while the IDE is running.  For the example, that path is "C:\Users\SOMEBODY\AppData\Local\Temp\arduino_build_12345\serial_blink.ino.hex".   The full path will be shown in the trace window of the IDE when you check the box in preferences labeled "Show verbose output during: compilation".   With that in mind, the following script could be used:

 

# Print version of loader:
AVRLOADER -R vsn
SET FULLPATH "C:/Users/SOMEBODY/AppData/Local/Temp/arduino_build_12345/serial_blink.ino.hex"
# Program the image to the board:
AVRLOADER -R dld "${FULLPATH}"
# Vefify that the image was successfully programmed:
AVRLOADER -R vfy "${FULLPATH}"