From cc9eb46070ca2d55643eadb64a2b9b5ed66a5424 Mon Sep 17 00:00:00 2001 From: Valentine Valyaeff Date: Wed, 6 Nov 2019 21:42:09 +0200 Subject: [PATCH] Use `drone env` --- CHANGELOG.md | 2 + Justfile | 117 ++++++++++++++++++++++++------------------------- rust-toolchain | 2 +- svd/src/lib.rs | 4 +- 4 files changed, 62 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7374c48..20b27a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ Possible log types: ### Unreleased +### v0.11.0 (2019-11-06) + - [added] Add STM32F4 family support with `adc`, `dma`, `exti`, `gpio`, `tim` peripheral mappings - [changed] Using `stm2_mcu` config flag to specify the MCU model diff --git a/Justfile b/Justfile index 04c6e64..aaf7f49 100644 --- a/Justfile +++ b/Justfile @@ -1,13 +1,12 @@ -features := 'adc dma exti gpio i2c rtc spi tim uart' -build_target := 'thumbv7em-none-eabihf' cortex_m_core := 'cortex_m4f_r0p1' stm32_mcu := 'stm32l4s9' - -export CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS := '--cfg cortex_m_core="' + cortex_m_core + '" ' + '--cfg stm32_mcu="' + stm32_mcu + '"' +export DRONE_RUSTFLAGS := '--cfg cortex_m_core="' + cortex_m_core + '" ' + '--cfg stm32_mcu="' + stm32_mcu + '"' +target := 'thumbv7em-none-eabihf' +features := 'adc dma exti gpio i2c rtc spi tim uart' # Install dependencies deps: - rustup target add {{build_target}} + rustup target add {{target}} rustup component add clippy rustup component add rustfmt type cargo-readme >/dev/null || cargo +stable install cargo-readme @@ -19,48 +18,48 @@ fmt: # Check for mistakes lint: cargo clippy --package drone-stm32-map-svd - cargo clippy --target {{build_target}} --features "{{features}}" --all --exclude drone-stm32-map-svd + drone env {{target}} -- cargo clippy --features "{{features}}" --all --exclude drone-stm32-map-svd # Check each MCU check-all: rustup target add thumbv7m-none-eabi rustup target add thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7M_NONE_EABI_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f100"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7m-none-eabi - CARGO_TARGET_THUMBV7M_NONE_EABI_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f101"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7m-none-eabi - CARGO_TARGET_THUMBV7M_NONE_EABI_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f102"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7m-none-eabi - CARGO_TARGET_THUMBV7M_NONE_EABI_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f103"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7m-none-eabi - CARGO_TARGET_THUMBV7M_NONE_EABI_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f107"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7m-none-eabi - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f401"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f405"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f407"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f410"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f411"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f412"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f413"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f427"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f429"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f446"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f469"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x1"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x2"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x3"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x5"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x6"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4r5"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4s5"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4r7"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4s7"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4r9"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf - CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4s9"' cargo check --package drone-stm32-map --features "{{features}}" --target thumbv7em-none-eabihf + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f100"' drone env thumbv7m-none-eabi -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f101"' drone env thumbv7m-none-eabi -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f102"' drone env thumbv7m-none-eabi -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f103"' drone env thumbv7m-none-eabi -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m3_r1p1" --cfg stm32_mcu="stm32f107"' drone env thumbv7m-none-eabi -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f401"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f405"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f407"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f410"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f411"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f412"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f413"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f427"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f429"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f446"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32f469"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x1"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x2"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x3"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x5"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4x6"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4r5"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4s5"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4r7"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4s7"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4r9"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" + DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4s9"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}" # Generate the docs doc: cargo doc --package drone-stm32-map-svd - cargo doc --target {{build_target}} --features "{{features}}" --package drone-stm32-map + drone env {{target}} -- cargo doc --features "{{features}}" --package drone-stm32-map # Open the docs in a browser doc-open: doc - cargo doc --target {{build_target}} --features "{{features}}" --package drone-stm32-map --open + drone env {{target}} -- cargo doc --features "{{features}}" --package drone-stm32-map --open # Update README.md readme: @@ -87,57 +86,57 @@ version-bump version drone-core-version drone-cortex-m-version drone-svd-version publish: cd svd && cargo publish sleep 5 - cd src/pieces/1 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/1 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/2 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/2 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/3 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/3 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/4 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/4 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/5 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/5 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/6 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/6 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/7 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/7 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/8 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/8 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/9 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/9 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/10 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/10 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/11 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/11 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces/12 && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces/12 && drone env {{target}} -- cargo publish sleep 5 - cd src/pieces && cargo publish --target {{build_target}} --features "{{features}}" + cd src/pieces && drone env {{target}} -- cargo publish sleep 5 - cd src/periph/adc && cargo publish --target {{build_target}} --features "{{features}}" + cd src/periph/adc && drone env {{target}} -- cargo publish sleep 5 - cd src/periph/dma && cargo publish --target {{build_target}} --features "{{features}}" + cd src/periph/dma && drone env {{target}} -- cargo publish sleep 5 - cd src/periph/exti && cargo publish --target {{build_target}} --features "{{features}}" + cd src/periph/exti && drone env {{target}} -- cargo publish sleep 5 - cd src/periph/gpio && cargo publish --target {{build_target}} --features "{{features}}" + cd src/periph/gpio && drone env {{target}} -- cargo publish sleep 5 - cd src/periph/i2c && cargo publish --target {{build_target}} --features "{{features}}" + cd src/periph/i2c && drone env {{target}} -- cargo publish sleep 5 - cd src/periph/rtc && cargo publish --target {{build_target}} --features "{{features}}" + cd src/periph/rtc && drone env {{target}} -- cargo publish sleep 5 - cd src/periph/spi && cargo publish --target {{build_target}} --features "{{features}}" + cd src/periph/spi && drone env {{target}} -- cargo publish sleep 5 - cd src/periph/tim && cargo publish --target {{build_target}} --features "{{features}}" + cd src/periph/tim && drone env {{target}} -- cargo publish sleep 5 - cd src/periph/uart && cargo publish --target {{build_target}} --features "{{features}}" + cd src/periph/uart && drone env {{target}} -- cargo publish sleep 5 - cargo publish --target {{build_target}} --features "{{features}}" + drone env {{target}} -- cargo publish --features "{{features}}" # Publish the docs to api.drone-os.com publish-doc: doc dir=$(sed -n 's/.*api\.drone-os\.com\/\(.*\)"/\1/;T;p' Cargo.toml) \ && rm -rf ../drone-api/$dir \ && cp -rT target/doc ../drone-api/$dir \ - && cp -rT target/{{build_target}}/doc ../drone-api/$dir \ + && cp -rT target/{{target}}/doc ../drone-api/$dir \ && echo '' > ../drone-api/$dir/index.html \ && cd ../drone-api && git add $dir && git commit -m "Docs for $dir" diff --git a/rust-toolchain b/rust-toolchain index cbdbf5d..22e9048 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2019-10-28 +nightly-2019-11-06 diff --git a/svd/src/lib.rs b/svd/src/lib.rs index f1e0192..e45d134 100644 --- a/svd/src/lib.rs +++ b/svd/src/lib.rs @@ -59,9 +59,7 @@ pub fn generate_rest() -> Result<()> { } fn svd_deserialize() -> Result { - println!("cargo:rerun-if-env-changed=CARGO_TARGET_THUMBV7M_NONE_EABI_RUSTFLAGS"); - println!("cargo:rerun-if-env-changed=CARGO_TARGET_THUMBV7EM_NONE_EABI_RUSTFLAGS"); - println!("cargo:rerun-if-env-changed=CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUSTFLAGS"); + drone_svd::rerun_if_env_changed(); match env::var("CARGO_CFG_STM32_MCU")?.as_ref() { "stm32f100" => parse_svd("STM32F100.svd"), "stm32f101" => parse_svd("STM32F101.svd"),