Hi,
The attached patch solves an issue that I bumped into with the SYS/BIOS ISR handling code.
My environment & target: GCC 4.8.1 compiler, AM3359 chip (Cortex-A8).
Problem description: When the SYS/BIOS code is compiled with no optimizations, GCC restores stack-pointer from frame-pointer in function epilogue. Thus, ti_sysbios_family_xxx_Hwi_switchToIsrStack() and ti_sysbios_family_xxx_Hwi_switchToTaskStack() functions (implemented in C) effectively fail to switch the stack.
Solution: I doubt that C language standard allows us to write C code that would correctly switch the stack and would not lead to unpredictable results depending on compiler and its optimizations. Thus, to be on the safe side and prevent potential breakages with future compiler versions, I propose to implement the stack switching functions in assembly.
Patch: 8787.0003 - Hwi ISR stack switch bug fix.txt
(Change the extension to "patch", for some reason the forum forbids files with this extension...)
P.S. Moreover, I see that these functions already implemented in assembly for TI compiler, I wonder why this wasn't already done for GCC build too...
P.P.S. I'm intentionally using MOVW/MOVT instead of LDR in my code. This is more performance efficient (http://blogs.arm.com/software-enablement/251-how-to-load-constants-in-assembly-for-arm-architecture/)
Best regards,
Vasili