Based on @firelizzard18’s work in
https://github.com/ftrias/TeensyDebug/issues/4#issuecomment-783658913,
I verified that debugging functions works both in RAM and in flash:
```
"/home/michael/Downloads/arduino-1.8.13/hardware/teensy/../tools/arm/bin//arm-none-eabi-gdb" -ex "target extended-remote /dev/ttyACM1" "/tmp/arduino_build_978572/gdb.ino.elf"
GNU gdb (GNU Tools for ARM Embedded Processors) 7.10.1.20160923-cvs
Copyright (C) 2015 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=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
/home/michael/.gdbinit:47: Error in sourced command file:
Scripting in the "Python" language is not supported in this copy of GDB.
Reading symbols from /tmp/arduino_build_978572/gdb.ino.elf...done.
Remote debugging using /dev/ttyACM1
HardwareSerial::addToSerialEventsList (
this=0x0 <HardwareSerial::addToSerialEventsList()>)
at /home/michael/Downloads/arduino-1.8.13/hardware/teensy/avr/cores/teensy3/HardwareSerial.cpp:42
42 s_serials_with_serial_events[s_count_serials_with_serial_events++] = this;
(gdb) b test_function
Breakpoint 1 at 0x49c: file /home/michael/Arduino/gdb/gdb.ino, line 13.
(gdb) c
Continuing.
Breakpoint 1, test_function () at /home/michael/Arduino/gdb/gdb.ino:13
13 void test_function() {
(gdb) bt
#0 test_function () at /home/michael/Arduino/gdb/gdb.ino:13
#1 0x000004d0 in loop () at /home/michael/Arduino/gdb/gdb.ino:21
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb)
```
There are a couple wasys of doing it. Your code was comparing an address to a uint32_t value... So I simply did cast of the address to uint32_t...
Other option would be to change your definitions of things like FLASH_START to simply be a uint32_t.
Warning it also include a change to .gitignore as to keep changes brought in by VisualMicro to being uploaded to project