lpcware

Semihosting with GDB from command line

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by dawid on Wed Dec 11 05:33:47 MST 2013
Dear All,
I would like to use GDB console from command line to retrieve semihosting data. I'm currently using Win7 64bit and LPCXpresso v6.1.0 [Build 164] [2013-10-21]. The application is simple led blinking and invoking printf("hello world!") every second blink. The application is build under LPCXpresso and I can see printf output in console during debug. I'm also able to debug file from GDB on the target board with standard GDB commands. When application is running on the target from GDB console I can see led blinking but I cannot see any semihosting output. The PCB is standard LPCXpresso LPC1769 rev. B board. The code is compiled with Redlib (semihost) library. Some more details on how I invoke the GDB session:
[list=1]
  [*]Run GDB:
C:\nxp\LPCXpresso_6.1.0_164\lpcxpresso\tools\bin\arm-none-eabi-gdb.exe test.axf
[br]
  [*]GDB script from .gdbinit file:
target extended-remote | C:/nxp/LPCXpresso_6.1.0_164/lpcxpresso/bin/crt_emu_cm3_nxp.exe -g -2 -pLPC1769 -wire=hid
set remotetimeout 60000
set arm force-mode thumb
load
monitor semihosting enable
continue

  [*]Console output:

C:\nxp\LPCXpresso_6.1.0_164\lpcxpresso\tools\bin\arm-none-eabi-gdb.exe test.axf
GNU gdb (GNU Tools for ARM Embedded Processors) 7.3.1.20121016-cvs
Copyright (C) 2011 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=i586-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from test.axf...done.
Ni: LPCXpresso Debug Driver v6.0 (Oct 16 2013 02:04:27 - crt_emu_cm3_nxp.exe bui
ld 1212)
Pc: (  0) Reading remote configuration
Nc: Looked for chip XML file in C:/nxp/LPCXpresso_6.1.0_164/lpcxpresso/bin/LPC17
69.xml

Nc: Looked for vendor directory XML file in C:/nxp/LPCXpresso_6.1.0_164/lpcxpres
so/bin/nxp_directory.xml

Nc: Found generic directory XML file in C:/nxp/LPCXpresso_6.1.0_164/lpcxpresso/b
in/crt_directory.xml

Pc: (  5) Remote configuration complete
Pc: ( 30) Emulator Connected
Pc: ( 40) Debug Halt
Pc: ( 50) CPU ID
Nc: Emu(0): Conn&Reset. DpID: 2BA01477. Info: HID64HS12
Nc: SWD Frequency: 3000 KHz. RTCK: False. Vector catch: False.
Nc: Packet delay: 0  Poll delay: 0.
Nc: Loaded LPC175x_6x_512.cfx: LPC175x_6x (512K) Apr 22 2013 12:14:31  On-chip F
lash Memory

Nc: NXP: LPC1769  Part ID: 0x00000000
Pc: ( 65) Chip Setup Complete
Nt: Connected: was_reset=false. was_stopped=true
Cr:v LPCXpresso Free License - Download limit is 256K
Pc: ( 70) License Check Complete
Pc: ( 85) Registered Semihost Handler
Pc: (100) Target Ready
main () at ../src/main.c:27
27              uint32_t i=0;
Loading section .text, size 0x2c48 lma 0x0
Nt: Writing 11336 bytes to 0000 in Flash (assumed clock: 4.0MHz)
Pb: 1 of 1 (  0) Writing pages 0-2 at 0x00000000 with 11336 bytes
Ps: (  0) Page  0 at 00000000
Ps: (  0) Page  0 at 00000000: 4096 bytes
Ps: ( 36) Page  1 at 00001000: 4096 bytes
Ps: ( 72) Page  2 at 00002000: 3144 bytes
Nt: Erased/Wrote page  0-2 with 11336 bytes in 1636msec
Pb: (100) Finished writing Flash successfully.
Nt: Flash write Done
Nc: nSRST assert (if available)
Nc: Executing in user flash.
Nt:
Start address 0x129, load size 11336
Transfer rate: 3 KB/sec, 11336 bytes/write.
Semihosting enabled.

[/list]

Could anyone can provide me any guides on this?

Best regards!

Outcomes