[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Missing "call main()" in startup code
From: |
Dave Harper |
Subject: |
[avr-gcc-list] Missing "call main()" in startup code |
Date: |
Mon, 14 Nov 2011 15:10:05 -0600 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
Target MCU: XMega32A4
WinAVR: WinAVR-20100110
Studio: v4.18 Build 716
I recently completed initial debug of a bootloader for the above target
device. The bootloader is fairly large and, to keep from overflowing
the 4K bootloader flash area, I used the "-nostartfiles" linker flag to
eliminate the vector table since interrupts are not being used. While
debugging using the Studio debugger, I compiled using the -O0 option to
remove optimizations. The compiler produced normal startup code which,
at the end, "fell" into main(). Once debugging was complete, I
recompiled with -Os. Not surprisingly, the order of the code was
restructured with the main() entry point appearing further down in the
code, preceeded by several functions. What was missing was a call to
the main() entry point at the end of the startup code. When I removed
the -nostartfiles linker option (still using -Os optimization) I found
that the call to main() was included. Unfortunately, inclusion of the
vector table - which uses 376 bytes, just about offsets any savings
gained from the -Os optimization. This puts me very close to the 4K
limit again. I'd really like to have this extra space as the next step
(interaction between the application and bootloader) will use a debug
mechanism which uses values written to an I/O port that are monitored by
a logic analyzer to trace the path of execution, as well as variable
values. While these individual debug statements don't take much room
individually, I will be limited in the number I can put in the code at
any given time.
Also, as a check, I downloaded the latest Studio 5.0 and recompiled
using it (GCC v4.5.1). Same thing.
Anyone have any ideas on a workaround that might get me past this problem?
Thanks,
Dave
- [avr-gcc-list] Missing "call main()" in startup code,
Dave Harper <=