The ATmegaBOOT_168.c module does not compile with an avr toolset that uses a av libC more recent than
July 5, 2009
(It can't currently be built on linux)
This relates to the use of the EEWE define which is no longer defined in eeprom.h
There is a discussion of this over in this thread:
There are a number ways to "fix" this but my recommendation would be:
(read additional details in the above thread)
remove the ifdefs around the include for <avr/eeprom.h> (around line 79) since it is a NOP
and eeprom is always being included and eeprom.h is needed.
Remove the ifdefs around the eeprom busy test while loops (around line 584)
and replace it with a single line of either:
eeprom_busy_wait();
or for compatibility with avr tools prior to Feb 26, 2004
while(!eeprom_is_ready());
This is not altering any code but merely using macros available in eeprom.h to test the EEPROM busy
status that have been available for many years.
These eeprom.h macros will automatically use the proper EECR bit names.
can you apply the suggested diffs, confirm that the produced binaries (hex files) are identical when running the same compiler, and provide a "patch" file in an issue submitted via Google Code Archive - Long-term storage for Google Code Project Hosting. ? Ready-to-apply patches with easy proofs of correctness get into the code much faster than mere ideas that "should work." (You seem up to the programming, and just need a bit of pushing in the direction of learning the "production" toolset...)
pito,
I'm curious as to why this didn't work for you.
I have tried this on both the Windows version of 0022 and on linux with 0022 and it compiles
for all the originally defined targets in the Makefile.
And for westfw, yes the generated code (.hex file) is identical with the .c file changed for this bug-fix
when using the same toolset.
However, one very interesting thing worth noting is that the .hex file recreated for the m238p
from the "as is" bootloader files and toolset from the 0022 windows release and 0022 supplied
avr tools does not match the pre-compiled .hex file that comes with the windows 0022 release.
I haven't tried the other targets but this does seem concerning.
Like perhaps the distribution scripts/makefiles are not using the same windows compiler
that is shipped with the windows version of 0022 or maybe windows is not used
to create the windows releases.
My test enviroments:
Windows is using the 4.3.2 avr-gcc tools that come with arduino 0022
(there is no other arduino or avr toolset on the test machine).
Linux (Ubuntu 10.10) is using 4.3.3 avr-gcc from Bingos debian binary install package.
I've attached the Makefile and .c bootloader file I was using.
I did modify the Makefile so that the "all" target builds all the targets rather than do nothing.
--- bill
Bill, thanks for providing your ATmegaBOOT_168.c - I've found the issue with mine:
...........
/* some includes */ #include <inttypes.h> #include <avr/io.h> #include <avr/pgmspace.h> #include <avr/interrupt.h> #include <avr/wdt.h> #include <util/delay.h>
#include <avr/eeprom.h> <<<<<<<< this was missing in my source.
Great.
Please report back if the bootloader works for you. (It should)
So this will be more ammunition to throw at getting the code fixed.
When I post the bug to the issues list along with the patches to fix it,
I'll post a link to this thread as well.
Bill, the above works. I've made a 7.3728Mhz, 3V3, atmega328p "Uno" compilation and after burning (icsp) the bootloader into a fresh chip I am running the stuff as usual (now the serial comm works nice at 230400baud).
Maybe you have to summarise the fix in a detail "step by step way", as I obviously missed the "#include.." stuff. P.
Hi pito,
How do you make hex file?I want to make a 3.6864MHz version.I seach a lot but I can not find a good guide until I find your post.
My newbie question is how do you make .hex file from .c file.
I press SHIFT + Right click and select "open command window here" in : "C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\atmega" , then I enter make but it shows:
'make' is not recognized as an internal or external command,
operable program or batch file.
Please Help me.