From bac72096b31cb5f7b063c3ae00dca237376995b5 Mon Sep 17 00:00:00 2001 From: WestfW Date: Thu, 9 Jun 2011 22:36:05 -0700 Subject: Makefile modification to allow building optiboot in more environments. Allows building within the Arduino Source tree, and within the Arduino IDE tree, as well as using CrossPack on Mac. Adds README.TXT to track arduino-specific changes (and documents the new build options.) This addresses Arduino issue: http://code.google.com/p/arduino/issues/detail?id=487 And optiboot issue http://code.google.com/p/optiboot/issues/detail?id=1 (which can be thought of as a subset of the Arduno issue.) Note that the binaries produced after these Makefile changes (using any of the compile environments) are identical to those produced by the crosspack-20100115 environment on a Mac. --- bootloaders/optiboot/README.TXT | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 bootloaders/optiboot/README.TXT (limited to 'bootloaders/optiboot/README.TXT') diff --git a/bootloaders/optiboot/README.TXT b/bootloaders/optiboot/README.TXT new file mode 100644 index 0000000..9a68e23 --- /dev/null +++ b/bootloaders/optiboot/README.TXT @@ -0,0 +1,55 @@ +This directory contains the Optiboot small bootloader for AVR +microcontrollers, somewhat modified specifically for the Arduino +environment. + +Optiboot is more fully described here: http://code.google.com/p/optiboot/ +and is the work of Peter Knight (aka Cathedrow), building on work of Jason P +Kyle, Spiff, and Ladyada. Arduino-specific modification are by Bill +Westfield (aka WestfW) + +Arduino-specific issues are tracked as part of the Arduino project +at http://code.google.com/p/arduino + + +------------------------------------------------------------ +Building optiboot for Arduino. + +Production builds of optiboot for Arduino are done on a Mac in "unix mode" +using CrossPack-AVR-20100115. CrossPack tracks WINAVR (for windows), which +is just a package of avr-gcc and related utilities, so similar builds should +work on Windows or Linux systems. + +One of the Arduino-specific changes is modifications to the makefile to +allow building optiboot using only the tools installed as part of the +Arduino environment, or the Arduino source development tree. All three +build procedures should yield identical binaries (.hex files) (although +this may change if compiler versions drift apart between CrossPack and +the Arduino IDE.) + + +Building optiboot in the arduino IDE install. + +Work in the .../hardware/arduino/bootloaders/optiboot/ and use the +"omake " command, which just generates a command that uses +the arduino-included "make" utility with a command like: + make OS=windows ENV=arduino +or make OS=macosx ENV=arduino +On windows, this assumes you're using the windows command shell. If +you're using a cygwin or mingw shell, or have one of those in your +path, the build will probably break due to slash vs backslash issues. +On a Mac, if you have the developer tools installed, you can use the +Apple-supplied version of make. +The makefile uses relative paths ("../../../tools/" and such) to find +the programs it needs, so you need to work in the existing optiboot +directory (or something created at the same "level") for it to work. + + +Building optiboot in the arduino source development install. + +In this case, there is no special shell script, and you're assumed to +have "make" installed somewhere in your path. +Build the Arduino source ("ant build") to unpack the tools into the +expected directory. +Work in Arduino/hardware/arduino/bootloaders/optiboot and use + make OS=windows ENV=arduinodev +or make OS=macosx ENV=arduinodev -- cgit v1.2.3-18-g5258 From a0d00b4d86cfbd5cb508eda69997175fab39e725 Mon Sep 17 00:00:00 2001 From: WestfW Date: Mon, 13 Jun 2011 19:07:07 -0700 Subject: http://code.google.com/p/arduino/issues/detail?id=368 Optiboot does not support ArduinoasISP programmer. When avrdude runs and talks to an arduino running ArduinoISP, it needs the optiboot (entered due to auto-reset) to abort and start the ArduinoISP "application" when it sees communications at the wrong serial speed. Unfortunately, optiboot treats all unrecognized command characters as "no-ops" and responds/loops for more commands, leading to a nice loop that never gets to the sketch. This patch causes characters received with Framing errors (the most likely error for speed mis-matches) to NOT reset the watchdog timer (normally done in getch()), which will cause the application to start if it continues for "a while." (tested. Works! Running ArduinoISP at speeds as high as 57600 still causes the bootloader to start the sketch (although it fails later on for other reasons.)) --- bootloaders/optiboot/README.TXT | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'bootloaders/optiboot/README.TXT') diff --git a/bootloaders/optiboot/README.TXT b/bootloaders/optiboot/README.TXT index 9a68e23..7e2f46d 100644 --- a/bootloaders/optiboot/README.TXT +++ b/bootloaders/optiboot/README.TXT @@ -27,7 +27,7 @@ this may change if compiler versions drift apart between CrossPack and the Arduino IDE.) -Building optiboot in the arduino IDE install. +Building Optiboot in the Arduino IDE Install. Work in the .../hardware/arduino/bootloaders/optiboot/ and use the "omake " command, which just generates a command that uses @@ -44,7 +44,7 @@ the programs it needs, so you need to work in the existing optiboot directory (or something created at the same "level") for it to work. -Building optiboot in the arduino source development install. +Building Optiboot in the Arduino Source Development Install. In this case, there is no special shell script, and you're assumed to have "make" installed somewhere in your path. @@ -53,3 +53,18 @@ expected directory. Work in Arduino/hardware/arduino/bootloaders/optiboot and use make OS=windows ENV=arduinodev or make OS=macosx ENV=arduinodev + + +Programming Chips Using the _isp Targets + +The CPU targets have corresponding ISP targets that will actuall +program the bootloader into a chip. "atmega328_isp" for the atmega328, +for example. These will set the fuses and lock bits as appropriate as +well as uploading the bootloader code. + +The makefiles default to using a USB programmer, but you can use +a serial programmer like ArduinoISP by changing the appropriate +variables when you invoke make: + + make ISPTOOL=stk500v1 ISPPORT=/dev/tty.usbserial-A20e1eAN \ + ISPSPEED=-b19200 atmega328_isp -- cgit v1.2.3-18-g5258 From 1f01799bbfd17eb04ec6322a123d6d26b21b09a0 Mon Sep 17 00:00:00 2001 From: WestfW Date: Tue, 14 Jun 2011 10:24:27 -0700 Subject: Allow the READ PARAMETER command to return our version number. (significant size impact: 14 bytes!) Initialized "address" to eliminate compiler warning (4 bytes!) Add "atmega168" as a more accurate target name than "diecimila" (keep diecimila as well for backward compatibility) Reduce the .hex and .lst targets that are stored in source control to the three basics: atmega8, atmega168, atmega328. The other targets remain in the makefile and makeall, but will need to be built from source if wanted. Which should be less of a problem now that the source is buildable without installing crosspack. --- bootloaders/optiboot/README.TXT | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'bootloaders/optiboot/README.TXT') diff --git a/bootloaders/optiboot/README.TXT b/bootloaders/optiboot/README.TXT index 7e2f46d..cd79cd9 100644 --- a/bootloaders/optiboot/README.TXT +++ b/bootloaders/optiboot/README.TXT @@ -68,3 +68,14 @@ variables when you invoke make: make ISPTOOL=stk500v1 ISPPORT=/dev/tty.usbserial-A20e1eAN \ ISPSPEED=-b19200 atmega328_isp + +The "atmega8_isp" target does not currently work, because the mega8 +doesn't have the "extended" fuse that the generic ISP target wants to +pass on to avrdude. You'll need to run avrdude manually. + + +Standard Targets + +I've reduced the pre-built and source-version-controlled targets +(.hex and .lst files included in the git repository) to just the +three basic 16MHz targets: atmega8, atmega16, atmega328. -- cgit v1.2.3-18-g5258