jung6717 / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Bootloader Makefile for ATMega8 will not compile-too big now #153

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Run the Makefile in ATMega8
2.
3.

What is the expected output? What do you see instead? Wont fit in available
space

What version of the Arduino software are you using? 0017   On what operating
system? Linux Fedora11  Which Arduino board are you using? ATMega8

Please provide any additional information below.

Original issue reported on code.google.com by leonie.t...@gmail.com on 7 Dec 2009 at 9:44

GoogleCodeExporter commented 9 years ago
Try using avr-gcc 3.3.x.  It should generate smaller code.

Original comment by dmel...@gmail.com on 7 Dec 2009 at 9:49

GoogleCodeExporter commented 9 years ago
This is fixable :-) Seems like the main problem is they (avr-gcc) changed what 
optimizations are done by default. In the Makefile, changing the OPTIMIZE= line 
to:

OPTIMIZE   = -Os -funsigned-char -funsigned-bitfields 
-fno-inline-small-functions

does the trick for me (Arduino bootloader comfortably fits the boot block when 
compiled with avr-gcc 4.3.2). For a bit of extra future-proofing though, you 
can instruct the compiler the bootloader's main() cannot return: change int 
main(void) to

//int main(void)
void main(void) __attribute__ ((noreturn));
void main(void)

will save some stack bytes and the overhead of managing them, in exchange for a 
harmless warning that main() does not return a value. (who would it return one 
to?)

Original comment by drmn...@gmail.com on 10 Aug 2010 at 6:04