Hi,
I am getting less and less hair... I try to debug C++ whit Eclipse, OpenOCD (0.3.1),
zylincdt (4.10.1) and a OLIMEX ARM USB jtag.
with c files everythin is working fine, and I can do start/stop step by step and
everything in the source code.
But with a cpp source it complains that the source fine is not available. (debugging at
assembly level is working)
Error message No source available for "main() "
some GDB info show that it sees the startup.s (although I cannot debug in either) but not
any other file despite all directories are known. (main.cpp at root or /src doesn't change
anything)
Any Ideas?
Thanks
Marcel
show dir
Source directories searched:
D:/Projets/myproject;D:/Projets/myproject/.dep;D:/Projets/helisaver/inc;D:/Projets/myproject/inc/lpcinc;D:/Projets/myproject/out;D:/Projets/myproject/prj;D:/Projets/myproject/src;$cdir;$cwd
info files
Symbols from "D:\Projets\myproject\myproject_ROM.elf".
Local exec file:
`D:\Projets\myproject\myproject_ROM.elf', file type elf32-littlearm.
Entry point: 0x0 0x00000000 - 0x000048dc is .text
0x40000000 - 0x40000014 is .data
0x40000014 - 0x400010a0 is .bss
info sources
Source files for which symbols have been read in:
D:/Projets/myproject/Startup.s
Source files for which symbols will be read in on demand:
../../../gcc-4.0.2/gcc/config/arm/lib1funcs.asm, D:/Projets/myproject/swi_handler.s
------------------------------------
______________________________
controlSUITE software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )
Hi Pete
Thanks, compiling and linking is not a problem as my program is perfectly running, I just
cannot do source code level debugging because the debugger doesn't find the source
code.
>What compiler/linker settings did you use?
see makefile below, may be there is something missing to tell GDB where is the source code
(I modified the makefile to have the source at project root without more success)
>Does a simple C++ app (blinking LED, RS232, etc) work when programmed?
my programm is working but not debbuging, a simple C app is debugging fine
>What GCC and GDB versions are you using?
Yagarto:
binutils: 2.18
gcc: 4.2.2
newlib: 1.16.0
gdb: 6.8.50-20080308-cvs
>Have you changed your startup and linker scripts to support C++?
link is working, but there may be an option to transmit source file to GDB?
>Are you sure that you're linking with the 'g++' tool and *not* 'gcc' or
>'ld' (because C++ has special linker requirements)?
yes.
>Lots of unanswered questions.
>
>I'm sure I have had C++ working before, but we don't use it much here so
>it's been a while.
you think I should switch to C ?
Thanks
Marcel
##############################################################################################
# Start of default section
#
TRGT = arm-elf-
CC = $(TRGT)gcc
CPP = $(TRGT)g++
CP = $(TRGT)objcopy
OD = $(TRGT)objdump
AS = $(TRGT)gcc -x assembler-with-cpp
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
MCU = arm7tdmi
# List all default C defines here, like -D_DEBUG=1
DDEFS =
# List all default ASM defines here, like -D_DEBUG=1
DADEFS =
# List all default directories to look for include files here
DINCDIR =
# List the default directory to look for the libraries here
DLIBDIR =
# List all default libraries here
DLIBS =
#
# End of default section
##############################################################################################
##############################################################################################
# Start of user section
#
# Define project name here
PROJECT = myproject
# Define linker script file here
LDSCRIPT_RAM = .\prj\lpc2138-ram.ld
LDSCRIPT_ROM = .\prj\lpc2138-rom.ld
# List all user C define here, like -D_DEBUG=1
UDEFS = \
-DDEBUG=0 \
-DOS_LIBMODE_DP
# Define ASM defines here
UADEFS =
# List C source files here
CPPSRC = main.cpp
CPPSRC += rprintf.cpp
CPPSRC += sd_raw.cpp
CPPSRC += syscalls.cpp
CPPSRC += interrupt_utils.cpp
# List ASM source files here
ASRC = Startup.s
ASRC += swi_handler.s
# List all user directories here
UINCDIR = .\inc
UINCDIR += .\inc\lpcinc
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS =
# Define optimisation level here
OPT = -O0
#
# End of user defines
##############################################################################################
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS)
OBJS = $(CPPSRC:.cpp=.o) $(ASRC:.s=.o) $(CSRC:.c=.o)
CPPOBJ = $(CPPSRC:.cpp=.o)
LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU)
ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -fomit-frame-pointer -Wall -Wstrict-prototypes
-fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(WARN) -Wa,-alms=$(<:.cpp=.lst) $(DEFS)
LDFLAGS_ROM = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT_ROM)
-Wl,-Map=$(PROJECT)_ROM.map,--cref,--no-warn-mismatch $(LIBDIR)
ODFLAGS = -x --syms
# Generate dependency information
CPFLAGS += -MD -MP -MF .dep\$(@F).d
CPPFLAGS += -MD -MP -MF .dep\$(@F).d
#
# makefile rules
#
all: ROM
ROM: $(OBJS) $(PROJECT)_ROM.elf $(PROJECT)_ROM.bin $(PROJECT)_ROM.hex
$(PROJECT)_ROM.dmp
%o : %cpp
@echo "Compiling C++ $<"
@$(CPP) -c $(CPPFLAGS) -I . $(INCDIR) $< -o $@
%o : %c
@echo "Compiling $<"
@$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
%o : %s
@echo "Assembling $<"
@$(AS) -c $(ASFLAGS) $< -o $@
%ROM.elf: $(OBJS)
@echo "Linking $@"
@$(CC) $(OBJS) $(LDFLAGS_ROM) $(LIBS) -o $@
%hex : %elf
@echo "Create $@ from $<"
@$(HEX) $< $@
%bin : %elf
@echo "Create $@ from $<"
@$(BIN) $< $@
%dmp : %elf
@echo "Create $@ from $<"
@$(OD) $(ODFLAGS) $< > $@
clean:
-rm -f $(OBJS)
-rm -f $(PROJECT)_ROM.elf
-rm -f $(PROJECT)_ROM.map
-rm -f $(PROJECT)_ROM.hex
-rm -f $(PROJECT)_ROM.bin
-rm -f $(PROJECT)_ROM.dmp
-rm -f $(CSRC:.c=.c.bak)
-rm -f $(CSRC:.c=.lst)
-rm -f $(CSRC:.c=.o)
-rm -f $(CPPSRC:.cpp=.cpp.bak)
-rm -f $(CPPSRC:.cpp=.lst)
-rm -f $(CPPSRC:.cpp=.o)
-rm -f $(ASRC:.s=.lst)
-rm -f $(ASRC:.s=.o)
-rm -fR .dep
#
# Include the dependency files, should be the last of the makefile
#
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# *** EOF ***
------------------------------------
______________________________
controlSUITE software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )