New optiboot; beta testers welcome...

opti8.build.variant=standard

How about:

opti8.build.variant=arduino:standard

The first line should work OK when added to the boards.txt in the arduino distribution, but the second will be needed if you're adding to one of the boards.txt in the user sketch directories...

Hey, guys. I have a newbie question... I'm using a Duemilanove Arduino as my ISP and would like to burn the Optiboot v4.4 bootloader on a new chip. I've succesfully burned the optiboot bootloader using the avrdude commands in a terminal window. What I would like to do is use the Arduino 1.0 IDE to do this.

I'v read the instructions here, but how do I confirm that the optiboot bootloader was loaded, as opposed to the standard one?
http://code.google.com/p/optiboot/

Under the Tools -> Board menu, do I choose the Arduino Uno (which is what I'd need to choose when loading sketches with the optiboot bootloader) or Arduino Duemilanove w/ Atmega328 (my Arduino ISP)?

Thanks, in advance.

do I choose the Arduino Uno

Yes. Once you have optiboot on an ATmega328, you can start calling it an Arduino Uno.
(If you were to put optiboot on an ATmega8 or ATmega168, you would have to create a new boards.txt entry to change at least the upload bitrate...)

I still cannot get the optiboot to work FOR UPLOADING VIA SERIAL on a Mega8A.

I have uploaded the optiboot bootloader using the AVR ISP MK2 and tried uploading a sketch but it doesn't upload either BUT it does upload and run using "Upload with programmer" (this is the basic blink sketch)

I have the 6 pin FTDI header connected just like I would for a 328 ie 1-GND, 3-VCC,4-TX,5-RX,6-100nF cap with other side going to reset pin. It works on 328, 664 and 1284 so lead etc is known good. Am I missing something?

Optiboot needs adding to version 1.1 of the IDE as a standard feature. 1.5K saved on the 328 with no disadvantages as far as I can see is too good to miss. Hence my trying to get it to work on the Mega8.

ALSO

If I try and upload the bootloader via the IDE I get this:

avrdude: Sent: . [1d] . [04] . [04] . [00] . [a0] . [01] . [fd] . [00] 
avrdude: Recv: . [1d] . [00] . [00] . [a0] . [01] . [ff] . [00] 
avrdude: Sent: . [1d] . [04] . [04] . [00] . [a0] . [01] . [fe] . [00] 
avrdude: Recv: . [1d] . [00] . [00] . [a0] . [01] . [ff] . [00] 
avrdude: Sent: . [1d] . [04] . [04] . [00] . [a0] . [01] . [ff] . [00] 
avrdude: Recv: . [1d] . [00] . [00] . [a0] . [01] . [ff] . [00] 
avrdude: erasing chip
avrdude: Sent: . [12] . [0a] . [00] . [ac] . [9f] . [f0] . [ff] 
avrdude: Recv: . [12] . [00] 
avrdude: Sent: . [10] . [c8] d [64] . [19]   [20] . [00] S [53] . [03] . [ac] S [53] . [00] . [00] 
avrdude: Recv: . [10] . [00] 
avrdude: reading input file "/Users/darren/Applications/Arduino version 1.00/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/optiboot/optiboot_mega8.hex"
avrdude: can't open input file /Users/darren/Applications/Arduino version 1.00/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/optiboot/optiboot_mega8.hex: No such file or directory
avrdude: read from file '/Users/darren/Applications/Arduino version 1.00/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/optiboot/optiboot_mega8.hex' failed
avrdude: Sent: . [11] . [01] . [01] 
avrdude: Recv: . [11] . [00] 

avrdude done.  Thank you.

BUT

The file IS there, exactly where it is supposed to be !!!

Yes. Once you have optiboot on an ATmega328, you can start calling it an Arduino Uno.

I guess I confused the issue... my question is how do I get optiboot on the ATmega328 using the Arduino 1.0 IDE?

The second part of the question is: while setting up for the optiboot burn, what board must I select from the Tools -> Board menu: Arduino Uno or Arduino Duemilanove w/ Atmega328 (my Arduino ISP)?

Thanks, westfw.

I dont use IDE 1.0.. I have v23 still..

but for a quick steps.. I did the following:

took my Arduino Duemilanove 2009 board...

*made sure correct COM port was selected..
*made sure I had board setting set to Arduino Duemilanove or Nano w/328

uploaded the Optiloader sketch to my Arduino.

(took my blank 328p chip/set-up...with crystals..caps..etc)

connected the following from my Arduino Due 2009 (that now has optiloader 'sketch' on it) to my blank 328p set-up

// 10: slave reset >> to blank chip RESET
// 11: MOSI >> to blank chip pin 11
// 12: MISO >> to blank chip pin 12
// 13: SCK >> to blank chip pin 13
// 5v+ to 5v+
// GND to GND

power it up.. it will auto detect the board/chip you have connected (if there is support for it).. and write the Optiloader 'bootloader' to the blank chip. (it will output a message on the serial monitor through the IDE if you want to read/check)

After optiloader 'bootloader' has been flashed to your blank chip/board...it is now ready to handle sketches being uploaded to it..

To do this.. you connect your newly flashed board to your computer..

open the IDE....

*make sure correct COM port was selected..
*make sure I had board setting set to "UNO"..

and upload your sketches..

Thanks for the response, xl97.

A couple of follow-up questions:

uploaded the Optiloader sketch to my Arduino.

Where did you get that sketch? It wasn't in the optiboot_v4_4.zip file that I downloaded from the optiboot website: Google Code Archive - Long-term storage for Google Code Project Hosting.

power it up.. it will auto detect the board/chip you have connected (if there is support for it).. and write the Optiloader 'bootloader' to the blank chip. (it will output a message on the serial monitor through the IDE if you want to read/check)

I'm assuming that you still select the Tools -> Burn Bootloader (the bootloader doesn't get burned automatically, upon powering up Arduino Due 2009, right? More importantly, are you saying that I'll be able to confirm that the proper optiboot_atmega328.hex bootloader file was loaded... by seeing the serial monitor, not the bottom section of the Arduino IDE window?

Sorry for the dumb questions, but do appreciate your help!

OptiLoader is separate from the bootloader itself, mostly. You can find it here: https://github.com/WestfW/OptiLoader

OptiLoader runs on the Arduino where you might have run ArduinoISP, and it DOES eliminate the need for the "burn bootloader" step. Assuming a target chip or board is properly wired to the Arduino running optiLoader, it does in fact burn the bootloader into the target automatically on powerup or reset.

Now I understand... OptiLoader is what I'm missing. Thanks for the clarification, westfW... and thanks for writing the OptiLoader sketch!

Hopefully the final question:

The OptiLoader readme file states:

It stores multiple copies of the optiboot bootloader in program flash memory.

as well as:

The internal copies of the bootloader are prepare manually from the .hex files compiled in the bootloader directories. (There's an easy editor macro process, but it is manual.)

I'm guessing that the "internal copies" of the bootloaders are chosen from somewhere, when compiling the OptiLoader sketch and uploading it onto the Arduino programmer. If I perform the following instruction (from Google Code Archive - Long-term storage for Google Code Project Hosting.), will I be OK? I just want to be sure that the latest Optiboot v4.4 will be used.

To install into the Arduino software
1.Download the latest Optiboot zip file and extract it.
2.You will need to be using a recent version of the Arduino environment, version 18 or later.
3.Create a 'hardware' directory inside your sketches folder.
4.Copy the optiboot directory into the hardware directory.
5.Restart the Arduino software. New boards will appear in the Tools > Board menu.

I'm guessing that the "internal copies" of the bootloaders are chosen from somewhere, when compiling the OptiLoader sketch and uploading it onto the Arduino programmer.

The internal copies are chosen at the time the SOURCE is prepared (manually, by me (in the case of the official version.)) You don't need to have bootloader hex files anywhere else on your computer to use optiLoader.
And yes, the included hex files are 4.4 and should be the same as the "new" Unos have.

You can actually look at this in the optiLoader sketch, though it's a bit obscure. At the end are a bunch of data structures containing the hex files, that look like:

image_t PROGMEM image_328p = {
  {    "optiboot_atmega328.hex" }  ,
  {    "atmega328P" }  ,
  0x950F, /* Signature bytes for 328P */
  {    0x3F,0xFF,0xDE,0x05,0 }  ,
  {    0x2F,0,0,0,0 }  ,
  128,
  {
    ":107E0000112484B714BE81FFF0D085E080938100F7\n"
      ":107E100082E08093C00088E18093C10086E0809377\n"
      ":107E2000C20080E18093C4008EE0C9D0259A86E02C\n"
 //          ----------->=% snip ================
      ":107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6\n"
      ":047FF000FF270994CA\n"
      ":027FFE00040479\n"
      ":0400000300007E007B\n"
      ":00000001FF\n"
  }
};

That line near the end that starts with ":02" is the version number. It breaks down to:

  len  addr type minVer majVer cksum
  :02  7FFE  00    04     04    79

It makes perfect sense, thanks for the explanation. I'll try this at my next opportunity!

Interesting... tried to compile optiLoader with both Arduino v0022 and Arduino 1.0, but get the following compilation error:

In file included from optiLoader.cpp:85:0:
optiLoader.h:25:24: error: variable 'image_328' must be const in order to be put into read-only section by means of 'attribute((progmem))'
optiLoader.h:25:35: error: variable 'image_328p' must be const in order to be put into read-only section by means of 'attribute((progmem))'
optiLoader.h:25:47: error: variable 'image_168' must be const in order to be put into read-only section by means of 'attribute((progmem))'
optiLoader.h:25:58: error: variable 'image_8' must be const in order to be put into read-only section by means of 'attribute((progmem))'
optiLoader.cpp:688:17: error: variable 'image_328' must be const in order to be put into read-only section by means of 'attribute((progmem))'
optiLoader.cpp:742:17: error: variable 'image_328p' must be const in order to be put into read-only section by means of 'attribute((progmem))'
optiLoader.cpp:796:17: error: variable 'image_168' must be const in order to be put into read-only section by means of 'attribute((progmem))'
optiLoader.cpp:850:17: error: variable 'image_8' must be const in order to be put into read-only section by means of 'attribute((progmem))'

Could this be a compiler issue? I'm running Fedora 16...

[daly@R0b0ty ~]$ avr-g++ --version
avr-g++ (Fedora 4.6.2-1.fc16) 4.6.2

[daly@R0b0ty ~]$ gcc --version
gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)

How would I get around this?

Yes. In newer compilers, PROGMEM handling is changed significantly. And linux installs the compiler separately from the Arduino IDE, so which version you have is pretty random.

I'll take a look and see if I can come up with changes that work for multiple compiler versions...

Well I had been having problems with this but decided to build a new board with RTC too. Anyway the new board works perfectly first time

Using maniac bugs folder it uploads the boot loader from the Arduino IDE which was a surprise. Anyway thumbs up all round. It's now working perfectly

westfw:
Yes. In newer compilers, PROGMEM handling is changed significantly. And linux installs the compiler separately from the Arduino IDE, so which version you have is pretty random.

I'll take a look and see if I can come up with changes that work for multiple compiler versions...

Yup, 4.6 changed the handling of progmem significantly, and all for the better. It's easy to make the changes, and they still work with older toolset versions. Basically, we have to stop using prog_types and make all progmem variables const (which they should have been already).

And 4.7 is adding compiler-level support for progmem regions, I think?
(but going between 4.3 and 4.6, we probably only have to add the "const" in appropriate places.)

westfw:
And 4.7 is adding compiler-level support for progmem regions, I think?

Yup. They're awesome. But I'd argue they're irrelevant for Optiboot, until Arduino upgrades to 4.7. Because the new named regions aren't backward compatible, so code that uses them REQUIRES >=4.7.0.

westfw:
(but going between 4.3 and 4.6, we probably only have to add the "const" in appropriate places.)

Also have to remove the now-deprecated prog_char type and other prog_ types.

I still even have trouble for my IDE (both 22 and 1.0) to recognize the optiboot board. According to the instructions i do this:
To install into the Arduino software
1.Download the latest Optiboot zip file and extract it.
2.You will need to be using a recent version of the Arduino environment, version 18 or later.
3.Create a 'hardware' directory inside your sketches folder.
4.Copy the optiboot directory into the hardware directory.
5.Restart the Arduino software. New boards will appear in the Tools > Board menu.

But there are no new boards in the Tools > Board menu
Now I have done this for other boards and it always worked. If I look at the 'Optiboot' folder in my hardware folder, its structure is completely different from the ones that do work. Other folder (e.g. Attiny85) have a 'boards.txt' file in their folder and a folder called 'cores'. That folder then has a subfolder called Attiny85 again and only that folder then has all sorts of 'h', 'c' etc files in it. So not the optiboot folder: no 'boards.txt' no cores folder, it just has all of its files (boot.h, makeall, makebat, pin_def etc directly in that one folder.

So, Am I forgetting something? Is there anything in the 5 line instructions that was too difficult for me to understand?

Yes, I did close and restart the IDE.
Anybody a solution as it seems to work for all you guys and calls.
Tnx

Dear Pro's,

to get rid of all that external issues with getting the basement work....IDE a.s.o.

would you please add an AVR Studio .elf Production Bundle... for testing also please.
(very easy for somebody who knows the settings)

So, the Betatesting of the Optiboot would be more comfortable... because we have to test the bootloader, not the ide config :slight_smile:

Maybe, a Noob Dif .zip ala "extract this to the Arduino Rootfolder " would be helpfull as already mentioned...

Please add an verified .elf ...

Thank you very much!!!

ChrisS

(Would be great, in my case got an HV Programmer here, which i can't get work with Arduino Bootloader burning via IDE.
No Info on some Parameters like BOOTSZ, ... can't find LD_Section... )

I was aiming at setting up a parallel port to program a atmega8535 using avrdude.

Could that be integrated in this setup?

Has optiboot been tested on that chip?

thx.