AVR simulator as aid tool for debugging code

OMG so many options I can still try xD I sure find some time this evening to follow down these paths.

THIS would be AS GOOD AS Atmel Studio which I would then instantly ban from my machine. The only features that Atmel Studio do better in my opinion are debugging and easy chip config (erase chip, set fuses, automatic programmer detection) which are a bit more handy to perform there…

Ok, so what’s currently missing most is that .svd file, and that’s both for simavr and for live debugging using debugWire.
After a quick look into the repo and the implementation in crates.io, I must admit that my geek-level is not high enough to create these files myself, let alone implementing this in platformio’s JSON files. But I’d be keen to help, so if anybody is about to take on this challenge I’d be happy to support, help finding bugs, and to be one of the first to see the “PERIPHERALS” section alive for simavr and debugwire stuff on atmega328p!

Hm, getting closer…

I’ve used a Linux VM to install rustup, installed rust-nightly and then executed the build instructions and out popped the SVD files.

Added them all in the platform/atmelavr/misc/svd folder and referenced them in the board file, and during debugging it attemps to load them but fails.

Not 100% sure if the parser is broken or the generated SVD file. But I can at least file a PR now that adds the SVD files as a first step.

Edit: Huh interesting, when I feed the SVD file into CLion it can enumerate it just fine…

will have another play with it…

Edit: So close yet so far. CLion can parse the SVD file, but it seems it can’t get the values for the I/O registers through avr-gdb. Some values are working though.

As said I’ll create a PR and issue.

Done in Add SVD files for ATMega chips by maxgerhardt · Pull Request #238 · platformio/platform-atmelavr · GitHub and SVD Parser fails for ATMega files with "TypeError: Cannot read property '0' of undefined" · Issue #2368 · platformio/platformio-vscode-ide · GitHub

2 Likes

@msquirogac
I have been able to get the VCD file generation (and input) to work with the pio run command, but it does not appear to be a way to doing this in an interactive debug session. Any thoughts on this?

I’m trying to use simavr with platformio with the examples that @msquirogac provided. So far everything works fine. However, I would really like to simulate data coming from peripherals (e.g. accelerometer, rotary encoder, i2c etc.). I looked at the “tests” from the simavr github library, however none of those seem to simulate pin changes. Does anyone know how to do this?