https://github.com/superhawk610/arduino
Arduino project sandbox
https://github.com/superhawk610/arduino
Last synced: about 2 months ago
JSON representation
Arduino project sandbox
- Host: GitHub
- URL: https://github.com/superhawk610/arduino
- Owner: superhawk610
- Created: 2022-07-04T11:08:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-04T11:08:25.000Z (over 3 years ago)
- Last Synced: 2025-03-17T16:56:54.080Z (9 months ago)
- Language: Makefile
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# blink
Blink the built-in status light.
## Build
To generate the target description `avr-atmega328p.json`:
```
rustc +nightly --print target-spec-json -Z unstable-options --target avr-unknown-gnu-atmega328 > avr-atmega328p.json
```
then remove `is-builtin` and change `cpu` and `-mmcu` to `atmega328p` (add the
`p`).
Then, to build:
```
AVR_CPU_FREQUENCY_HZ=16000000 cargo +nightly build -Z build-std=core --target avr-atmega328p.json --release
```
CPU is 16MHz, hence the value for `AVR_CPU_FREQUENCY_HZ`.
## Flash
On WSL2, it appears that COMX is available at /dev/ttySX, e.g.
```
COM3
/dev/ttyS3
```
To flash after building the `.elf`:
```
avrdude -patmega328p -carduino -P/dev/ttyS3 -b115200 -D -Uflash:w:target/avr-atmega328p/release/blink.elf:e
```
Since USB support on WSL2 is [currently lacking](https://github.com/microsoft/WSL/issues/4322),
the easiest solution to flash on Windows is to install `avrdude` for Windows,
build the `.elf` on WSL, then flash from Windows (you can reference the Windows
`.exe` directly).
```
/mnt/../avrdude.exe -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:target/avr-atmega328p/release/blink.elf:e
```