I'm running into an issue with preserved registers being overwritten.<br><br>For example, I have something like:<br><br>extern void (*foo)(void);<br><br>void bar(void)<br>{<br> int i;<br><br> for(i=0; i < 16; i++)
<br> {<br> foo();<br> }<br>}<br clear="all"><br>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.
<br><br>(The application calls functions in the bootloader to program the flash, but the bootloader and application are compiled separately.)<br><br>I do NOT have global optimizations enabled (which I think is -Wf-O8).<br>
<br>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?
<br><br>Thanks,<br>Pete <br>--<br>"To love for the sake of being loved is human; to love for the sake of loving is Angelic." -- Alphonse de Lamartine