PlatformIO Community

How to simulate serial port on debugger simulator?

I’m debugging Arduino AT2560 without JTAG, but with default Platformio simulator.
I don’t know how to emulate a serial port to read serial output or write some serial input.

Any hint?

thanks

The underlying simulator is simavr and externally developed. Check out its manual.

Also checkout related topics Atmel AVR dev/platform v2.1.0: new boards, AVR simulator, updated Arduino cores and especially AVR simulator as aid tool for debugging code.

Note that you can also start simavr manually the firmware and any switches you like.

E.g., a firmware like

#include <Arduino.h>

void setup() {
  Serial.begin(115200);
}

uint16_t count = 0;

void loop() {
  Serial.println("The count is: " + String(count++));
  delay(200);
}

with a platformio.ini

[env:uno]
platform = atmelavr
board = uno
framework = arduino
debug_tool = simavr

after doing a pio debug to build the binary, we can start simavr in a new Powershell session

PS C:\Users\Maxi\.platformio\packages\tool-simavr\bin> .\simavr.exe -m atmega328p -f 16000000  "C:\Users\Maxi\Documents\PlatformIO\Projects\arduino-simavr-test\.pio\build\uno\firmware.elf"   | Out-Host

to get

grafik