Skip to content

Commit

Permalink
Use drone env
Browse files Browse the repository at this point in the history
  • Loading branch information
valff committed Nov 6, 2019
1 parent 922b318 commit cc9eb46
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 63 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
117 changes: 58 additions & 59 deletions Justfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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 '<!DOCTYPE html><meta http-equiv="refresh" content="0; URL=./drone_stm32_map">' > ../drone-api/$dir/index.html \
&& cd ../drone-api && git add $dir && git commit -m "Docs for $dir"
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2019-10-28
nightly-2019-11-06
4 changes: 1 addition & 3 deletions svd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ pub fn generate_rest() -> Result<()> {
}

fn svd_deserialize() -> Result<Device> {
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"),
Expand Down

0 comments on commit cc9eb46

Please sign in to comment.