I am trying to call a SVC from user mode with stack PSP . I observe the following error on debugging a code on LPC 1769(cortex m3)------- No source available for "g_pfnVectors() at 0x0" The IDE which I am using is CODE RED LPC Xpresso with LPC 1769 from Embedded Artists.
Here is the assembly code
.syntax unified
.cpu cortex-m3
.thumb
.align 2
.global Start
.thumb
.thumb_func
Start:
// LDR r0,=0xf00d //initial value of r0 which has to be changed in svc handler
PUSH {lr}
MOV r0,#0x2 // set stack to PSP now. Set CONTROL[1]=1
MSR CONTROL,r0
ISB // Instruction memory barrier – ensures that the above is executed
MOV r0,#0x3 //change to user level
MSR CONTROL, r0
ISB
MOV r0,#0x2
MOV r2,#0x2
exp:
MUL r0,r0
SUBS r2,#1
BNE exp
SVC 1 //print in hex
MOV r0,#0x4 //print in decimal
SVC 2
MOV r0,#'A'
SVC 3 //print character
MOV r1,0x0
MSR CONTROL,r1
ISB
POP {lr}
BX lr
inside SVC, I do the stack check and corresponding functions are called for printing on console. here is the SVC code:
__attribute__ ((section(".after_vectors")))
void SVCall_Handler(void)
{
while(1)
{
__asm(
"TST lr, #4 \n"
"ITE eq \n"
"MRSEQ r0, MSP \n"
"MRSNE r0, PSP \n"
"LDR r0,[r0,#0] \n"
"LDR r1, [r0, #24] \n"
"LDRB r1, [r1, #-2] \n"
//immediate data in r1 and input parameter in r0
//"PUSH {LR} \n"
"CBNZ r1,svc_hex \n"
"B svc_end \n"
"svc_hex: \n"
"CMP r1,#1 \n"
"BNE svc_decimal \n"
" BL printhex \n"
"B svc_end \n"
"svc_decimal: \n"
"CMP r1,#2 \n"
"BNE svc_character \n"
"BL printdecimal \n"
"B svc_end \n"
"svc_character: \n"
"CMP r1,#3 \n"
"BL printcharacter \n"
"B svc_end \n"
"svc_end: \n"
"MOV r0,#0x0 \n"
"MSR CONTROL,r0 \n"
"ISB \n"
"BX LR \n"
);
}
}
The printhex/printcaharacter/printdecimal are functions for printing the respective values on the console.
During debug, single step mode, after the SVC instruction, there is the error No source available for "g_pfnVectors() at 0x0" .
The cause and arrival of error is quite unexpected. is there any problem with the gdb debugger or is the way I am interpreting the code wrong?