A blinking LED program written in Rust for the AVR

Related tags

Command-line blink
Overview

blink

A small Hello World Rust application for the AVR.

The program itself toggles a LED on PORTB periodically.

Designed for the ATmega328p.

The AVR-Rust Book

Prerequisites

  • A recent version of the nightly Rust compiler. Anything including or greater than rustc 1.47.0-nightly (0820e54a8 2020-07-23) can be used.
  • The rust-src rustup component - $ rustup component add rust-src
  • AVR-GCC on the system for linking
  • AVR-Libc on the system for support libraries

Usage

Now to build, run:

rustup override set nightly

# Ensure time delays are consistent with a 16MHz microcontroller.
export AVR_CPU_FREQUENCY_HZ=16000000

# Compile the crate to an ELF executable.
cargo build -Z build-std=core --target avr-atmega328p.json --release

There should now be an ELF file at target/avr-atmega328p/release/blink.elf. It can be flashed directly to an AVR microcontroller or ran inside a simulator.

Resources

Comments
  • Cannot build newer version

    Cannot build newer version

    Which version of avr-rust should be used to build this? And, most importantly, which version of libcore?

    I have just built avr-rust from HEAD (commit 512f3ae0cb18e9bb975a8d9fb4c73cd93d49ccbb) and I cannot find a matching libcore.

    opened by massimiliano-mantione 12
  • SIGSEGV when compiling on latest nightly

    SIGSEGV when compiling on latest nightly

    This issue has reported upstream at https://github.com/rust-lang/rust/issues/76930. Following the AVR Rust book, the program cannot compile due to a segmentation fault when compiling the core crate on the latest nightly build.

    ~/code/blink ><> cargo build -Z build-std=core --target avr-atmega328p.json --release
       Compiling core v0.0.0 (/home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
       Compiling rustc-std-workspace-core v1.99.0 (/home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
       Compiling compiler_builtins v0.1.35
       Compiling ruduino v0.2.0
    error: could not compile `core`
    
    Caused by:
      process didn't exit successfully: `rustc --crate-name core --edition=2018 /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=775b9b151bd266b1 -C extra-filename=-775b9b151bd266b1 --out-dir /home/bacongobbler/code/blink/target/avr-atmega328p/release/deps --target /home/bacongobbler/code/blink/avr-atmega328p.json -Z force-unstable-if-unmarked -L dependency=/home/bacongobbler/code/blink/target/avr-atmega328p/release/deps -L dependency=/home/bacongobbler/code/blink/target/release/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    

    Using the debug target also fails with more information:

    ~/code/blink ><> cargo build -Z build-std=core --target avr-atmega328p.json
       Compiling blink v0.1.0 (/home/bacongobbler/code/blink)
    error: linking with `avr-gcc` failed: exit code: 1
      |
      = note: "avr-gcc" "-mmcu=atmega328p" "-L" "/home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.14gicplk3a8rd2mf.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.14qeofa20egw9nwf.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.1wmmysfy11urhzf0.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.24kbbo2eafqv76ap.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.2mrol613m7r8fe4h.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.2ygh13f44y84rejg.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.3gpysx65vrtx1mw3.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.3hgcd7rk5gitckx.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.4fk979zh9rz3tdvf.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.4xxrwed9dq0c99sc.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.5c9h7xhuo2dh8daz.rcgu.o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.fooo9so7gsdl2oq.rcgu.o" "-o" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.elf" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps" "-L" "/home/bacongobbler/code/blink/target/debug/deps" "-L" "/home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/libruduino-320958a79d2f2860.rlib" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/librustc_std_workspace_core-29c9d0aa85cbe977.rlib" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/libcore-69e33a9af4453194.rlib" "-Wl,--end-group" "/home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/libcompiler_builtins-f1cb32ff07da7789.rlib" "-Wl,-Bdynamic" "-lgcc"
      = note: /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.3gpysx65vrtx1mw3.rcgu.o: In function `core::intrinsics::is_nonoverlapping::h95d5cae38d8a279d':
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1754: undefined reference to `abort'
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1754: undefined reference to `abort'
              /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.3gpysx65vrtx1mw3.rcgu.o: In function `core::intrinsics::copy_nonoverlapping::h106c315c8151203b':
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1860: undefined reference to `memcpy'
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1855: undefined reference to `abort'
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1855: undefined reference to `abort'
              /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.3gpysx65vrtx1mw3.rcgu.o: In function `core::intrinsics::is_aligned_and_not_null::h4f686583b9419b1a':
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1745: undefined reference to `abort'
              /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.4fk979zh9rz3tdvf.rcgu.o: In function `core::ptr::swap_nonoverlapping_bytes::h263f7c0912ae4c3d':
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:472: undefined reference to `abort'
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:494: undefined reference to `abort'
              /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/blink-40c8e0f02000ab5f.4fk979zh9rz3tdvf.rcgu.o:/home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:500: more undefined references to `abort' follow
              /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/libcore-69e33a9af4453194.rlib(core-69e33a9af4453194.core.a37ui6x9-cgu.13.rcgu.o): In function `core::intrinsics::copy_nonoverlapping::h12295594d5eb04a5':
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1860: undefined reference to `memcpy'
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1855: undefined reference to `abort'
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1855: undefined reference to `abort'
              /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/libcore-69e33a9af4453194.rlib(core-69e33a9af4453194.core.a37ui6x9-cgu.3.rcgu.o): In function `core::panicking::panic::hf3e1dc38e8693d18':
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/bignum.rs:287: undefined reference to `abort'
              /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/libcore-69e33a9af4453194.rlib(core-69e33a9af4453194.core.a37ui6x9-cgu.3.rcgu.o): In function `core::panicking::panic_fmt::hbbf5d4a80efa2a13':
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panicking.rs:85: undefined reference to `abort'
              /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/libcore-69e33a9af4453194.rlib(core-69e33a9af4453194.core.a37ui6x9-cgu.9.rcgu.o): In function `core::option::Option$LT$T$GT$::unwrap::h73d81fcba2eb990c':
              /home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:381: undefined reference to `abort'
              /home/bacongobbler/code/blink/target/avr-atmega328p/debug/deps/libcore-69e33a9af4453194.rlib(core-69e33a9af4453194.core.a37ui6x9-cgu.9.rcgu.o):/home/bacongobbler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:(.text._ZN4core6option15Option$LT$T$GT$6unwrap17h73d81fcba2eb990cE+0x5e): more undefined references to `abort' follow
              collect2: error: ld returned 1 exit status
              
    
    error: aborting due to previous error
    
    error: could not compile `blink`
    
    To learn more, run the command again with --verbose.
    
    opened by bacongobbler 11
  • cannot find macro `llvm_asm` in this scope

    cannot find macro `llvm_asm` in this scope

    hi, getting this during compiling

    cargo build -Z build-std=core --target avr-atmega328p.json --release
    ...
    
       Compiling avr_delay v0.3.1
    error: cannot find macro `llvm_asm` in this scope
      --> /Users/zag2art/.cargo/registry/src/github.com-1ecc6299db9ec823/avr_delay-0.3.1/src/lib.rs:34:17
       |
    34 |         unsafe {llvm_asm!("1: sbiw $0,1
       |                 ^^^^^^^^
    
    error: cannot find macro `llvm_asm` in this scope
      --> /Users/zag2art/.cargo/registry/src/github.com-1ecc6299db9ec823/avr_delay-0.3.1/src/lib.rs:41:13
       |
    41 |     unsafe {llvm_asm!("1: sbiw $0,1
       |             ^^^^^^^^
    
    

    is that an avr_delay issue or this blink project?

    Note: compiling this on Mac folowing "The AVR-Rust Guidebook"

    opened by zag2art 10
  • Cannot compile libcore

    Cannot compile libcore

    I followed instructions for avr-rust and blink compilation. But I am getting this error:

    $ RUST_BACKTRACE=1 rustup run avr-toolchain xargo build --target avr-atmega328p --release --verbose
    + "rustc" "rustc" "--print" "sysroot"
    + "rustc" "rustc" "--print" "target-list"
    + RUSTFLAGS="--sysroot /home/greatgodoffire/.xargo -Z force-unstable-if-unmarked"
    + "cargo" "cargo" "build" "--release" "--manifest-path" "/tmp/xargo.MNxWNBlqynYS/Cargo.toml" "--target" "avr-atmega328p" "-v" "-p" "core"
    warning: Patch `rustc-std-workspace-alloc v1.0.0 (/home/greatgodoffire/rust/rust/src/tools/rustc-std-workspace-alloc)` was not used in the crate graph.
    Patch `rustc-std-workspace-core v1.0.0 (/home/greatgodoffire/rust/rust/src/tools/rustc-std-workspace-core)` was not used in the crate graph.
    Check that the patched package version and available features are compatible
    with the dependency requirements. If the patch has a different version from
    what is locked in the Cargo.lock file, run `cargo update` to use the new
    version. This may also occur with an optional dependency that is not enabled.
       Compiling core v0.0.0 (/home/greatgodoffire/rust/rust/src/libcore)
         Running `rustc --crate-name core --edition=2018 /home/greatgodoffire/rust/rust/src/libcore/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=e4bf3f58269cc549 -C extra-filename=-e4bf3f58269cc549 --out-dir /tmp/xargo.MNxWNBlqynYS/target/avr-atmega328p/release/deps --target avr-atmega328p -L dependency=/tmp/xargo.MNxWNBlqynYS/target/avr-atmega328p/release/deps -L dependency=/tmp/xargo.MNxWNBlqynYS/target/release/deps --sysroot /home/greatgodoffire/.xargo -Z force-unstable-if-unmarked`
    error: Unrecognized option: 'json'
    
    error: could not compile `core`.
    
    Caused by:
      process didn't exit successfully: `rustc --crate-name core --edition=2018 /home/greatgodoffire/rust/rust/src/libcore/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=e4bf3f58269cc549 -C extra-filename=-e4bf3f58269cc549 --out-dir /tmp/xargo.MNxWNBlqynYS/target/avr-atmega328p/release/deps --target avr-atmega328p -L dependency=/tmp/xargo.MNxWNBlqynYS/target/avr-atmega328p/release/deps -L dependency=/tmp/xargo.MNxWNBlqynYS/target/release/deps --sysroot /home/greatgodoffire/.xargo -Z force-unstable-if-unmarked` (exit code: 1)
    error: `"cargo" "cargo" "build" "--release" "--manifest-path" "/tmp/xargo.MNxWNBlqynYS/Cargo.toml" "--target" "avr-atmega328p" "-v" "-p" "core"` failed with exit code: Some(101)
    stack backtrace:
       0: error_chain::make_backtrace
       1: <error_chain::State as core::default::Default>::default
       2: <std::process::Command as xargo::extensions::CommandExt>::run
       3: xargo::sysroot::build
       4: xargo::sysroot::update
       5: xargo::main_inner
       6: std::rt::lang_start::{{closure}}
       7: std::rt::lang_start_internal::{{closure}}
                 at src/libstd/rt.rs:52
          std::panicking::try::do_call
                 at src/libstd/panicking.rs:292
       8: __rust_maybe_catch_panic
                 at src/libpanic_unwind/lib.rs:78
       9: std::panicking::try
                 at src/libstd/panicking.rs:270
          std::panic::catch_unwind
                 at src/libstd/panic.rs:394
          std::rt::lang_start_internal
                 at src/libstd/rt.rs:51
      10: main
      11: __libc_start_main
      12: _start
    
    

    I'm using Ubuntu 16.04 and I've compiled avr-rust yesterday.

    $ xargo --version
    xargo 0.3.19
    cargo 1.42.0-nightly (9d32b7b01 2020-01-26)
    
    opened by GreatGodOfFire 10
  • Busy loop is optimized out, preventing blinking

    Busy loop is optimized out, preventing blinking

    After setting up my cross compiler as per the avr-rust/rust readme, and compiling the unmolested blink program, I upload to my arduino uno clone, and the LED (PORTB 5 or arduino pin 13) doesn't blink, or even come on. reversing the order of the writes doesn't seem to help, but if I add a "loop {}" after setting PORTB to 0xFF, the led will stay lit as I expect.

    Is it possible that small_delay is getting optimized away? If I do something like

        loop {
            for _ in 0..100000 {
                unsafe { write_volatile(PORTB, 0x00) }
            }
            for _ in 0..100000 {
                unsafe { write_volatile(PORTB, 0xFF) }
            }
        }
    

    I get a proper fast blink.

    opened by pusherofbrooms 10
  • LLVM ERROR: Not supported instr: <MCInst 258 <MCOperand Reg:1> <MCOperand Imm:15> <MCOperand Reg:45>>

    LLVM ERROR: Not supported instr: >

    This issue is a pointer to https://github.com/rust-lang/compiler-builtins/issues/400 it is about

    "LLVM ERROR: Not supported instr" on avr-unknown-gnu-atmega328
    
    opened by stappersg 7
  • Uses ports for a self documenting code

    Uses ports for a self documenting code

    I changed this in my exploration of Arduino Uno. I wanted to explore the capabilities of ruduino and I found this nice abstractions that may be more beginner friendly.

    opened by enjoythelive1 5
  • compiler_builtins fails to compile due to using recently stabilized cfg_target_vendor

    compiler_builtins fails to compile due to using recently stabilized cfg_target_vendor

    I'm not sure if this belongs here or on the main avr-rust/rust repo, but just wanted to post this here in case it's helpful to anyone else.

    I'm using Xargo on Arch Linux with the latest commit of the avr-rust/rust master branch.

    I managed to get past avr-rust/rust#128 using hercek's patches, but building compiler_builtins failed because of a use of the cfg_config_vendor feature. That feature was stabilized earlier this year, but the it looks like the AVR patched Rust version hasn't pulled upstream since the stabilization.

    To fix this, I simply modified the downloaded source for lib.rs in compiler_builtins in the Cargo registry folder (~/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.12/src/lib.rs on my machine), adding the missing #![feature(cfg_target_vendor)] line to the existing feature flags in that file.

    I also get a message that indicates that it might be possible to set a version for compiler_builtins, though I wasn't able to figure out how: warning: dependency (compiler_builtins) specified without providing a local path, Git repository, or version to use. This will be considered an error in future versions

    The last version of compiler_builtins that has the cfg_target_vendor feature flag appears to be 0.1.5. (relevant commit)

    More version info:

    $ rustup run avr-toolchain xargo -V
    xargo 0.3.14
    cargo 1.36.0-nightly (6be12653d 2019-04-19)
    
    $ rustup run avr-toolchain rustc -V
    rustc 1.33.0-dev
    
    opened by mister-walter 5
  • Compilation fails at before compiling libcore

    Compilation fails at before compiling libcore

    I followed instructions for avr-rust and blink compilation. But I am getting this error:

    ➤ rustup run avr-toolchain xargo build --target avr-atmega328p --release
    warning: Patch `rustc-std-workspace-core v1.0.0 (/home/linguini/Desktop/rust/rust-avr/src/tools/rustc-std-workspace-core)` was not used in the crate graph.
    Check that the patched package version and available features are compatible
    with the dependency requirements. If the patch has a different version from
    what is locked in the Cargo.lock file, run `cargo update` to use the new
    version. This may also occur with an optional dependency that is not enabled.
    error: failed to run `rustc` to learn about target-specific information
    
    Caused by:
      process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --sysroot /home/linguini/.xargo -Z force-unstable-if-unmarked --target avr-atmega328p --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro` (exit code: 1)
    --- stderr
    error: Error loading target specification: Could not find specification for target "avr-atmega328p"
      |
      = help: Use `--print target-list` for a list of built-in targets
    
    
    error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.GqdRz0LJNIMX/Cargo.toml" "--target" "avr-atmega328p" "-p" "core"` failed with exit code: Some(101)
    stack backtrace:
       0: error_chain::make_backtrace::h90af62d5c4a6fbd6 (0x55fde99c316b)
       1: <error_chain::State as core::default::Default>::default::h23f817a122243ac9 (0x55fde99c3235)
       2: <std::process::Command as xargo::extensions::CommandExt>::run::h01346a6b4f35f543 (0x55fde9976d4b)
       3: xargo::sysroot::build::h240260972f2e09ed (0x55fde997e541)
       4: xargo::sysroot::update::h94fd82f52808b493 (0x55fde998265d)
       5: xargo::main::ha282b52dabbcaa07 (0x55fde996fc7a)
       6: std::rt::lang_start::{{closure}}::h6c099b348d99c7de (0x55fde99738f2)
       7: std::rt::lang_start_internal::{{closure}}::h53f6e74893a27d59 (0x55fde99ee162)
                 at src/libstd/rt.rs:59
          std::panicking::try::do_call::h8945e3e0fe63365a
                 at src/libstd/panicking.rs:307
       8: __rust_maybe_catch_panic (0x55fde99fb1a9)
                 at src/libpanic_unwind/lib.rs:102
       9: std::panicking::try::hee49dda4da841cb1 (0x55fde99ee058)
                 at src/libstd/panicking.rs:286
      10: std::panic::catch_unwind::h89d0b17e1bb724c9 (0x55fde99e1665)
                 at src/libstd/panic.rs:398
          std::rt::lang_start_internal::hcbec2a0475a1169a
                 at src/libstd/rt.rs:58
      11: main (0x55fde9970a61)
      12: __libc_start_main (0x7f6283dcf222)
      13: _start (0x55fde99601ad)
      14: <unknown> (0x0)
    

    I'm using Arch Linux and I used latest version of avr-rust from avr-support branch(cea79f77f5eac10eddf63e1e8728fd0e34c5998f).

    ➤ rustup -V
    rustup 1.16.0
    
    ➤ xargo -V
    xargo 0.3.13
    cargo 1.34.0-nightly (865cb7010 2019-02-10)
    
    opened by 1inguini 5
  • could not load config key `env.AVR_CPU_FREQUENCY_HZ`

    could not load config key `env.AVR_CPU_FREQUENCY_HZ`

    Since #40

    stappers@myhost:~/src/rust/RustAVR/blink
    $ cargo version
    cargo 1.63.0-nightly (38472bc19 2022-05-31)
    stappers@myhost:~/src/rust/RustAVR/blink
    $ cargo build
    error: error in /home/stappers/src/rust/RustAVR/blink/.cargo/config.toml: could not load config key `env.AVR_CPU_FREQUENCY_HZ`
    
    Caused by:
      data did not match any variant of untagged enum EnvConfigValueInner
    stappers@myhost:~/src/rust/RustAVR/blink
    $ 
    
    opened by stappersg 4
  • couldn't allocate input reg for constrain 'w'

    couldn't allocate input reg for constrain 'w'

    I get this error compiling the project. The whole error message:

    PS C:\Users\woppe\Documents\Rust\blink> cargo build -Z build-std=core --target avr-atmega328p.json --release
       Compiling compiler_builtins v0.1.49
    warning: target json file contains unused fields: no-compiler-rt
    
       Compiling avr-config v1.0.0
       Compiling avr-config v2.0.1
       Compiling avr-std-stub v1.0.2
       Compiling avr_delay v0.3.1
    warning: `avr-config` (lib) generated 1 warning (1 duplicate)
    warning: `avr-std-stub` (lib) generated 1 warning (1 duplicate)
    warning: `avr-config` (lib) generated 1 warning (1 duplicate)
       Compiling ruduino v0.3.2
    error: couldn't allocate input reg for constraint 'w'
      --> C:\Users\woppe\.cargo\registry\src\github.com-1ecc6299db9ec823\avr_delay-0.3.1\src\lib.rs:34:17
       |
    34 |         unsafe {llvm_asm!("1: sbiw $0,1
       |                 ^
    
    warning: `avr_delay` (lib) generated 1 warning (1 duplicate)
    error: could not compile `avr_delay` due to previous error; 1 warning emitted
    warning: build failed, waiting for other jobs to finish...
    LLVM ERROR: Not supported instr: <MCInst 312 <MCOperand Reg:1> <MCOperand Imm:13> <MCOperand Reg:41>>
    warning: `compiler_builtins` (lib) generated 1 warning
    warning: `ruduino` (lib) generated 1 warning (1 duplicate)
    error: build failed
    
    
    opened by str0yd 4
  • Linker does not support -no-pie command line option.

    Linker does not support -no-pie command line option.

    This issue is to report that

    WARN rustc_codegen_ssa::back::link Linker does not support -no-pie command line option. Retrying without.
    

    is a known warning.

    And this issue to tell how a succesfull build looks.

    stappers@myhost:~/src/rust/RustAVR/blink
    $ cargo clean ; cargo version ; rustc --version
    cargo 1.63.0-nightly (38472bc19 2022-05-31)
    rustc 1.63.0-nightly (fee3a459d 2022-06-05)
    stappers@myhost:~/src/rust/RustAVR/blink
    $ cargo build --release
       Compiling proc-macro2 v1.0.39
       Compiling unicode-ident v1.0.0
       Compiling compiler_builtins v0.1.73
       Compiling syn v1.0.96
       Compiling json v0.12.4
       Compiling core v0.0.0 (/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
       Compiling xml-rs v0.8.4
       Compiling lazy_static v1.4.0
       Compiling target-cpu-fetch v0.1.3
       Compiling xmltree v0.10.3
       Compiling target-cpu-macro v0.1.3
       Compiling avr-mcu v0.3.5
       Compiling quote v1.0.18
       Compiling ruduino v0.4.0 (https://github.com/avr-rust/ruduino?branch=master#a33d38a7)
       Compiling const_env_impl--value v0.1.2
       Compiling const_env--value v0.1.2
       Compiling rustc-std-workspace-core v1.99.0
         (/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
       Compiling avr-config v2.0.1
       Compiling avr-std-stub v1.0.3
       Compiling avr_delay v0.4.0 (https://github.com/avr-rust/delay#cfe9848f)
       Compiling blink v0.1.0 (/home/stappers/src/rust/RustAVR/blink)
    WARN rustc_codegen_ssa::back::link Linker does not support -no-pie command line option. Retrying without.
        Finished release [optimized] target(s) in 7.12s
    stappers@myhost:~/src/rust/RustAVR/blink
    $ file target/avr-atmega328p/release/blink.elf 
    target/avr-atmega328p/release/blink.elf: ELF 32-bit LSB executable, Atmel AVR 8-bit, version 1 (SYSV),
      statically linked, with debug_info, not stripped
    stappers@myhost:~/src/rust/RustAVR/blink
    $ 
    
    opened by stappersg 0
Owner
The AVR-Rust project
A fork of Rust with AVR microcontroller support
The AVR-Rust project
That program use on platform windows. And if you write any text on uncorrect keyboard layout, that program for that.

?? This program is designed to translate text into the correct layout when typing is incorrect. ?? Example ghbdtn -> привет Just (by default) pressing

Gest Se 5 Jan 26, 2023
A lightweight and super fast cli todo program written in rust under 200 sloc

todo A lightweight and super fast cli todo program written in rust under 200 sloc installation AUR package: todo-bin use cargo build --release to comp

sioodmy 243 Dec 24, 2022
A silly program written in Rust to output nonsensical sentences in the command line interface.

A silly program written in Rust to output nonsensical sentences in the command line interface.

Rachael Ava 1 Dec 13, 2021
A little program written in Rust that prints random PNG images to the terminal in text grabbed from an image repo.

Cermic A little program written in Rust that prints random PNG images to the terminal in text grabbed from an image repo. NOTE: As of right now, Cermi

Jackson Novak 7 Oct 1, 2022
png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance.

png_defringe_rs png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance. U

null 2 Nov 17, 2022
A launcher/menu program written in Rust for wlroots-based Wayland compositors

tehda tehda (ᴛᴀʏ-dah /ˈteɪ̯.dæ/ or /teh.da/; Finnish for "to do, perform, execute") is a launcher/menu program, like dmenu, rofi, or wofi, written in

Nadia 4 Jan 29, 2023
A fun rust terminal program so you can make Christmas trees!

Xmastree 2021 A fun christmas tree where you can add ornaments! Then, you can export the file into either: a rust file a txt file About Taking a break

Junhao 2 Dec 21, 2021
A Rust program for DXdao contributors to calculated owed vested DXD amounts.

Vested DXD calculator vested-dxd-calculator is an utility program that DXdao contributors can use to calculate how much DXD they're owed for their ser

Federico Luzzi 2 Nov 21, 2022
A Rust program/library to write a Hello World message to the standard output.

hello-world Description hello-world is a Rust program and library that prints the line Hello, world! to the console. Why was this created? This progra

null 0 May 11, 2022
A Rust port of the command line program playing with the cutscenes files (USM) from Genshin Impact.

GI-cutscenes : Rust Remix A command line program playing with the cutscene files (USM) from Genshin Impact, reimplemented in Rust. Much like its origi

Lymkwi 5 Nov 6, 2022
A "Hello, Rust!" program for the Flipper Zero

"Hello, Rust!" for the Flipper Zero This is an example of how to build a Rust-based Flipper application that runs from the SD-card. Note: This depends

David Coles 15 Dec 17, 2022
A simple command-line calculator program writen with Rust.

Calculator.rs An simple command-line calculator program writen with Rust. Features Math functions support > sin(1) = 0.84147098 Variable support > a

BHznJNs 33 Apr 8, 2023
👀Little program I made in 🦀Rust that reminds me every 20 minutes to look away from my computer 🖥screen.

?? eye break Little program I made in ?? Rust that reminds me every 20 minutes to look away from my computer ?? screen. I stay way too long on the com

Goldy 3 Apr 9, 2023
Use Thunk to build your Rust program that runs on old Windows platforms, support Windows XP and more!

Use Thunk to build your Rust program that runs on old platforms. Thunk uses VC-LTL5 and YY-Thunks to build programs that support old platforms. So, ho

null 6 May 21, 2023
💫 This program allows you to do requests in Rust without reqwest !

Zapros ?? This program allows you to do requests in Rust without reqwest ! Usage : Get use crate::http_client::HttpClient; use crate::http_client::Htt

zqo 4 Aug 18, 2023
Pure Rust Fault Proof Program that runs the rollup state-transition to verify an L2 output from L1 inputs.

palmtop palmtop is a fault proof program that runs the rollup state transition to verify an L2 output from L1 inputs. The verifiable L2 output can the

Anton Systems 5 Sep 26, 2023
Translations of a simple C program to Rust.

Translations of a simple C program to Rust This repository contains several translations of Russ Cox's Thompson NFA C program to Rust. Cox's program f

Andrew Gallant 117 Nov 13, 2023
Command-Line program that takes images and produces the copy of the image with a thin frame and palette made of the 10 most frequent colors.

paleatra v.0.0.1 Command-Line program that takes an image and produces the copy of the image with a thin frame and palette made of the 10 most frequen

Beka Modebadze 24 Dec 29, 2022
Tokei is a program that displays statistics about your code.

Tokei is a program that displays statistics about your code. Tokei will show the number of files, total lines within those files and code, comments, and blanks grouped by language.

null 7.5k Jan 1, 2023