Arduino Forum

Development => Other Software Development => Topic started by: leo72 on Sep 18, 2011, 11:05 am

Title: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: leo72 on Sep 18, 2011, 11:05 am
It seems to me that the Optiboot of the latest IDE 1.0RC1 is still the "old" one, with its bugs and its issues...doens't it?
I.E., it's not compatible with ArduinoISP or it doesn't correctly upload sketches greater than 30 kB.

Why developers did not integrate fixes introduces with Optifix (http://arduino.cc/forum/index.php/topic,64105.0.html) by westfw?
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: testato on Sep 18, 2011, 11:55 am
+1

i make a test with fuebytes:
Code: [Select]
Bootloader at 0x7E00 is not readable

So this is the old bootloader.

Do you think to upgrade to Optifix after the RC1 ?


PLUS:
The Optiloader do not work on new ide:
Code: [Select]
In file included from optiLoader.cpp:73:
/optiLoader.h:1:22: error: WProgram.h: No such file or directory
In file included from optiLoader.cpp:73:
optiLoader.h:6: error: 'byte' does not name a type
optiLoader.h:7: error: 'byte' does not name a type
optiLoader.h:8: error: 'byte' does not name a type
In file included from D:\Backup\Elettronica\Arduino\arduino-1.0-rc1\hardware\arduino\cores\arduino/Arduino.h:204,
                from optiLoader.cpp:95:
D:\Backup\Elettronica\Arduino\arduino-1.0-rc1\hardware\arduino\variants\standard/pins_arduino.h:41: error: expected unqualified-id before numeric constant
D:\Backup\Elettronica\Arduino\arduino-1.0-rc1\hardware\arduino\variants\standard/pins_arduino.h:42: error: expected unqualified-id before numeric constant
D:\Backup\Elettronica\Arduino\arduino-1.0-rc1\hardware\arduino\variants\standard/pins_arduino.h:43: error: expected unqualified-id before numeric constant
optiLoader.cpp: In function 'void read_image(image_t*)':
optiLoader.pde:-1: error: 'struct image' has no member named 'image_pagesize'
optiLoader.cpp: In function 'boolean target_progfuses()':
optiLoader.pde:-1: error: 'struct image' has no member named 'image_progfuses'
optiLoader.pde:-1: error: 'struct image' has no member named 'image_progfuses'
optiLoader.pde:-1: error: 'struct image' has no member named 'image_progfuses'
optiLoader.pde:-1: error: 'struct image' has no member named 'image_progfuses'
optiLoader.cpp: In function 'boolean target_normfuses()':
optiLoader.pde:-1: error: 'struct image' has no member named 'image_normfuses'
optiLoader.pde:-1: error: 'struct image' has no member named 'image_normfuses'
optiLoader.pde:-1: error: 'struct image' has no member named 'image_normfuses'
optiLoader.pde:-1: error: 'struct image' has no member named 'image_normfuses'
optiLoader.cpp: At global scope:
optiLoader.pde:-1: error: too many initializers for 'image_t'
optiLoader.pde:-1: error: too many initializers for 'image_t'
optiLoader.pde:-1: error: too many initializers for 'image_t'
optiLoader.pde:-1: error: too many initializers for 'image_t'


AND
Fusebytes do not work on new Ide:
Code: [Select]
fusebytes.pde:-1: error: 'Serial' was not declared in this scope
fusebytes.pde:-1: error: 'HEX' was not declared in this scope
fusebytes.pde:-1: error: 'Serial' was not declared in this scope
fusebytes.pde:-1: error: 'Serial' was not declared in this scope
fusebytes.cpp: At global scope:
fusebytes.pde:-1: error: variable or field 'print_binary' declared void
fusebytes.pde:-1: error: 'byte' was not declared in this scope
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: westfw on Sep 18, 2011, 12:01 pm
The bootloader you actually have on your board will have shipped with the board, NOT with the software distribution, unless you have specifically burnt a new bootloader.

Since it ships with hardware, and is difficult for a normal user to change, bootloader version changes are done more carefully than IDE changes.

(Still, I'd prefer to be getting either bug reports or "looking good" reports from the Arduino team...)
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: leo72 on Sep 18, 2011, 03:13 pm

The bootloader you actually have on your board will have shipped with the board, NOT with the software distribution, unless you have specifically burnt a new bootloader.

I agre.... but the actual IDE contains the Optiboot...

Quote

Since it ships with hardware, and is difficult for a normal user to change, bootloader version changes are done more carefully than IDE changes.

...so I wished I would find a new Optiboot with a new IDE. Just to test. This let me think that the next boards will be shipped with the actual bootloader, if there's no new bootloader to test... :smiley-sweat:

Quote

(Still, I'd prefer to be getting either bug reports or "looking good" reports from the Arduino team...)

+1
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: Razorblade on Sep 18, 2011, 03:43 pm
But when did westfw's optiboot improve became 'Arduino official'?
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: leo72 on Sep 18, 2011, 03:50 pm
I never said this  ;)

I only asked why Arduino developers didn't integrate the fixes introduced by westfw in his Optifix, because Optiboot issues are best known  :smiley-sweat:
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: testato on Sep 18, 2011, 04:45 pm
westfw, do you have in planning update Optiloader and Fysebites for new Arduino IDE ?
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: westfw on Sep 18, 2011, 08:53 pm
Quote
But when did westfw's optiboot improve became 'Arduino official'?

The improvements are supposed to become official; I say they don't ACTUALLY become official till they ship.

Quote
do you have in planning update Optiloader and Fysebites for new Arduino IDE ?

Yes.  Sigh.
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: westfw on Sep 19, 2011, 06:08 am
I've update both optiLoader and fusebytes so that they compile under both 0022 and version 1.0 of the Arduino IDE.
They're now stored in github at http://github.com/WestfW/

(the main changes:  eliminate the use of "byte" as a data type (becomes uint8_t, which is standard but not nearly so beginner-friendly.)  Eliminate includes of "WProgram.h" in favor of "hints" that cause the IDE to include either that or "Arduino.h" at an appropriate place in the sketch.)

They've each been tested "slightly."
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: brainbooster on Sep 19, 2011, 07:40 am
westfw, tell me more about the "hints" mod, how does it work? is it a kind of wrapper?
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: westfw on Sep 19, 2011, 08:07 am
Quote
the "hints" mod

The preprocessor adds the "#include <Arduino.h>" (or WProgram.h on older versions of the IDE) just before the first line it recognize as part of your C program.  But it's not great about parsing things like conditional compilation (which fusebytes is full of), and it doesn't always put the #include in the appropriate place compared to your personal #include files that may want to use the definitions that are there (you used to be able to add "#include <WProgram.h>", but that's no longer version independent.)

You can give the IDE a "hint" by putting a line that it is guaranteed to recognize as a line of C code at a point before it otherwise would have added the #include.  For example, fusebytes.cpp now has:
Code: [Select]
char Arduino_preprocess_edge;  // hint to Arduino pre-processor

#include <avr/boot.h>
#include <EEPROM.h>
#include "cpuname.h"
at the very beginning of the sketch because otherwise it decides to put the #include inside the first "#if 0" code, where it doesn't do any good.
The extra variable may or may not get optimized out in the binary; in most cases it won't matter.


Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: testato on Sep 19, 2011, 08:42 am
thanks, i will test it today.

other question, your Arduino ide https://github.com/WestfW/Arduino is it an updated version ? is there the windows version also ?
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: westfw on Sep 19, 2011, 09:33 am
https://github.com/WestfW/Arduino is a fork from the Arduino branch that contains ONLY the optiboot bootloader fixes.
It's sitting on the "pull queue": https://github.com/arduino/Arduino/pull/30
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: mellis on Sep 20, 2011, 05:41 pm
WestFW's work on the bootloader seems good and stable.  So far, though, I've been including in the Arduino software distribution only those versions of the bootloader that we're actually shipping on production hardware.  Gianluca has been understandably reluctant to update the production bootloader, because we don't want to run into some intermittent problem that would force us to replace a bunch of boards.  I'm hoping we can do more testing, ensure that the new optiboot is totally stable and reliable, and then update to it soon.  At that point, I'll include the changes in the Arduino repository and distribution.

On the other hand, we could instead include a "stable" bootloader in the distribution even if it's not yet the version that comes on production boards.  That would get changes out to the community earlier (allowing more people to test them) but would mean that your board would behave slightly differently if you ref lashed the bootloader from the IDE.  Any thoughts?
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: fat16lib on Sep 20, 2011, 06:17 pm
Put the stable version in the distribution.  The only time I replace the boot loader is when there is a problem.

I bought a number of Uno boards with the problem and it would have been nice to fix them with the IDE.  These boards were a huge pain since I booted them a lot using them mostly for software development.

I was thankful for westfw's fixes.  It would be nice if the Arduino team had something like a "hot fix" area for bugs like this.
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: leo72 on Sep 20, 2011, 10:25 pm

Put the stable version in the distribution.  The only time I replace the boot loader is when there is a problem.

I bought a number of Uno boards with the problem and it would have been nice to fix them with the IDE.  These boards were a huge pain since I booted them a lot using them mostly for software development.

I was thankful for westfw's fixes.  It would be nice if the Arduino team had something like a "hot fix" area for bugs like this.

+1
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: bill2009 on Oct 16, 2011, 01:03 am
what is the latest version of optiboot and where can I find it?

I found this http://code.google.com/p/optiboot/downloads/detail?name=Optiboot_v3.zip&can=2&q= (http://code.google.com/p/optiboot/downloads/detail?name=Optiboot_v3.zip&can=2&q=)
but I'm dubious because the dates are from early 2010.

update:I'm using the one from the beta thread and it seems fine. I'm really grateful for the work because I needed the flash space but the question remains: how do you find the latest optiboot (and know it's the latest)?
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: westfw on Oct 16, 2011, 03:03 am
Quote
how do you find the latest optiboot (and know it's the latest)?

The model being followed is that I modify optiboot in a branch "cloned" from the Arduino source branch.  It is my intent that every change made should have a matching "Issue" at http://code.google.com/p/arduino/issues/list
When I'm happy with it, I submit the changes to that branch ( https://github.com/WestfW/Arduino ), and they theoretically become available for anyone to get a copy.  Alas, this is currently a branch based on the non 1.0 Arduino branch.

After some time, when the collection of changes gets "large and interesting", or when some new major release is coming up, I send a message and/or "pull request" to the Arduino team saying "you should take the changes I've made back into the official release."

Then the Arduino team looks at my code and does more extensive testing than I'm able to do, and decides (hopefully) "yes, this is good and it should go into the official distribution."  Then it shows up in the official arduino source base as well.  (I believe that this has JUST happened for optiboot 4.4 and the 1.0 source base.)

As a separate issue, at some point the Arduino team has to produce binaries of the bootloader and tell their manufacturer "start putting this on the m328 chips that go on Arduinos."  This is a relatively Big Deal, since if there's a mistake that isn't noticed till after that, you're now talking about a large base of potentially affected customers who aren't equipped to fix it themselves, and will start returning their Arduinos (very expensive) and complaining all over the internet (ditto.)

This is subject to change (for example, the stk500v2 bootloader used on the Mega has a separate GitHub project), and should be less of an issue going forward, since the changes should be smaller and more easily managed.

So: the latest official version is whatever appears in the latest official release.
  The latest "beta" version is whatever appears on the Arduino github repositories.
  For later than that, you have to watch the forums and/or the google code issue list, and/or ask.
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: bill2009 on Oct 17, 2011, 01:23 am
Quote

So: the latest official version is whatever appears in the latest official release.
  The latest "beta" version is whatever appears on the Arduino github repositories.
  For later than that, you have to watch the forums and/or the google code issue list, and/or ask.


Thanks.  is one of those the v3 on google code? http://code.google.com/p/optiboot/downloads/detail?name=Optiboot_v3.zip&can=2&q=
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: westfw on Oct 17, 2011, 03:21 am
Quote
is one of those the v3 on google code? http://code.google.com/p/optiboot/

No, that's pretty much the "old" optiboot that shipped with original Unos and 0022.
It seems to have been abandoned; I don't think anyone has heard from Peter Knight (the original author) in quite a while :-(

Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: tim7 on Oct 17, 2011, 12:14 pm

Then the Arduino team looks at my code and does more extensive testing than I'm able to do, and decides (hopefully) "yes, this is good and it should go into the official distribution."  Then it shows up in the official arduino source base as well.  (I believe that this has JUST happened for optiboot 4.4 and the 1.0 source base.)


Out of pure curiosity, do you know why the lock-bits in the official distribution are different?  Is it just to minimise the user-visible differences between older and newer Unos?  I suppose it's possible a program might try to read from the bootloader flash section, and throw a wobbly if it actually succeeds...
Title: Re: IDE 1.0RC1: is its Optiboot the "old" one?
Post by: westfw on Oct 17, 2011, 05:58 pm
Quote
do you know why the lock-bits in the official distribution are different?

Yes.  This is http://code.google.com/p/arduino/issues/detail?id=554&q=optiboot
One of the sketches I wrote before working on optiboot (fusebytes.pde: https://github.com/WestfW/fusebytes ) was designed to answer the FAQ "what kind of Arduino do you have and which versions of "stuff" does it have."  At about the same time, there were a series of bootloader bugs discovered (30k limitation, uno SMD problems, etc), and it was pretty difficult to find out "which version of the bootloader is in your chip."  So I thought it would be a good idea if optiboot included a version number, and if that were readable by sketches.  (It's that last part that required changing the fuses.)   (I couldn't think of any downside to having the bootloader section readable by sketches; it's not like it contains proprietary algorithms that decrypt uploads...)
(It was AFTER this was done that it was pointed out that the STK500 protocol also includes a command for reporting the firmware version of the bootload, and now optiboot supports that as well.  Sort of.)