PlatformIO Community

Debug AVR (simulation)

Hello everyone, tell me if it is possible to start debugging without connecting a tool. I work with AVR. I want to see the values of variables, or at least a disassembler. I am creating a library, and I really need to see how the compiler interprets the string (char a [] = “abc”;). Thanks!

Which AVR is to be simulated exactly? The external tool SimulAVR might be able to do it.

I wanted to simulate Atmega328p

Then, since the only difference between a ATMega328P and an ATMega328 is the power consumption and a different device signature string, you should be able to use this tool. Just give it the ELF file generated by PIO (.pio\build\uno\firmware.elf or whatever your environment is called) and you have a GDB server with which you can debug it in the simulator.

Unfortunately, I can’t run SimulAVR on MacOS. Maybe all the same there is an opportunity to start debugging without connecting a tool?

You can always install VMware or VirtualBox to get a linux VM up and running.

Alternatives would be https://rowley.co.uk/avr/index.htm or https://fracturedsoftware.com/