Skip to content
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

could not load config key env.AVR_CPU_FREQUENCY_HZ #41

Closed
stappersg opened this issue Jun 6, 2022 · 4 comments · Fixed by #45
Closed

could not load config key env.AVR_CPU_FREQUENCY_HZ #41

stappersg opened this issue Jun 6, 2022 · 4 comments · Fixed by #45

Comments

@stappersg
Copy link
Member

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
$ 
@stappersg
Copy link
Member Author

According https://doc.rust-lang.org/nightly/cargo/reference/config.html#env should it work.

Does it work for you? (So that I know it is just me)

@chinoto
Copy link
Contributor

chinoto commented Jun 7, 2022

Same problem, same version. If I comment it out, I get an error compiling.

❯ cargo build
   Compiling core v0.0.0 (/home/damian/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
warning: target json file contains unused fields: no-compiler-rt

   Compiling rustc-std-workspace-core v1.99.0 (/home/damian/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
error: ran out of registers during register allocation

   Compiling compiler_builtins v0.1.73
warning: `rustc-std-workspace-core` (lib) generated 1 warning (1 duplicate)
warning: `core` (lib) generated 1 warning
error: could not compile `core` due to previous error; 1 warning emitted
warning: build failed, waiting for other jobs to finish...
warning: `compiler_builtins` (lib) generated 1 warning (1 duplicate)

core compiles if I use release mode (maybe that has always been required?), but then avr_delay complains that llvm_asm macro and feature doesn't exist, which sort of makes sense since there has been talk of deprecating it, though shouldn't it still exist for quite awhile?

stappersg added a commit that referenced this issue Jun 7, 2022
Should be reverted when #41
is fixed.
@stappersg
Copy link
Member Author

stappersg commented Jun 7, 2022

Thank you @chinoto, there are now these commits

Compiling with and without ``--release` makes indeed a difference:

stappers@myhost:~/src/rust/RustAVR/blink
$ cargo build
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling compiler_builtins v0.1.73
   Compiling syn v1.0.60
   Compiling core v0.0.0 (/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling json v0.12.4
   Compiling xml-rs v0.8.3
   Compiling lazy_static v1.4.0
   Compiling target-cpu-fetch v0.1.3
   Compiling xmltree v0.10.2
   Compiling target-cpu-macro v0.1.3
   Compiling avr-mcu v0.3.5
   Compiling quote v1.0.8
   Compiling ruduino v0.3.2
   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)
error: ran out of registers during register allocation

error: could not compile `core` due to previous error
warning: build failed, waiting for other jobs to finish...
stappers@myhost:~/src/rust/RustAVR/blink
$ cargo build --release
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling compiler_builtins v0.1.73
   Compiling syn v1.0.60
   Compiling core v0.0.0 (/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling json v0.12.4
   Compiling xml-rs v0.8.3
   Compiling lazy_static v1.4.0
   Compiling target-cpu-fetch v0.1.3
   Compiling xmltree v0.10.2
   Compiling target-cpu-macro v0.1.3
   Compiling avr-mcu v0.3.5
   Compiling quote v1.0.8
   Compiling ruduino v0.3.2
   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 v1.0.0
   Compiling avr-std-stub v1.0.2
   Compiling avr-config v2.0.1
   Compiling avr_delay v0.3.1
error: cannot find macro `llvm_asm` in this scope
  --> /home/stappers/.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
  --> /home/stappers/.cargo/registry/src/github.com-1ecc6299db9ec823/avr_delay-0.3.1/src/lib.rs:41:13
   |
41 |     unsafe {llvm_asm!("1: sbiw $0,1
   |             ^^^^^^^^

error[E0635]: unknown feature `llvm_asm`
 --> /home/stappers/.cargo/registry/src/github.com-1ecc6299db9ec823/avr_delay-0.3.1/src/lib.rs:1:12
  |
1 | #![feature(llvm_asm)]
  |            ^^^^^^^^

For more information about this error, try `rustc --explain E0635`.
error: could not compile `avr_delay` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
stappers@myhost:~/src/rust/RustAVR/blink
$

This issue is now left open as reminder to revert commit 6276e6a.

Work can continue when avr-rust/delay#21 and avr-rust/delay#19 have been solved. (yes, help is appricated)

@rockboynton
Copy link
Contributor

Adding quotes around the value seemed to fix the issue

[env]
AVR_CPU_FREQUENCY_HZ = "16000000"

rockboynton added a commit to rockboynton/blink that referenced this issue Jun 26, 2022
rockboynton added a commit to rockboynton/blink that referenced this issue Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants