我正在为我们学校的火箭小组开发一个代码,我有两个程序,一个是闪存机载计算机,另一个是对飞行数据进行数据分析。芯片代码使用no_std,数据分析程序使用std。data-analysis代码将在我的PC上运行,chip代码将在芯片上运行。下面是我的工作区根Cargo.toml和我的项目图:
[workspace]
members = [
"chip",
"data-analysis",
].
├── Cargo.lock
├── Cargo.toml
├── chip
│ ├── Cargo.toml
│ ├── memory.x
│ ├── openocd.cfg
│ ├── openocd.gdb
│ └── src
│ └── main.rs
├── data-analysis
│ ├── Cargo.toml
│ └── src
│ └── main.rs
├── README.md
└── resources
├── 3m.mkd
├── data-stm32f103c8t6.pdf
├── links.txt
├── reference-stm32f103xx.pdf
├── schematic-stm32f103c8t6.png
└── todo.txt我已经决定使用工作区来组织我的代码。当我试图构建工作区时,会得到以下错误:
error[E0463]: can't find crate for `std`
|
= note: the `thumbv7m-none-eabi` target may not support the standard library
= note: `std` is required by `data_analysis` because it does not declare `#![no_std]`
= help: consider building the standard library from source with `cargo build -Zbuild-std`当我用cargo build -Zbuild-std编译时,我得到了错误:
error[E0463]: can't find crate for `panic_abort`
error[E0658]: use of unstable library feature 'restricted_std'
|
= help: add `#![feature(restricted_std)]` to the crate attributes to enable然而,我需要的是no_std,而不是restricted_std。
我理解所有文件的依赖项都存储在Cargo.lock中,这大概就是它产生此错误的原因。我的问题是,我如何向编译器表示,我需要std用于data_analysis,而不是chip代码?我是否应该仅仅使用一个包含多个二进制文件的包,并在Cargo.toml中使用Cargo.toml
发布于 2022-03-14 16:06:25
看起来,您是在试图用与data_analysis相同的目标来简化chip。我建议只删除根Cargo.toml并编译文件夹中各自的根。您可以制作一个Makefile来轻松地实现自动化。
https://stackoverflow.com/questions/71468549
复制相似问题