Crates.io | simavr-section |
lib.rs | simavr-section |
version | 0.1.1 |
source | src |
created_at | 2022-01-12 05:03:55.872384 |
updated_at | 2022-01-12 05:07:32.419389 |
description | Add simavr-compatible metadata to your binary. |
homepage | |
repository | https://git.sr.ht/~couch/simavr-section |
max_upload_size | |
id | 512586 |
size | 8,863 |
A crate to store simavr-compatible metadata in your ELF.
Make your AVR firmware self-describing of the expected core, frequency, fuses, and voltages. Configure a simulator to export VCD traces without bothering with any command-line flags.
Start by adding the avr_mcu
macro to your main.rs
:
use simavr_section::avr_mcu;
avr_mcu!(8000000, b"attiny85");
To ensure the metadata passes through to the final ELF, you need to add some link
args to the rustc
call. The easiest way to do this is to add or update your
config.toml
file with these lines:
[target.'cfg(target_arch = "avr")']
rustflags = ["-C", "link-arg=-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000"]
Now you can simulate your firmware with no fuss:
> cargo build --release
Compiling my-awesome-firmware v0.1.0 (/home/avr-freak/dev/my-awesome-firmware)
Finished release [optimized] target(s) in 13.37s
> run_avr target/avr-attiny85/release/my-awesome-firmware.elf
Take a look at the documentation with cargo doc --open
or by visiting
the docs.rs page.
The API is intentionally a direct clone of the macros exposed by simavr
,
for ease of porting. Refer to the simavr
project for further details.
All contributions are welcome, whether they're bug reports, feature requests, code changes, or well wishes. Thanks!
To run a full integration test, use test.sh
in the root of the project.
simavr-section is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
simavr-section is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Please see the file LICENSE
in the root of this project for a copy
of the GNU General Public License, or see http://www.gnu.org/licenses/.
This project incorporates code from the simavr
project, which is
also licensed under the GPL v3.