I am running an evaluation of FreeRTOS to run a custom HW embedding Cortex-M3 core.
As my HW is not available, I used LM3S811_GCC demo as it is close to what I am targeting.
I run the demo inside Eclipse, and qemu-system-arm to avoid buying other HW and was successful in building, linking and starting the demo.
However I am getting wrong behavior when calling prvPortStartFirstTask()
when executing "svc 0" instruction, it is jumping onto vPortSVCHandler as expected.
However, at that point
lr = 0xFFFFFFF9
whereas before that instruction, I had
lr = 0x0000079F
Note that I get LR being at that value upon breakpoint onto vPortSVCHandler, as for some reason the debugger seems to be puzzled by "svc 0" call.
As such, when executing :
"bx lr" in the vPortSVCHandler, I am getting the UsageFault exception
I would like to know if I am doing anything wrong, I did not make any specific changes compared to initial demo.
From ARM instruction set, I don't see why LR is changing.
Although I am out of usual FreeRTOS bounds with my QEMU emulation, I would appreciate any help regarding this issue. Could that come from emulation itself ?
As a general (ish) rule we are extremely shy of attempting to support anything that is running on an emulator. Experience shows that most issues reported are in the emulator, and it proves to be a huge time sink with no benefit.
However, in this case, take a look at the ARMv7M architecture manuals, and you will see that you in fact do expect LR to change when entering an exception. What you are seeing in the EXC_RETURN value, which tells the hardware how to behave when returning from the exception. The real LR value is safely on the stack, ready to be popped off on exception exit.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.