Not sure whether anyone will be able to help with this. I'm having a really odd situation where FreeRTOS is crashing in vPortSVCHandler when the relocated version of the code has been loaded by a [custom] bootloader. If the version of FreeRTOS code loaded by the bootloader - which is relocated to 0x410000 - is loaded directly by Crossworks, it works correctly.
However, even though the code that is loaded by the bootloader looks identical to that loaded by Crossworks, I'm crashing at the line:
It takes me to a hard fault handler.
The registers look the same in both cases (I can run the bootloader in the debugger and then let it take me through to the code loaded by the bootloader and see the source code by loading an additional elf file of the relocated file). In other works, what's in r14, r0 etc look the same whether the code that's running is what's been loaded by the bootloader or whether I directly run the relocated code the bootloader loads. (I hope this makes sense.)
So, does anyone have any pointers or suggestions as to why it should crash in the last line of vPortSVCHandler in the version loaded by the bootloader?
I'm not sure what other details to give.
The code works fine in a SAM4S (albeit slightly modified for that architecture).
Would be most grateful for any suggestions/pointers.
Normally when there are problems with bootloaders it is because the vector base address register has not been set correctly, but I don't think that applies in this case as you have entered the SVC handler correctly.
What is in the r14 register? Does it match the expected address of the function you want to jump to (the first task presumably) or does it contain an exec return value.