Skip to content

Commit

Permalink
docu
Browse files Browse the repository at this point in the history
  • Loading branch information
thseiler committed Sep 19, 2011
1 parent ff788a0 commit ce5c456
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 9 deletions.
5 changes: 5 additions & 0 deletions avr/2boots/ChangeLog
@@ -0,0 +1,5 @@
19. September 2011
------------------

* New Makefile, build should be more flexible now
* New flash.sh script, takes care of flashing outside of Makefile
37 changes: 28 additions & 9 deletions avr/2boots/README
Expand Up @@ -15,8 +15,8 @@ IDE.
Features:
* Uses just 2kb of flash, so it fits into the normal boot block of most atmegas
* Serial bootloader is arduino compatible (avrdude / stk500v1)
* MMC bootloader can read directly a *.hex file
* Supported are FAT16 formatted cards up to 2GB in size (no SDHC)
* MMC bootloader can read directly a *.hex file from an SD/MMC card
* Supported are FAT16 formatted cards up to 2GB in size (no SDHC yet)
* All of ladyada's fixes to the original bootloader are included


Expand All @@ -29,29 +29,50 @@ On Linux, simply install avr-gcc, lib-avr and avrdude, then run:
This should build 2boots for all supported boards, you can find the .hex
files in the ./build subfolder

Which .hex the right one for my board?
--------------------------------------
The .hex files are named after the following sheme:

2boot-BOARDNAME-MCU-FREQ-PIN.hex

where PIN denotes the MMC/SD Chip select line to use.

2boots-arduino-atmega328p-16000000L-PD4.hex:
- Arduino ETH
- Arduino with atemga328 (i.e. Uno) plus Ethernet Shield

2boots-arduino-atmega168-1600000L-PD4.hex for
- Arduino with atmega168 (i.e.) plus Ethernet Shield

2boots-arduno-atmega328p-8000000L-PD4.hex:
- Arduino Pro 3.3V (w atmega328p) plus Ethernt Shield



How to flash
------------
Connect your board to your ISP programmer of choice,
Adapt the setting for avrdude in the Makefile (ISPTOOL, ISPPORT, ISPSPEED)
and append '_isp' to your make command.
Adapt the setting for avrdude in the flash.sh script (ISPTOOL, ISPPORT, ISPSPEED),
then, run:

# sudo ./flash.sh build/2boots-arduino-atmega328p-16000000L-PD4.hex


How does the MMC/SD stuff work?
-------------------------------

The SD bootloader is disabled by default. If you want to enable it,
The MMC/SD bootloader is disabled by default. If you want to enable it,
you will have to name your board. For this, simply load the included
Sketch "NameBoardSketch.pde", change the name you want to assign to
the board and the run the sketch.

The Sketch simply writes that name to the end of the EEPROM.
The Sketch simply writes that name to the end of the EEPROM, in inverse order.

If the bootloader finds a name in the EERPOM, it will init the SPI hardware,
search for an MMC / SD card and then look for a file that starts with
board name, and ends in HEX.

If your board is named "SAMPLE", then a file SAMPLE000.hex would work, as
If your board is named "SAMPLE", then a file SAMPLE.hex would work, as
would SAMPLE001.hex etc...

If no file was found, the bootloader will revert to the serial method.
Expand All @@ -66,5 +87,3 @@ Where can I find the .hex file in the Arduino IDE ?
It used to be in the applet folder. This changed with arduino-0018
Have a look at this thread:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1268011960


1 change: 1 addition & 0 deletions avr/2boots/TODO
@@ -0,0 +1 @@
* port to ATmega1280 and ATmega2650
34 changes: 34 additions & 0 deletions avr/2boots/flash.sh
@@ -0,0 +1,34 @@
#!/bin/sh

ISPTOOL="avrispmkII"
ISPPORT="usb"
ISPSPEED="-b 115200"


BOARD=`basename $1 | cut -d - -f 2`
MCU_TARGET=`basename $1 | cut -d - -f 3`

case "${MCU_TARGET}" in


"atmega168" )
EFUSE=00
HFUSE=DD
LFUSE=FF
;;
"atmega328p")
EFUSE=05
HFUSE=D2
LFUSE=FF
;;
"atmega1280")
EFUSE=F5
HFUSE=DA
LFUSE=FF
;;
esac


avrdude -c ${ISPTOOL} -p ${MCU_TARGET} -P ${ISPPORT} ${ISPSPEED} -e -u -U lock:w:0x3f:m -U efuse:w:0x${EFUSE}:m -U hfuse:w:0x${HFUSE}:m -U lfuse:w:0x${LFUSE}:m
sleep 3
avrdude -c ${ISPTOOL} -p ${MCU_TARGET} -P ${ISPPORT} ${ISPSPEED} -U flash:w:$1 -U lock:w:0x0f:m

0 comments on commit ce5c456

Please sign in to comment.