I am using Eclipse CDT IDE for debugging Spark Core firmware, when i executed the deugger, The build & download processes are successful witout error, After that, it will always throw out me a error :
No source available for "0x800010e"
can you all give me some suggestions for it ? i stucked this for one day.
target remote localhost:3333
monitor reset
monitor halt
load
disconnect
target remote localhost:3333
monitor reset
monitor halt
I don't undersrtand why you connect than disconnect than reconnect.
Normally after the load command, you issue a break main than continue:
load -> load your firmware
break main -> put a breakpoint at main
continue -> go!
But between load and break main I had also to issue two commands to position the PC and SP register.
I don't have my configuration right now but try like this first.
I don’t think that it is necessary to write:
load "filename"
since you had to put this file as a parameter when you lauch gdb. I simply put:
load
But ok, I don’t think it is the issue. I don’t have my config right now and I don’t remember the command to set the SP and PC register to an absolute value.
But the values of my commands are for the CC3200, not for the stm32. Then in the mean time you have to know where the program in the stm32 start (to set the PC) and where the stack start (to set the SP). I’ll put my configuration asap
#*****************************************************************************
# Load the binary
#*****************************************************************************
monitor soft_reset_halt
load
#*****************************************************************************
# Initialize the SP and PC values from the application's
# vector table
#*****************************************************************************
set $sp = g_pfnVectors[0]
set $pc = g_pfnVectors[1]
#*****************************************************************************
# Set break point at main and run to main
#*****************************************************************************
break main
continue
Its failed, as below, Seems, we need to add “target remote localhost:3333” at least, else the target wont be executed. Did you code run in eclipse for Spark successfully ? I really confused for gdb, it stuck me several days . Is there anybody debug it successfully in eclipse ?
Result of your suggesution:
monitor soft_reset_halt
"monitor" command not supported by this target.
load ./build/core-firmware.elf
You can't do that when your target is `exec'
set $sp = g_pfnVectors[0]
No registers.
set $pc = g_pfnVectors[1]
No registers.
break main
Breakpoint 1 at 0x800609c: file ../src/main.cpp, line 162.
continue
The program is not being run.
Below is adding the “target remote localhost:3333” :
monitor soft_reset_halt
"monitor" command not supported by this target.
target remote localhost:3333
Remote debugging using localhost:3333
hci_event_handler (pRetParams=pRetParams@entry=0x20004f38, from=from@entry=0x0, fromlen=fromlen@entry=0x0) at ../CC3000_Host_Driver/evnt_handler.c:247
247 if (tSLInformation.usEventOrDataReceived == 0)
load ./build/core-firmware.elf
Loading section .isr_vector, size 0x10c lma 0x8005000
Loading section .text, size 0x16e14 lma 0x8005110
Loading section .init_array, size 0x58 lma 0x801bf24
Loading section .data, size 0x478 lma 0x801bf7c
Start address 0x8005110, load size 95216
Transfer rate: 11 KB/sec, 10579 bytes/write.
set $sp = g_pfnVectors[0]
cannot subscript something of type `<data variable, no debug info>'
set $pc = g_pfnVectors[1]
cannot subscript something of type `<data variable, no debug info>'
break main
Breakpoint 1 at 0x800609c: file ../src/main.cpp, line 162.
continue
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
Program received signal SIGINT, Interrupt.
0x080005d6 in ?? ()
Program received signal SIGINT, Interrupt.
0x080005d6 in ?? ()
Program received signal SIGINT, Interrupt.
0x080005d6 in ?? ()
The -g flags are already there, so no need to add them.
Overall, the answer is: the debug info is already there, but optimization might be happening, and otherwise you need to make sure you have access to JTAG or some other form of debugging that works for you.
Of course you need to add target "remote localhost:3333", sorry
But you have to add it before anything else since it is the connexion to the JTAG server (OpenOCD or whatever), also you can't use my symbols (g_pfnVectors, I've writting my config as an example) since you have other symbols, the right
target remote localhost:3333
monitor soft_reset_halt
load
set $sp = g_pfnVectors[0]
set $pc = g_pfnVectors[1]
break main
continue
In Eclipse you don't have to add load since Eclipse do it for you (if Load Executable checked). Here is a screenshot of my config (from my memory since I'm not in front of my home Eclipse):
Note that you MUST replace my g_pfnVectors symbol by yours (try also without this). Normally you can find this vertor table in the initialisation routine (startupcode).
This is a special config for the CC3200 with OpenOCD but it works
Keep working, I had also several difficulties to fall in "main" when I started debugging
Ok ,Thanks your sugguestions @monnoliv, I will try it later . Here , I need to add debug infomation first according to @zachary ,
Seems now the complied object out of Flash after adding the debug infomation when compile process, its show as below, I think this will be a common issue, when people debugging ? But not found the exactly same issue in this forum…
failed in compiling core-communication-lib project:
c:/users/chris/install/dev/stm32_toolchain/netbean/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: core-firmware.elf section `.text' will not fit in region `FLASH'
c:/users/chris/install/dev/stm32_toolchain/netbean/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 7852 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [core-firmware.elf] Error 1
B.T.W, There is another issue cames before upon issue, R7 register be occured , i added optoins “-O0 -fomit-frame-pointer” then fixed it .
../lib/tropicssl/library/bignum.c: In function 'mpi_mul_hlp':
../lib/tropicssl/library/bignum.c:890:1: error: r7 cannot be used in asm here
}
^
make[1]: *** [obj/lib/tropicssl/library/bignum.o] Error 1
make: *** [check_external_deps] Error 2
Its really good news for me that the debugger seems work now , the breakpoint can jump into the application, and i can click the code running step by step. what i did just follow:
1: added @monnoliv 's given: the keyword "break main and continue".
2: added @zachary 's given : the option a -O0 to the makefile both including the core-firemware & core-common project.
But still have some confusions ,And do this points will impact to debug in future ?
1: I havennt add the USE_SWD_JTAG=y and DEBUG_BUILD=y to the source code.
2: The -O0 option cannot be added into core-communication project(compile will fail) ,since the out of Falsh problem as upon Post of mine.
Happy to know that it works now
For the point 3. It is not always necessary to add. This depends of the hardware, for yours apparently it’s not necessary
Haha, , That functoin is toooo deep for me , Could you please recomments some websites or books to me for the related technology ? whatever that i can build my own embedded things, seems , i need to STUDY…
The assignments in 1 are not for source code, they are typed on the command line. If JTAG debugging is working for you, then you already have what you need.
Regarding 2, it’s OK if the communication lib gets optimized. You don’t need to debug that anyway.