I want to have the possibility to step through my project, so I found the TeensyDebug TeensyDebug on GitHub. Everyone talking about this libary and how it’s implemented doesn’t seem to have any problems with it, however I do. For testing I used a simple blinky program so here is my code and platformio.ini:
main.cpp:
#include <Arduino.h>
#include "TeensyDebug.h"
#pragma GCC optimize ("O0")
void setup() {
debug.begin(SerialUSB1);
// put your setup code here, to run once:
pinMode(LED_BUILTIN,OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
}
platformio.ini:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
build_type = debug
; See https://github.com/platformio/platform-teensy/issues/65
build_unflags = -DUSB_SERIAL
build_flags = -DUSB_DUAL_SERIAL
debug_port = COM8
debug_tool = custom
debug_load_mode = manual
debug_server =
debug_init_cmds =
target extended-remote $DEBUG_PORT
$INIT_BREAK
define pio_reset_run_target
interrupt
tbreak loop
continue
end
define pio_restart_target
echo Restart is undefined for now.
end
debug_init_break =
It even starts the Debugger, and stops during Initialization. This is the Output i get:
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = custom
PlatformIO: Initializing remote target...
Print::print (base=16, n=<error reading variable: Cannot access memory at address 0x0>, this=<optimized out>) at lib\TeensyDebug-master\src\TeensyDebug.cpp:1134
1134 void dumpmem(void *mem, int sz) {
PlatformIO: Initialization completed
Ignoring packet error, continuing...
While the debugger is halting here, the program continues (LED is blinking), but no matter if I step over, into or continue, the program then stops at a breakpoint (LED stops blinking), however the debugger looks like it’s just running.
I have no clue on why it isn’t working. I tried pretty much evey trick some people gave ni forums and i even tried VisualMicro and it didn’t work either. So please tell me what i am doing wrong. Thanks in advance