This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Assembly Code in SDK 7.2 DFU

Hi, in the example bootloader in sdk 7.2, there is an assembly code block in SVC_Handler, in dfu_ble_svc.c.

I found that the offset in line:

LDR R0, [R1, #24]

always sets the register R0 to 0x00000000, which when two is subtracted in the following line, causes the register to overrun to 0xFFFFFFFE which causes a fault.

I also found that instead of using EXC_RETURN_CMD_PSP to determine if the MSP or PSP is active, you can use the special register SP right away since only one can be active - infocenter.arm.com/.../index.jsp. The offset just needs to be adjusted:

LDR R0, [SP, #12]

Any insight as to why the original load into R0 doesn't work would be appreciated, as well as confirmation that SP can be used as the correct location of the current active stack pointer.

Thanks, Ethan

Related