Hello all,
I'm implementing a Bootloader and an Application for the TMS570LC43x. In the application I want to use the SafeTI Library. According to the provided example, I'm calling the SL_Init_R5Registers() and SL_Init_StackPointers() routines from sl_asm_api.asm at the beginning of the Application. Whereas in the Bootloader, I'm calling _coreInitRegisters_() and _coreInitStackPointer_() from HL_sys_core.asm.
What I noticed is that the link register (LR) holds the wrong value for the return address when leaving SL_Init_R5Registers() in the Application. As a result, execution doesn't continue after the call of SL_Init_R5Registers(), which is wrong. As far as I understand, this happens because SL_Init_R5Registers() assumes that the controller is in supervisor mode although it is not because we have already switched to system mode in the Bootloader (in _coreInitRegisters_()).
- How should I deal with that issue? Should these routines only be called after reset, so only in the Bootloader?
- After reading the code of these routines, it's not clear to me what is the difference of the routines _coreInitRegisters_() and _coreInitStackPointer_() from HL_sys_core.asm and the routines SL_Init_R5Registers() and SL_Init_StackPointers() from sl_asm_api.asm?
Thank you for your help,
Simon