GDB Issue

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

GDB Issue

1,988件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by navin on Tue Nov 20 02:17:29 MST 2012
Hi,

I have lpc1115  xpresso module. I want to use gdb with this board.
I have gone through http://support.code-red-tech.com/CodeRedWiki/UsingGDB and using this could set up  the gdb but my issue here is that whenever I enter continue or run the gdb freezes.

Here is the output

Reading symbols from c:\nxp\lpcxpresso_4.2.3_292\lpcxpresso\tools\bin\bin\blinky.axf...done.
(gdb) target extended-remote | crt_emu_lpc11_13_nxp.exe -2  -pLPC1115/303 -wire=winusb
Remote debugging using | crt_emu_lpc11_13_nxp.exe -2  -pLPC1115/303 -wire=winusb
Ni: LPCXpresso Debug Driver v4.0 (May 21 2012 21:42:54)
Nc: Looked for chip XML file in C:/nxp/LPCXpresso_4.2.3_292/lpcxpresso/Tools/bin/bin/LPC1115/303.xml

Nc: Looked for vendor directory XML file in C:/nxp/LPCXpresso_4.2.3_292/lpcxpresso/Tools/bin/bin/nxp_directory.xml

Nc: Found generic directory XML file in C:/nxp/LPCXpresso_4.2.3_292/lpcxpresso/Tools/bin/bin/crt_directory.xml

Nc: Emu(0): Conn&Reset. DpID:  BB11477. Info: T1S6RGRIA
Nc: SWD Frequency: 3000 KHz. RTCK: False. Vector catch: False.
Nc: Packet delay: 0  Poll delay: 0.
Nc: NXP: LPC1115/303  Part ID: 0x00050080
Nt: Connected: was_reset=false. was_stopped=true
Cr:v Registered license, download limit of 128K
0x0000016e in SetSegment (n=719) at ../src/blinky_main.c:47
47      {
(gdb) set remotetimeout 60000
(gdb) set mem inaccessible-by-default off
(gdb) mon ondisconnect cont
(gdb) set arm force-mode thumb
(gdb) info program
Debugging a target over a serial line.
Program stopped at 0x16e.
(gdb) tb main
Temporary breakpoint 1 at 0x236: file ../src/blinky_main.c, line 83.
(gdb) continue
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
Xw:
Can somebody please tell me why this is happening?

Regards
0 件の賞賛
返信
9 返答(返信)

1,795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Jul 11 11:46:26 MST 2013
This forum is for NXP LPC users and not STM parts. I suggest you find a more appropriate forum to ask your questions.
0 件の賞賛
返信

1,795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by manish9161 on Thu Jul 11 03:41:23 MST 2013

Quote: CodeRedSupport
If GDB does not return, it is because the breakpoint on main is not being hit - not because there is a problem with GDB.

In you GDB session hit Ctrl-C to break execution, and then look at the PC to see where in your application you are.

Most likely you are in a Fault handler because something went wrong in your startup code. To step through the startup code, set the breakpoint on your startup code (typically ResetISR) instead of (or as well as) main.


[FONT=georgia][COLOR=#ff0000]Hello  I am Manish .I am doing ARM cortex M4 Programming with STM32F4  discovery ,code flashes properly but it having problem when debgging  with GDB.Following result i have found.please guide me how to slove  that.[/COLOR][/FONT]
[FONT=georgia][COLOR=#ff0000][COLOR=Black]manish@manish-Inspiron-1501:~/my-wow-adc$ arm-none-eabi-gdb obj/STM32F4_Test.elf
GNU gdb (Sourcery CodeBench Lite 2013.05-23) 7.4.50.20120716-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<https://sourcery.mentor.com/GNUToolchain/>...
Reading symbols from /home/manish/my-wow-adc/obj/STM32F4_Test.elf...done.
(gdb) target extended-remote localhost:4242
Remote debugging using localhost:4242
0x080077fc in Reset_Handler ()
(gdb) load
Loading section .isr_vector, size 0x188 lma 0x8000000
Loading section .text, size 0x7e34 lma 0x8000188
Loading section .ARM, size 0x8 lma 0x8007fbc
Loading section .init_array, size 0x4 lma 0x8007fc4
Loading section .fini_array, size 0x4 lma 0x8007fc8
Loading section .data, size 0x5b0 lma 0x8007fcc
Start address 0x80077fc, load size 34172
Transfer rate: 6 KB/sec, 4881 bytes/write.
(gdb) monitor reset
(gdb) b  ResetISR 
Function "ResetISR" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (ResetISR) pending.
(gdb) b main
Breakpoint 2 at 0x80073f2: file src/main_temp.c, line 4.
(gdb) info b
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   <PENDING>  ResetISR
2       breakpoint     keep y   0x080073f2 in main at src/main_temp.c:4
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
[/COLOR][/COLOR][/FONT]

[COLOR=#0000cd]then program halts[/COLOR]
I am not getting why
[COLOR=#ff0000]Note: automatically using hardware breakpoints for read-only addresses.[/COLOR]
above line prints and how to caime from that.
   [FONT=georgia][COLOR=#ff0000][/COLOR][/FONT]
0 件の賞賛
返信

1,795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by manish9161 on Thu Jul 11 03:37:50 MST 2013
[FONT=georgia][COLOR=#ff0000]Hello  I am Manish .I am doing ARM cortex M4 Programming with STM32F4  discovery ,code flashes properly but it having problem when debgging  with GDB.Following result i have found.please guide me how to slove that

[COLOR=Black]manish@manish-Inspiron-1501:~/my-wow-adc$ arm-none-eabi-gdb obj/STM32F4_Test.elf
GNU gdb (Sourcery CodeBench Lite 2013.05-23) 7.4.50.20120716-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<https://sourcery.mentor.com/GNUToolchain/>...
Reading symbols from /home/manish/my-wow-adc/obj/STM32F4_Test.elf...done.
(gdb) target extended-remote localhost:4242
Remote debugging using localhost:4242
0x080077fc in Reset_Handler ()
(gdb) load
Loading section .isr_vector, size 0x188 lma 0x8000000
Loading section .text, size 0x7e34 lma 0x8000188
Loading section .ARM, size 0x8 lma 0x8007fbc
Loading section .init_array, size 0x4 lma 0x8007fc4
Loading section .fini_array, size 0x4 lma 0x8007fc8
Loading section .data, size 0x5b0 lma 0x8007fcc
Start address 0x80077fc, load size 34172
Transfer rate: 6 KB/sec, 4881 bytes/write.
(gdb) monitor reset
(gdb) b  ResetISR 
Function "ResetISR" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (ResetISR) pending.
(gdb) b main
Breakpoint 2 at 0x80073f2: file src/main_temp.c, line 4.
(gdb) info b
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   <PENDING>  ResetISR
2       breakpoint     keep y   0x080073f2 in main at src/main_temp.c:4
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.

[/COLOR][/COLOR][/FONT]
[COLOR=#0000cd]then program halts[/COLOR]
I am not getting why
[COLOR=#ff0000]Note: automatically using hardware breakpoints for read-only addresses.[/COLOR]
above line prints and how to caime from that. :confused:
   [FONT=georgia][COLOR=#ff0000][/COLOR][/FONT]
0 件の賞賛
返信

1,795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by navin on Fri Nov 23 23:25:13 MST 2012
Hi,

I could make semihosting to work with
 monitor semihosting ena
I could see printf output in the console but still can't figure out how to use scanf().
Any pointers on this issue would be helpful.

Regards,
Navin
0 件の賞賛
返信

1,795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by navin on Thu Nov 22 05:11:02 MST 2012
Hi,

One more question, is it possible to have semi hosting with this procedure? Any special option to be set?

I have put a printf whose message shows up in LPC xpresso IDE but not in the GDB console.

Regards,
Navin
0 件の賞賛
返信

1,795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by navin on Thu Nov 22 04:55:44 MST 2012
My bad. I some how missed that critical info. Thanks for pointing that out. Now it works like it should.

So here is the summary that I had to do to get this done so that some one who wants to have gdb console running can follow these steps (under win):
1) Copy all the contents of bin folder in lpc xpresso folder to a folder convenient to you (Some how, exporting path in env variable under win did not work for me. I would get ExecError when the emulator utility was launched under GDB. Under Linux the export PATH should work I hope and this step might not be necessary)
2) Now copy arm-none-eabi-gdb.exe to the same folder where you had copied the contents of bin folder
3) cd to Script folder in bin and execute "bootLPCXpresso.cmd winusb"
4) cd to the folder where you had made all the copies and run arm-none-eabi-gdb.exe  /path/to/your/axf/file
5) Enter "target extended-remote | crt_emu_lpc11_13_nxp.exe -2  -pLPC1115/303 -wire=winusb" under gdb prompt
6) Then enter "load"
7) Now GDB is ready to accept your commands enter 's' to single step, 'b' to add break point (say b main) p to print variables...

I hope this will help some one in future who wants to use GDB to use LPC xpresso with other editors.

Regards,
Navin
0 件の賞賛
返信

1,795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Nov 22 04:23:20 MST 2012
You might want to try loading the code to the target before starting execution..:)

See the steps in the grey box towards to top of:

http://support.code-red-tech.com/CodeRedWiki/UsingGDB

Regards,
CodeRedSupport
0 件の賞賛
返信

1,795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by navin on Thu Nov 22 03:10:13 MST 2012
Hi,

Thanks for the reply. As you had suggested, I did put a break point at ResetISR and tried once again but still no luck. I am using the blinky example here.


C:\nxp\LPCXpresso_4.2.3_292\lpcxpresso\Tools\bin\bin>[COLOR=Sienna]arm-none-eabi-gdb.exe blinky.axf[/COLOR]
GNU gdb (Red Suite 2010Q4 by Code Red) 7.2.50.20100908-cvs
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.code-red-tech.com/support/bugs.html>...
Reading symbols from c:\nxp\lpcxpresso_4.2.3_292\lpcxpresso\tools\bin\bin\blinky.axf...done.
(gdb)[COLOR=Red] b ResetISR[/COLOR]
Breakpoint 1 at 0xda: file ../startup/cr_startup_lpc11.c, line 222.
(gdb) target extended-remote | crt_emu_lpc11_13_nxp.exe -2  -pLPC1115/303 -wire=winusb
Remote debugging using | crt_emu_lpc11_13_nxp.exe -2  -pLPC1115/303 -wire=winusb
Ni: LPCXpresso Debug Driver v4.0 (May 21 2012 21:42:54)
Nc: Looked for chip XML file in C:/nxp/LPCXpresso_4.2.3_292/lpcxpresso/Tools/bin/bin/LPC1115/303.xml

Nc: Looked for vendor directory XML file in C:/nxp/LPCXpresso_4.2.3_292/lpcxpresso/Tools/bin/bin/nxp_directory.xml

Nc: Found generic directory XML file in C:/nxp/LPCXpresso_4.2.3_292/lpcxpresso/Tools/bin/bin/crt_directory.xml

Xs:
Xc:
Nc: Emu(0): Conn&Reset. DpID:  BB11477. Info: T1S6RGRIA
Nc: SWD Frequency: 3000 KHz. RTCK: False. Vector catch: False.
Nc: Packet delay: 0  Poll delay: 0.
Nc: NXP: LPC1115/303  Part ID: 0x00050080
Nt: Connected: was_reset=false. was_stopped=false
Cr:v Registered license, download limit of 128K
[COLOR=SeaGreen]0x0000016e in SetSegment (n=719) at ../src/blinky_main.c:47[/COLOR]  ???????
47      {
(gdb) set remotetimeout 60000
(gdb) set mem inaccessible-by-default off
(gdb) mon ondisconnect cont
(gdb) set arm force-mode thumb
(gdb) [COLOR=Blue]continue[/COLOR]
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
Xw:
Xc:
Nt: [COLOR=Blue]Stopped: Halt[/COLOR]

Program received signal SIGINT, Interrupt.
[COLOR=SeaGreen]0x0000016e in SetSegment (n=719) at ../src/blinky_main.c:47[/COLOR]
47      {
(gdb) [COLOR=Blue]run[/COLOR]
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: c:\nxp\lpcxpresso_4.2.3_292\lpcxpresso\tools\bin\bin\blinky.axf
Nc: Executing in user flash.
Xw:




Regards,
Navin
0 件の賞賛
返信

1,795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Wed Nov 21 01:40:52 MST 2012
If GDB does not return, it is because the breakpoint on main is not being hit - not because there is a problem with GDB.

In you GDB session hit Ctrl-C to break execution, and then look at the PC to see where in your application you are.

Most likely you are in a Fault handler because something went wrong in your startup code. To step through the startup code, set the breakpoint on your startup code (typically ResetISR) instead of (or as well as) main.
0 件の賞賛
返信