(no title)
strong_silent_t | 7 years ago
I used the J-Link but I wanted to do it on Linux, so I used the JLink GDB Server along with the GDB build that comes with the Arduino IDE. It probably takes me a good 5 minutes to get everything set up, but the basic stuff works: breakpoints, stack trace, reading and writing memory locations.
The setup is a little convoluted, I'm not sure if there is a better way, but here are my notes:
Procedure for running w/ debugger attached.
1. disconnect debugger's usb
2. connect device via usb
3. arduino IDE program device
4. identify elf, set up gdb with elf.
5. plug in debugger
6. run jlink gdb server
7. attach gdb to jlink server "target remote:2331"
8. "monitor reset", "continue" to re-run target from beginning.
9. observe device is recognized by Arduino IDE
10. open Arduino IDE serial monitor to interact with device.
Now, Ctrl+C in GDB halts device, and stack etc. can be inspected, and
then it can continue running with "cont".
To rerun the device with the same program without redoing everything,
go to step 8 and reset the device. and continue from there.
To find .elf on linux:
==================================================
find /tmp -name sketch_name.ino.elf 2>/dev/null
gdb location:
==================================================
/home/user/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-gdb
JLink setup command:
==================================================
JLinkGDBServer -device ATSAMD21G18A -if SWD -speed 4000
gdb attachment:
==================================================
(gdb) target remote:2331
brokenmachine|7 years ago
I've only used the Arduino Mini/Micro so far (with Atmega328 or Atmega32u4). Is it possible to debug on those?
strong_silent_t|7 years ago