lpcware

Handle Software Breakpoints

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by sarafidis on Tue Sep 01 04:35:23 MST 2015
Hi there,

I am using LPC11U35 with Keil uvision. I need to handle software breakpoint as mentioned at
https://www.lpcware.com/content/forum/how-to-detect-if-lpclink-is-attached-

The assembly given is not applicable at uvision. I have made some changes but I still have problems. Below is my changed code:


MOV   R0, #4
MOV    R1, __return_address()
TST    R0, R1
BEQ    _MSP
MRS    R0, PSP
B      _checkFaultInstruction
_MSP:
MRS    R0, MSP
_checkFaultInstruction:
LDR    R1, [R0,#24]
LDRH      R2, [R1]
MOV    R3, 0xBEAB
CMP        R2, R3
BNE    HardFault_HandlerC 
ADDS      R1, #2
STR    R1, [R0,#24]
BX        __return_address()


I have replaced LR with __return_address() and "LDR    R3,=0xBEAB" with "MOV  R3, 0xBEAB" as mentioned at
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0205f/Chdgddcj.html

I am getting the following errors:

1) "BX __return_address()" -> error #1084: This instruction not permitted in inline assembler.
2) "BNE HardFault_HandlerC " -> error #114:label "HardFault_HandlerC" was reference but not defined
   HardFault_HandlerC is a function name
3) "BX __return_address()" -> error #114:label "__return_address" was reference but not defined

Any ideas?

Thanks in advance.




Outcomes