[Icc-avr] Preserved registers?
Peter LaDow
pladow at gmail.com
Wed Apr 4 10:44:32 PDT 2007
I'm running into an issue with preserved registers being overwritten.
For example, I have something like:
extern void (*foo)(void);
void bar(void)
{
int i;
for(i=0; i < 16; i++)
{
foo();
}
}
The problem is that i keeps getting destroyed after a call to foo(). I've
tracked this down and it is because foo() is using the same registers that i
is using. Now foo() is not located in the same executable (i.e. not linked
with bar()), and I think some sort of optimization is being done. Since
bar() is unaware of foo()'s register usage, and foo() is unaware of bar()'s
register usage, they can pick the same registers.
(The application calls functions in the bootloader to program the flash, but
the bootloader and application are compiled separately.)
I do NOT have global optimizations enabled (which I think is -Wf-O8).
I think my only way to handle this is to make sure that all preserved
registers are saved and restored whenever leaving (or entering) code outside
of the current executable. Is this my only solution, or is there an ICC way
to handle this?
Thanks,
Pete
--
"To love for the sake of being loved is human; to love for the sake of
loving is Angelic." -- Alphonse de Lamartine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070404/409a2628/attachment.html
More information about the Icc-avr
mailing list