I’m a newbie just getting started with the following toolchain:
Emacs – GDB – OpenOCD – Olimex ARM-USB-TINY JTAG adapter – Olimex LPC2378-STK dev board
I’m working through James Lynch’s tutorial and a basic blinking LED program.
I can set a breakpoint with GDB in the C module main.c where the LED blinking happens, and step through code, etc.
But I can’t set a breakpoint in the Assembly module crt.s
Here’s a snippet from crt.s :
.text
.arm
.global Reset_Handler
.global _startup
.func _startup
_startup:
# Exception Vectors
_vectors: ldr PC, Reset_Addr
ldr PC, Undef_Addr
ldr PC, SWI_Addr
ldr PC, PAbt_Addr
ldr PC, DAbt_Addr
nop
ldr PC, [PC,#-0xFF0]
ldr PC, FIQ_Addr
Reset_Addr: .word Reset_Handler
Undef_Addr: .word UNDEF_Routine
SWI_Addr: .word SWI_Routine
PAbt_Addr: .word UNDEF_Routine
DAbt_Addr: .word UNDEF_Routine
IRQ_Addr: .word IRQ_Routine
FIQ_Addr: .word FIQ_Routine
.word 0
# Reset Handler
Reset_Handler:
.extern TargetResetInit
ldr SP, =_stack_end
When I try to set a breakpoint on that last line (the LDR instruction), gdb says:
(gdb) b crt.s:68
No source file named crt.s.
Make breakpoint pending on future shared library load? (y or [n])
My Makefile executes the following command to assemble crt.s:
arm-elf-as -ahls -mapcs-32 -o crt.o crt.s > crt.lst
The GNU assember manual isn’t crystal clear about this, but the -ahls will “enable listings”; I see no other arguments that would give debug info the same way that “-g” works for the gcc command.
Should I be able to set a breakpoint there?
How should I build the program in order for crt.s source code to be available to gdb?