Fix "can't find crate for std" for stm32-metapac-gen deps.
This commit is contained in:
parent
549ddf7fc8
commit
1d64421fb4
2
.github/workflows/rust.yml
vendored
2
.github/workflows/rust.yml
vendored
@ -142,4 +142,4 @@ jobs:
|
||||
with:
|
||||
toolchain: stable
|
||||
- name: Generate pregenerated metapac
|
||||
run: cd stm32-metapac/gen; cargo run --release
|
||||
run: cd stm32-metapac-gen; cargo run --release
|
||||
|
@ -47,6 +47,12 @@ members = [
|
||||
#"examples/std",
|
||||
]
|
||||
|
||||
exclude = [
|
||||
# This is only built as a build-dependency, for the host. It shouldn't
|
||||
# get built for the target.
|
||||
"stm32-metapac-gen"
|
||||
]
|
||||
|
||||
[profile.dev]
|
||||
codegen-units = 1
|
||||
debug = 2
|
||||
|
@ -128,18 +128,17 @@ fn find_reg_for_field<'c>(
|
||||
}
|
||||
|
||||
fn make_peripheral_counts(out: &mut String, data: &HashMap<String, u8>) {
|
||||
write!(out,
|
||||
write!(
|
||||
out,
|
||||
"#[macro_export]
|
||||
macro_rules! peripheral_count {{
|
||||
").unwrap();
|
||||
"
|
||||
)
|
||||
.unwrap();
|
||||
for (name, count) in data {
|
||||
write!(out,
|
||||
"({}) => ({});\n",
|
||||
name, count,
|
||||
).unwrap();
|
||||
write!(out, "({}) => ({});\n", name, count,).unwrap();
|
||||
}
|
||||
write!(out,
|
||||
" }}\n").unwrap();
|
||||
write!(out, " }}\n").unwrap();
|
||||
}
|
||||
|
||||
fn make_table(out: &mut String, name: &str, data: &Vec<Vec<String>>) {
|
||||
@ -487,7 +486,11 @@ pub fn gen(options: Options) {
|
||||
make_table(&mut extra, "peripherals", &peripherals_table);
|
||||
make_table(&mut extra, "peripheral_versions", &peripheral_version_table);
|
||||
make_table(&mut extra, "peripheral_pins", &peripheral_pins_table);
|
||||
make_table(&mut extra, "peripheral_dma_channels", &peripheral_dma_channels_table);
|
||||
make_table(
|
||||
&mut extra,
|
||||
"peripheral_dma_channels",
|
||||
&peripheral_dma_channels_table,
|
||||
);
|
||||
make_table(&mut extra, "peripheral_rcc", &peripheral_rcc_table);
|
||||
make_table(&mut extra, "dma_channels", &dma_channels_table);
|
||||
make_table(&mut extra, "dma_requests", &dma_requests_table);
|
||||
@ -618,7 +621,7 @@ pub fn gen(options: Options) {
|
||||
|
||||
// Generate src/lib.rs
|
||||
const CUT_MARKER: &[u8] = b"// GEN CUT HERE";
|
||||
let librs = include_bytes!("../../src/lib.rs");
|
||||
let librs = include_bytes!("../../stm32-metapac/src/lib.rs");
|
||||
let i = bytes_find(librs, CUT_MARKER).unwrap();
|
||||
let mut contents: Vec<u8> = Vec::new();
|
||||
contents.extend(&librs[..i]);
|
||||
@ -636,7 +639,7 @@ pub fn gen(options: Options) {
|
||||
const BUILDDEP_BEGIN: &[u8] = b"# BEGIN BUILD DEPENDENCIES";
|
||||
const BUILDDEP_END: &[u8] = b"# END BUILD DEPENDENCIES";
|
||||
|
||||
let mut contents = include_bytes!("../../Cargo.toml").to_vec();
|
||||
let mut contents = include_bytes!("../../stm32-metapac/Cargo.toml").to_vec();
|
||||
let begin = bytes_find(&contents, BUILDDEP_BEGIN).unwrap();
|
||||
let end = bytes_find(&contents, BUILDDEP_END).unwrap() + BUILDDEP_END.len();
|
||||
contents.drain(begin..end);
|
@ -3,7 +3,7 @@ use stm32_metapac_gen::*;
|
||||
|
||||
fn main() {
|
||||
let out_dir = PathBuf::from("out");
|
||||
let data_dir = PathBuf::from("../../stm32-data/data");
|
||||
let data_dir = PathBuf::from("../stm32-data/data");
|
||||
|
||||
let chips = std::fs::read_dir(data_dir.join("chips"))
|
||||
.unwrap()
|
@ -11,7 +11,7 @@ cortex-m-rt = { version = "0.6.8", optional = true }
|
||||
# BEGIN BUILD DEPENDENCIES
|
||||
# These are removed when generating the pre-generated crate using the tool at gen/.
|
||||
[build-dependencies]
|
||||
stm32-metapac-gen = { path = "./gen" }
|
||||
stm32-metapac-gen = { path = "../stm32-metapac-gen" }
|
||||
regex = "1.5.4"
|
||||
# END BUILD DEPENDENCIES
|
||||
|
||||
|
3
stm32-metapac/gen/.vscode/settings.json
vendored
3
stm32-metapac/gen/.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
||||
{
|
||||
"editor.formatOnSave": true
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user