I’ve spent some time with the FreeRTOS M4F Port, trying to get it operational on the TI CC1352R1 device.
I’m stuck at a point in the vPortSVCHandler:
bx r14
After the above branch call the M4F vectors immediatly to a BusFault_ISR condition, with the STKERR (During Exception Stacking Error) bit set in the status registers.
I have followed the general guidance and made sure the interrupt priorities are correct. I don’t have stack or heap problems, and the task blocks residing in RAM look good. I’ve compared this also to a TI CC3220 device, and apart from the differences in addresses, there is nothign that stands out.
So I’m wondering where to from here? Does anyone have any experience with these devices, or is there any other information I can provide to help narrow down the issues?
Would you please provide the register values (including MSP and PSP) before executing bx r14? Also, read 8 bytes from the memory address contained in PSP. Those bytes (in order) are:
R0, R1, R2, R3, R12, LR, PC, XPSR
The above PC value is the location the code is trying to jump. Use the disassembly window (View --> Disassembly in Code Composer Studio) to locate the source code at this location (it should be one of the FreeRTOS tasks).
Assuming that you are using Code Composer Studio, you can use View --> Registers and View --> Memory Browser to examine register and memory values respectively.
PSP and DSP are the stack pointers for the different modes of the processor. LR = 0xFFFFFFFD means that the return will pop the saved registers (including save PC) from the PSP stack instead of the DSP stack. In that stack frame will be the address to return to.
Your PSP is correct and points to the location in RAM from where saved registers will be popped upon returning from exception. Looking at the content of memory you shared, the address it should return to is 0x00006506 (which as you mentioned is Timer task). FPU should not be a problem as M4F handles saving and restoring FPU registers. You mentioned that it crashes when you step over the assembly instruction bx r14, right?
At this point, everything seems okay to me. Would you be able to share your project so that I can take a closer look? Are you using a custom hardware or is it a development board?