I tried to debug some SPI/TFT driver code for the SAMD port and I never used gdb for remote debugging.
My first wish was to "only" see my printf somwhere (occuring before the REPL comes to life) but... nothing showed up.
I'm using the J-Link EDU Mini connected to the SWD port of my Adafruit Pygamer on Ubuntu 19.04.
What I did :
Code: Select all
JLinkGDBServer -select USB -device ATSAMD51J19 -endian little -if SWD -speed auto -noir -noLocalhostOnly
SEGGER J-Link GDB Server V6.46d Command Line Version
JLinkARM.dll V6.46d (DLL compiled Jun 7 2019 17:26:52)
Command line: -select USB -device ATSAMD51J19 -endian little -if SWD -speed auto -noir -noLocalhostOnly
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: yes
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: off
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: ATSAMD51J19
Target interface: SWD
Target interface speed: auto
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link EDU Mini V1 compiled May 27 2019 15:50:07
Hardware: V1.00
S/N: 801010356
Feature(s): FlashBP, GDB
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...
Then I started gdb-multiarch (I'm using Ubuntu 19.04, no more specific gdb versions):
Code: Select all
gdb-multiarch -ex "set arch arm" -ex "set endian little" -ex "target extended-remote :2331"
The target architecture is assumed to be arm
The target is assumed to be little endian
Remote debugging using :2331
0xdeadbeee in ?? ()
Code: Select all
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00001108 (Data = 0x7828786B)
Read 4 bytes @ address 0x00001104 (Data = 0x461DD052)
Read 4 bytes @ address 0x00001108 (Data = 0x7828786B)
Read 4 bytes @ address 0x00001104 (Data = 0x461DD052)
Read 2 bytes @ address 0x00001108 (Data = 0x786B)
Read 2 bytes @ address 0x00001106 (Data = 0x461D)
Read 2 bytes @ address 0x00001104 (Data = 0xD052)
Read 2 bytes @ address 0x00001108 (Data = 0x786B)
Read 2 bytes @ address 0x00001106 (Data = 0x461D)
Read 2 bytes @ address 0x00001104 (Data = 0xD052)
Read 4 bytes @ address 0x00001108 (Data = 0x7828786B)
Read 4 bytes @ address 0x00001104 (Data = 0x461DD052)
Read 4 bytes @ address 0x00001108 (Data = 0x7828786B)
Read 4 bytes @ address 0x00001104 (Data = 0x461DD052)
Read 4 bytes @ address 0x00001108 (Data = 0x7828786B)
Read 4 bytes @ address 0x00001108 (Data = 0x7828786B)
Read 4 bytes @ address 0x00001108 (Data = 0x7828786B)
Read 2 bytes @ address 0x00001108 (Data = 0x786B)
I tried to start the firmware from gdb using:
Code: Select all
gdb-multiarch -ex "set arch arm" -ex "set endian little" -ex "target extended-remote :2331" build-ADAFRUIT_PYGAMER/firmware.elf
Any advice ? Anything I should do at compilation time to redirect printf to the debugger ?
Thanks!