Error: Please specify `debug_port` for environment debugging Arduino

This is incomplete because

  • SERIAL_PORT has to be substituted with the actual serial port identifier that the device is connected to
  • lib_deps = jdolinay/avr-debugger @ ~1.1 as a library dependency needs to be added and special code has to be written to start the avr-stub and your firmware must not use the Serial, per above linked documentation

There’s a complete example at How to debug on Arduino mega 2560 - #2 by maxgerhardt.

But you got me a little bit confused: The old behavior should have been just simavr, (simulated device) and now you’ve switched to avr-stub (executed on real device). Are you 100% sure that that’s what you initially wanted?