Closed gregokent closed 6 years ago
Yes this call is not optimized enough and generate a double bx lr
that is wrong before stack initialization.
Could you try to inline init_stack_pointers()
in this way:
#[naked]
#[inline(always)]
pub unsafe fn init_stack_pointers() {
_cpu_stack()
}
otherwise I can just rename cpu_stack()
or drop init_stack_pointers()
to avoid the inner call.
With the recent change in moving the stack initialization to real asm in a separate file, execution gets stuck as the function calls return up the stack. Disassembly of
tms570::syscore::init_stack_pointers()
:Disassembly of
_cpu_stack
:When
59e8
executes, the value of the LR gets set to59ec
. Whend8a4
executes it branches back to59ec
, which is a branch to link register, which still has the value59ec
, so it branches to59ec
, so on and so forth.I changed
tms570::syscore::init_stack_pointers()
to use the asm again, exactly as it is in cpustack.s with the linker defined addresses and it works just fine.I am using a TMS570LC43xx.