cmake -S . -B build
cmake --build build
cd build
make flash
Open a terminal and execute the following:
simulavr -d atmega32 -f AVR_PROJECT.elf --gdbserver
In another terminal, run:
avr-gdb AVR_PROJECT.elf
In order to begin debugging using GDB, connect it with SimulAVR using the following command. Port 1212 is the default port for SimulAVR; make sure it matches the port returned by SimulAVR upon starting it.
target remote localhost:1212
Symbol Table is read by GDB by default if
-g
compiler flag was used to add debugging symbols.
-
To place a breakpoint:
break LABEL_NAME
-
To continue executing until breakpoint is reached:
c
-
To print a variable's value (if it is a pointer for example):
print *PTR_NAME
-
To single step in C code:
n
-
To switch code layout from C to Assembly:
layout asm
-
To single step in Assembly code:
stepi
si
-
To switch code layout back to C:
layout src