-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider providing a step by step guide to running an Arduino sketch using simavr #345
Comments
1- Use the Arduino or avr-gcc to compile the sketch to generate the .hex file. Obs: avrdude is for transfer the .hex file over serial to arduino bootloader, this is not necessary in your usecase. You can try my graphic arduino simulator https://github.com/lcgamboa/picsimlab as a "virtual arduino uno" with the Arduino IDE. |
I tried to use the Arduino CLI to compile the sketch (I don't like the Arduino IDE very much so I try to see if I can do this part using CLI tools only) and it spit out a HEX file and an ELF file, so step one is covered. For step 2, I found that when using an HEX, the When I tried an ELF I got Unable to load firmware. When I tried a HEX I got Unable to load IHEX file. Looks like I tried PicSimLab on macOS using Wine and it looks really great! I ran into an issue tho so I opened it in your repo. I didn't try to use it as a target board with an Arduino IDE yet (like I said above for now I only have Arduino CLI). |
Closed by mistake. Reopening. I didn't find other issues dealing with either of the two errors, so I'm not sure how to proceed to try and fix either of them. I did find https://stackoverflow.com/a/7874424/2715716 tho which looks like it could be easy to use to observe the serial. Will try later. |
I was able to put together instructions for compiling SimAVR on clean Ubuntu and using Arduino CLI to compile a sketch to an ELF for running in SimAVR: curl -L https://github.com/arduino/arduino-cli/releases/download/0.5.0/arduino-cli_0.5.0_Linux_64bit.tar.gz -o arduino-cli.tar.gz
tar -xvzf arduino-cli.tar.gz
./arduino-cli core update-index
./arduino-cli core install arduino:avr
./arduino-cli compile -b arduino:avr:uno nmea-checksum.ino
apt update
apt install -y build-essential libelf-dev avr-libc gcc-avr freeglut3-dev libncurses5-dev pkg-config
git clone https://github.com/buserror/simavr.git
cd simavr
make
cd simavr
./run_avr -m atmega168 -f 16000000 ../../nmea-checksum.ino.arduino.avr.uno.elf I'm still at loss about two things:
@lcgamboa mentions the |
My bad! With the latest version of SimAVR when running the last line in the above script, |
Hi there, this project looks like exactly what I need from my searching around, but I am not capable of figuring out how to actually use it for my usecase. I have an Arduino sketch which computes some stuff (based on data included in its contents) and writes the results to the serial. I would like to run this sketch using simavr and see the results written to serial in my terminal. I read the readme, the manual (way over my head) and searched through GitHub issues containing arduino, which led me to #270 where I saw @idoc had the same usecase, so I also asked them for the same in that (closed) issue. If they reply, I will PR the project README with the guide after I verify I was able to use it.
The text was updated successfully, but these errors were encountered: