HardFault when using gdb from command line

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HardFault when using gdb from command line

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fariouche on Sun Aug 12 06:55:21 MST 2012
Hi,

I'm trying to use gdb from command line. The twinkle sample application runs fine, but if I attach gdb, I get an hardfault exception.
If I run the debugger from eclipse, no issue.

I'm using dfu first, and then the following command line:
$(GDB) bin/twinkle.axf -x bin/gdb_script
where gdb_script is
target extended-remote | crt_emu_cm3_nxp -g -2 -pLPC1769 -wire=winUSBswd

I don't know what I'm doing (or not) compared to the IDE?!

Thanks a lot

Here is the output:

Pc: ( 30) Emulator Connected
Pc: ( 40) Debug Halt
Pc: ( 50) CPU ID
Nc: Emu(0): Conn&Reset. DpID: 2BA01477. Info: LPCLINK_1_1
Nc: SWD Frequency: 3000 KHz. RTCK: False. Vector catch: False.
Nc: Packet delay: 0  Poll delay: 0.
Nc: NXP: LPC1768  Part ID: 0x26113F37
Pc: ( 65) Chip Setup Complete
Nt: Connected: was_reset=false. was_stopped=true
Cr:v Registered license, download limit of 128K
Pc: ( 70) License Check Complete
Pc: ( 85) Registered Semihost Handler
Pc: (100) Target Ready
0x00000488 in ?? ()
(gdb) c
Continuing.
Nt: Stopped: VectorCatch:HardF (PC was 0x889B3EB4)

Program received signal SIGSTOP, Stopped (signal).
main () at main.c:84
84        changeval = DELAY_CHANGE;
(gdb) bt
#0  main () at main.c:84
(gdb)
0 Kudos
Reply
4 Replies

892 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Brutte on Sat Aug 18 07:27:25 MST 2012

Quote:
I do not now how to attach the lpclink and debug without letting gdb  flashing the board via crt_emu_cm3_nxp automatically when doing "run"

Edit: Works ok for me.

Some details (XP, Eclipse Indigo, LPC1769+LPC-link):

[LIST=1]
[*]DFU LPC-link
[*] Start Debug Driver (its name is "crt_emu_cm3_nxp.exe" for CM3) with options: "-g -mi -4   -pLPC1769 -vendor=NXP  -wire=winUSB -server=:3333"
[*] Launch debugging session and use "target extended-remote :3333" initialization command.
[/LIST]

Then you can send regular gdb commands:

            set remotetimeout 5000
            set mem inaccessible-by-default off
            mon ondisconnect cont
            set arm force-mode thumb
            load #if you do not want to load, just do not send this command
0 Kudos
Reply

892 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fariouche on Sat Aug 18 02:08:43 MST 2012
Hi,  Thanks for the link. I agree it's not clear.  I'm using lpcxpresso. But event with it or directly with gdb as I want, I do not now how to attach the lpclink and debug without letting gdb flashing the board via crt_emu_cm3_nxp automatically when doing "run"  If I do not do run first but just continue, it crash.  Thanks
0 Kudos
Reply

892 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Brutte on Wed Aug 15 07:15:35 MST 2012

Quote:
The twinkle sample application runs fine, but if I attach gdb, I get an hardfault exception. If I run the debugger from eclipse, no issue.

Naming convention problems...
LPCXpresso is based on Eclipse but it is not Eclipse. So "If I run the debugger from eclipse, no issue." is confusing.

LPCXpresso also uses arm-none-eabi-gdb so your "but if I attach gdb, I get an hardfault exception." is also confusing. AFAIK it is a standard GDB.

Sorry for being picky but I would like to know what we are talking about so do not interchange Eclipse and LPCXpresso names.

I would (also) like to run LPC-link from Eclipse Indigo (and not from  LPCXpresso) because I do not like LPCXpresso - it has some annoying  "plug-ins" I would love to get rid of.

Here are some "external" attempts (CooCox):
http://www.coocox.org/forum/topic.php?id=741
0 Kudos
Reply

892 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fariouche on Sun Aug 12 09:30:14 MST 2012
I forgot to say that I wanted to debug a running application. I would like to avoid flashing for every gdb session I launch.

thanks
0 Kudos
Reply