From 776be79f7bb10b09e795e2ea93bb795a653c9b4c Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Fri, 24 Jun 2022 19:56:15 +0200 Subject: [PATCH] Move bootloader main to examples This should remove some confusion around embassy-boot-* being a library vs. a binary. The binary is now an example bootloader instead. --- ci.sh | 18 +++--- embassy-boot/nrf/Cargo.toml | 37 +----------- embassy-boot/stm32/Cargo.toml | 4 +- .../{ => application}/nrf/.cargo/config.toml | 0 examples/boot/application/nrf/Cargo.toml | 18 ++++++ examples/boot/{ => application}/nrf/README.md | 4 +- examples/boot/{ => application}/nrf/build.rs | 0 .../boot/{ => application}/nrf/memory-bl.x | 0 examples/boot/{ => application}/nrf/memory.x | 0 .../boot/{ => application}/nrf/src/bin/a.rs | 0 .../boot/{ => application}/nrf/src/bin/b.rs | 0 .../stm32f3/.cargo/config.toml | 0 examples/boot/application/stm32f3/Cargo.toml | 25 ++++++++ .../boot/{ => application}/stm32f3/README.md | 2 +- .../boot/application/stm32f3}/build.rs | 0 .../boot/{ => application}/stm32f3/memory.x | 0 .../{ => application}/stm32f3/src/bin/a.rs | 0 .../{ => application}/stm32f3/src/bin/b.rs | 0 .../stm32f7/.cargo/config.toml | 0 examples/boot/application/stm32f7/Cargo.toml | 25 ++++++++ .../boot/{ => application}/stm32f7/README.md | 0 .../{stm32f3 => application/stm32f7}/build.rs | 0 .../boot/application/stm32f7/flash-boot.sh | 8 +++ .../{ => application}/stm32f7/memory-bl.x | 0 .../boot/{ => application}/stm32f7/memory.x | 0 .../{ => application}/stm32f7/src/bin/a.rs | 0 .../{ => application}/stm32f7/src/bin/b.rs | 0 .../stm32h7/.cargo/config.toml | 0 examples/boot/application/stm32h7/Cargo.toml | 25 ++++++++ .../boot/{ => application}/stm32h7/README.md | 0 .../{stm32f7 => application/stm32h7}/build.rs | 0 .../boot/application/stm32h7/flash-boot.sh | 8 +++ .../{ => application}/stm32h7/memory-bl.x | 0 .../boot/{ => application}/stm32h7/memory.x | 0 .../{ => application}/stm32h7/src/bin/a.rs | 0 .../{ => application}/stm32h7/src/bin/b.rs | 0 .../stm32l0/.cargo/config.toml | 0 examples/boot/application/stm32l0/Cargo.toml | 25 ++++++++ .../boot/{ => application}/stm32l0/README.md | 2 +- .../{stm32h7 => application/stm32l0}/build.rs | 0 .../boot/{ => application}/stm32l0/memory.x | 0 .../{ => application}/stm32l0/src/bin/a.rs | 0 .../{ => application}/stm32l0/src/bin/b.rs | 0 .../stm32l1/.cargo/config.toml | 0 examples/boot/application/stm32l1/Cargo.toml | 25 ++++++++ .../boot/{ => application}/stm32l1/README.md | 2 +- .../{stm32l0 => application/stm32l1}/build.rs | 0 .../boot/{ => application}/stm32l1/memory.x | 0 .../{ => application}/stm32l1/src/bin/a.rs | 0 .../{ => application}/stm32l1/src/bin/b.rs | 0 .../stm32l4/.cargo/config.toml | 0 examples/boot/application/stm32l4/Cargo.toml | 25 ++++++++ .../boot/{ => application}/stm32l4/README.md | 2 +- .../{stm32l1 => application/stm32l4}/build.rs | 0 .../boot/{ => application}/stm32l4/memory.x | 0 .../{ => application}/stm32l4/src/bin/a.rs | 0 .../{ => application}/stm32l4/src/bin/b.rs | 0 .../stm32wl/.cargo/config.toml | 0 examples/boot/application/stm32wl/Cargo.toml | 25 ++++++++ .../boot/{ => application}/stm32wl/README.md | 2 +- .../{stm32l4 => application/stm32wl}/build.rs | 0 .../boot/{ => application}/stm32wl/memory.x | 0 .../{ => application}/stm32wl/src/bin/a.rs | 0 .../{ => application}/stm32wl/src/bin/b.rs | 0 .../boot/bootloader}/nrf/.cargo/config.toml | 0 examples/boot/bootloader/nrf/Cargo.toml | 58 +++++++++++++++++++ .../boot/bootloader}/nrf/README.md | 0 .../boot/{stm32wl => bootloader/nrf}/build.rs | 0 .../boot/bootloader}/nrf/memory-bm.x | 0 .../boot/bootloader}/nrf/memory-s140.x | 0 .../boot/bootloader}/nrf/memory.x | 0 .../boot/bootloader}/nrf/src/main.rs | 0 examples/boot/bootloader/stm32/Cargo.toml | 57 ++++++++++++++++++ examples/boot/bootloader/stm32/README.md | 11 ++++ .../boot/bootloader}/stm32/build.rs | 0 .../boot/bootloader}/stm32/memory.x | 0 .../boot/bootloader}/stm32/src/main.rs | 0 examples/boot/nrf/Cargo.toml | 18 ------ examples/boot/stm32f3/Cargo.toml | 25 -------- examples/boot/stm32f7/Cargo.toml | 25 -------- examples/boot/stm32f7/flash-boot.sh | 8 --- examples/boot/stm32h7/Cargo.toml | 25 -------- examples/boot/stm32h7/flash-boot.sh | 8 --- examples/boot/stm32l0/Cargo.toml | 25 -------- examples/boot/stm32l1/Cargo.toml | 25 -------- examples/boot/stm32l4/Cargo.toml | 25 -------- examples/boot/stm32wl/Cargo.toml | 25 -------- 87 files changed, 358 insertions(+), 259 deletions(-) rename examples/boot/{ => application}/nrf/.cargo/config.toml (100%) create mode 100644 examples/boot/application/nrf/Cargo.toml rename examples/boot/{ => application}/nrf/README.md (76%) rename examples/boot/{ => application}/nrf/build.rs (100%) rename examples/boot/{ => application}/nrf/memory-bl.x (100%) rename examples/boot/{ => application}/nrf/memory.x (100%) rename examples/boot/{ => application}/nrf/src/bin/a.rs (100%) rename examples/boot/{ => application}/nrf/src/bin/b.rs (100%) rename examples/boot/{ => application}/stm32f3/.cargo/config.toml (100%) create mode 100644 examples/boot/application/stm32f3/Cargo.toml rename examples/boot/{ => application}/stm32f3/README.md (80%) rename {embassy-boot/nrf => examples/boot/application/stm32f3}/build.rs (100%) rename examples/boot/{ => application}/stm32f3/memory.x (100%) rename examples/boot/{ => application}/stm32f3/src/bin/a.rs (100%) rename examples/boot/{ => application}/stm32f3/src/bin/b.rs (100%) rename examples/boot/{ => application}/stm32f7/.cargo/config.toml (100%) create mode 100644 examples/boot/application/stm32f7/Cargo.toml rename examples/boot/{ => application}/stm32f7/README.md (100%) rename examples/boot/{stm32f3 => application/stm32f7}/build.rs (100%) create mode 100755 examples/boot/application/stm32f7/flash-boot.sh rename examples/boot/{ => application}/stm32f7/memory-bl.x (100%) rename examples/boot/{ => application}/stm32f7/memory.x (100%) rename examples/boot/{ => application}/stm32f7/src/bin/a.rs (100%) rename examples/boot/{ => application}/stm32f7/src/bin/b.rs (100%) rename examples/boot/{ => application}/stm32h7/.cargo/config.toml (100%) create mode 100644 examples/boot/application/stm32h7/Cargo.toml rename examples/boot/{ => application}/stm32h7/README.md (100%) rename examples/boot/{stm32f7 => application/stm32h7}/build.rs (100%) create mode 100755 examples/boot/application/stm32h7/flash-boot.sh rename examples/boot/{ => application}/stm32h7/memory-bl.x (100%) rename examples/boot/{ => application}/stm32h7/memory.x (100%) rename examples/boot/{ => application}/stm32h7/src/bin/a.rs (100%) rename examples/boot/{ => application}/stm32h7/src/bin/b.rs (100%) rename examples/boot/{ => application}/stm32l0/.cargo/config.toml (100%) create mode 100644 examples/boot/application/stm32l0/Cargo.toml rename examples/boot/{ => application}/stm32l0/README.md (80%) rename examples/boot/{stm32h7 => application/stm32l0}/build.rs (100%) rename examples/boot/{ => application}/stm32l0/memory.x (100%) rename examples/boot/{ => application}/stm32l0/src/bin/a.rs (100%) rename examples/boot/{ => application}/stm32l0/src/bin/b.rs (100%) rename examples/boot/{ => application}/stm32l1/.cargo/config.toml (100%) create mode 100644 examples/boot/application/stm32l1/Cargo.toml rename examples/boot/{ => application}/stm32l1/README.md (80%) rename examples/boot/{stm32l0 => application/stm32l1}/build.rs (100%) rename examples/boot/{ => application}/stm32l1/memory.x (100%) rename examples/boot/{ => application}/stm32l1/src/bin/a.rs (100%) rename examples/boot/{ => application}/stm32l1/src/bin/b.rs (100%) rename examples/boot/{ => application}/stm32l4/.cargo/config.toml (100%) create mode 100644 examples/boot/application/stm32l4/Cargo.toml rename examples/boot/{ => application}/stm32l4/README.md (80%) rename examples/boot/{stm32l1 => application/stm32l4}/build.rs (100%) rename examples/boot/{ => application}/stm32l4/memory.x (100%) rename examples/boot/{ => application}/stm32l4/src/bin/a.rs (100%) rename examples/boot/{ => application}/stm32l4/src/bin/b.rs (100%) rename examples/boot/{ => application}/stm32wl/.cargo/config.toml (100%) create mode 100644 examples/boot/application/stm32wl/Cargo.toml rename examples/boot/{ => application}/stm32wl/README.md (80%) rename examples/boot/{stm32l4 => application/stm32wl}/build.rs (100%) rename examples/boot/{ => application}/stm32wl/memory.x (100%) rename examples/boot/{ => application}/stm32wl/src/bin/a.rs (100%) rename examples/boot/{ => application}/stm32wl/src/bin/b.rs (100%) rename {embassy-boot => examples/boot/bootloader}/nrf/.cargo/config.toml (100%) create mode 100644 examples/boot/bootloader/nrf/Cargo.toml rename {embassy-boot => examples/boot/bootloader}/nrf/README.md (100%) rename examples/boot/{stm32wl => bootloader/nrf}/build.rs (100%) rename {embassy-boot => examples/boot/bootloader}/nrf/memory-bm.x (100%) rename {embassy-boot => examples/boot/bootloader}/nrf/memory-s140.x (100%) rename {embassy-boot => examples/boot/bootloader}/nrf/memory.x (100%) rename {embassy-boot => examples/boot/bootloader}/nrf/src/main.rs (100%) create mode 100644 examples/boot/bootloader/stm32/Cargo.toml create mode 100644 examples/boot/bootloader/stm32/README.md rename {embassy-boot => examples/boot/bootloader}/stm32/build.rs (100%) rename {embassy-boot => examples/boot/bootloader}/stm32/memory.x (100%) rename {embassy-boot => examples/boot/bootloader}/stm32/src/main.rs (100%) delete mode 100644 examples/boot/nrf/Cargo.toml delete mode 100644 examples/boot/stm32f3/Cargo.toml delete mode 100644 examples/boot/stm32f7/Cargo.toml delete mode 100755 examples/boot/stm32f7/flash-boot.sh delete mode 100644 examples/boot/stm32h7/Cargo.toml delete mode 100755 examples/boot/stm32h7/flash-boot.sh delete mode 100644 examples/boot/stm32l0/Cargo.toml delete mode 100644 examples/boot/stm32l1/Cargo.toml delete mode 100644 examples/boot/stm32l4/Cargo.toml delete mode 100644 examples/boot/stm32wl/Cargo.toml diff --git a/ci.sh b/ci.sh index ff33c8ad1..7f0ceee6d 100755 --- a/ci.sh +++ b/ci.sh @@ -85,14 +85,16 @@ cargo batch \ --- build --release --manifest-path examples/stm32u5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32u5 \ --- build --release --manifest-path examples/stm32wb/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wb \ --- build --release --manifest-path examples/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wl \ - --- build --release --manifest-path examples/boot/nrf/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/nrf --bin b \ - --- build --release --manifest-path examples/boot/stm32f3/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32f3 --bin b \ - --- build --release --manifest-path examples/boot/stm32f7/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32f7 --bin b \ - --- build --release --manifest-path examples/boot/stm32h7/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32h7 --bin b \ - --- build --release --manifest-path examples/boot/stm32l0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/boot/stm32l0 --bin b \ - --- build --release --manifest-path examples/boot/stm32l1/Cargo.toml --target thumbv7m-none-eabi --out-dir out/examples/boot/stm32l1 --bin b \ - --- build --release --manifest-path examples/boot/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32l4 --bin b \ - --- build --release --manifest-path examples/boot/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/boot/stm32wl --bin b \ + --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/nrf --bin b \ + --- build --release --manifest-path examples/boot/application/stm32f3/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32f3 --bin b \ + --- build --release --manifest-path examples/boot/application/stm32f7/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32f7 --bin b \ + --- build --release --manifest-path examples/boot/application/stm32h7/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32h7 --bin b \ + --- build --release --manifest-path examples/boot/application/stm32l0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/boot/stm32l0 --bin b \ + --- build --release --manifest-path examples/boot/application/stm32l1/Cargo.toml --target thumbv7m-none-eabi --out-dir out/examples/boot/stm32l1 --bin b \ + --- build --release --manifest-path examples/boot/application/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32l4 --bin b \ + --- build --release --manifest-path examples/boot/application/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/boot/stm32wl --bin b \ + --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ + --- build --release --manifest-path examples/boot/bootloader/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4,embassy/time-tick-32768hz \ --- build --release --manifest-path examples/wasm/Cargo.toml --target wasm32-unknown-unknown --out-dir out/examples/wasm \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f103c8 --out-dir out/tests/bluepill-stm32f103c8 \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi --out-dir out/tests/nucleo-stm32f429zi \ diff --git a/embassy-boot/nrf/Cargo.toml b/embassy-boot/nrf/Cargo.toml index b5cc9c4fe..ea5794836 100644 --- a/embassy-boot/nrf/Cargo.toml +++ b/embassy-boot/nrf/Cargo.toml @@ -2,11 +2,12 @@ edition = "2021" name = "embassy-boot-nrf" version = "0.1.0" -description = "Bootloader for nRF chips" +description = "Bootloader lib for nRF chips" + +[lib] [dependencies] defmt = { version = "0.3", optional = true } -defmt-rtt = { version = "0.3", optional = true } embassy = { path = "../../embassy", default-features = false } embassy-nrf = { path = "../../embassy-nrf", default-features = false, features = ["nightly"] } @@ -28,35 +29,3 @@ defmt = [ softdevice = [ "nrf-softdevice-mbr", ] -debug = ["defmt-rtt"] - -[profile.dev] -debug = 2 -debug-assertions = true -incremental = false -opt-level = 'z' -overflow-checks = true - -[profile.release] -codegen-units = 1 -debug = 2 -debug-assertions = false -incremental = false -lto = 'fat' -opt-level = 'z' -overflow-checks = false - -# do not optimize proc-macro crates = faster builds from scratch -[profile.dev.build-override] -codegen-units = 8 -debug = false -debug-assertions = false -opt-level = 0 -overflow-checks = false - -[profile.release.build-override] -codegen-units = 8 -debug = false -debug-assertions = false -opt-level = 0 -overflow-checks = false diff --git a/embassy-boot/stm32/Cargo.toml b/embassy-boot/stm32/Cargo.toml index 3f198c114..1b6eeef93 100644 --- a/embassy-boot/stm32/Cargo.toml +++ b/embassy-boot/stm32/Cargo.toml @@ -2,7 +2,9 @@ edition = "2021" name = "embassy-boot-stm32" version = "0.1.0" -description = "Bootloader for STM32 chips" +description = "Bootloader lib for STM32 chips" + +[lib] [dependencies] defmt = { version = "0.3", optional = true } diff --git a/examples/boot/nrf/.cargo/config.toml b/examples/boot/application/nrf/.cargo/config.toml similarity index 100% rename from examples/boot/nrf/.cargo/config.toml rename to examples/boot/application/nrf/.cargo/config.toml diff --git a/examples/boot/application/nrf/Cargo.toml b/examples/boot/application/nrf/Cargo.toml new file mode 100644 index 000000000..0ae7163c3 --- /dev/null +++ b/examples/boot/application/nrf/Cargo.toml @@ -0,0 +1,18 @@ +[package] +edition = "2021" +name = "embassy-boot-nrf-examples" +version = "0.1.0" + +[dependencies] +embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly"] } +embassy-nrf = { version = "0.1.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly", "nrf52840"] } +embassy-boot-nrf = { version = "0.1.0", path = "../../../../embassy-boot/nrf" } +embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } + +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } +panic-reset = { version = "0.1.1" } +embedded-hal = { version = "0.2.6" } + +cortex-m = "0.7.3" +cortex-m-rt = "0.7.0" diff --git a/examples/boot/nrf/README.md b/examples/boot/application/nrf/README.md similarity index 76% rename from examples/boot/nrf/README.md rename to examples/boot/application/nrf/README.md index 1f25ffc05..703377a20 100644 --- a/examples/boot/nrf/README.md +++ b/examples/boot/application/nrf/README.md @@ -17,10 +17,10 @@ application. ``` # Use bare metal linker script -cp memory-bl.x ../../../embassy-boot/nrf/memory.x +cp memory-bl.x ../../bootloader/nrf/memory.x # Flash bootloader -cargo flash --manifest-path ../../../embassy-boot/nrf/Cargo.toml --features embassy-nrf/nrf52840 --release --chip nRF52840_xxAA +cargo flash --manifest-path ../../bootloader/nrf/Cargo.toml --features embassy-nrf/nrf52840 --release --chip nRF52840_xxAA # Build 'b' cargo build --release --bin b # Generate binary for 'b' diff --git a/examples/boot/nrf/build.rs b/examples/boot/application/nrf/build.rs similarity index 100% rename from examples/boot/nrf/build.rs rename to examples/boot/application/nrf/build.rs diff --git a/examples/boot/nrf/memory-bl.x b/examples/boot/application/nrf/memory-bl.x similarity index 100% rename from examples/boot/nrf/memory-bl.x rename to examples/boot/application/nrf/memory-bl.x diff --git a/examples/boot/nrf/memory.x b/examples/boot/application/nrf/memory.x similarity index 100% rename from examples/boot/nrf/memory.x rename to examples/boot/application/nrf/memory.x diff --git a/examples/boot/nrf/src/bin/a.rs b/examples/boot/application/nrf/src/bin/a.rs similarity index 100% rename from examples/boot/nrf/src/bin/a.rs rename to examples/boot/application/nrf/src/bin/a.rs diff --git a/examples/boot/nrf/src/bin/b.rs b/examples/boot/application/nrf/src/bin/b.rs similarity index 100% rename from examples/boot/nrf/src/bin/b.rs rename to examples/boot/application/nrf/src/bin/b.rs diff --git a/examples/boot/stm32f3/.cargo/config.toml b/examples/boot/application/stm32f3/.cargo/config.toml similarity index 100% rename from examples/boot/stm32f3/.cargo/config.toml rename to examples/boot/application/stm32f3/.cargo/config.toml diff --git a/examples/boot/application/stm32f3/Cargo.toml b/examples/boot/application/stm32f3/Cargo.toml new file mode 100644 index 000000000..36fc135fe --- /dev/null +++ b/examples/boot/application/stm32f3/Cargo.toml @@ -0,0 +1,25 @@ +[package] +edition = "2021" +name = "embassy-boot-stm32f3-examples" +version = "0.1.0" + +[dependencies] +embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } +embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f303re", "time-driver-any", "exti"] } +embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } +embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } + +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } +panic-reset = { version = "0.1.1" } +embedded-hal = { version = "0.2.6" } + +cortex-m = "0.7.3" +cortex-m-rt = "0.7.0" + +[features] +defmt = [ + "dep:defmt", + "embassy-stm32/defmt", + "embassy-boot-stm32/defmt", +] diff --git a/examples/boot/stm32f3/README.md b/examples/boot/application/stm32f3/README.md similarity index 80% rename from examples/boot/stm32f3/README.md rename to examples/boot/application/stm32f3/README.md index e92ffb692..46f033d5e 100644 --- a/examples/boot/stm32f3/README.md +++ b/examples/boot/application/stm32f3/README.md @@ -15,7 +15,7 @@ application. ``` # Flash bootloader -cargo flash --manifest-path ../../../embassy-boot/stm32/Cargo.toml --release --features embassy-stm32/stm32f303re --chip STM32F303RETx +cargo flash --manifest-path ../../bootloader/stm32/Cargo.toml --release --features embassy-stm32/stm32f303re --chip STM32F303RETx # Build 'b' cargo build --release --bin b # Generate binary for 'b' diff --git a/embassy-boot/nrf/build.rs b/examples/boot/application/stm32f3/build.rs similarity index 100% rename from embassy-boot/nrf/build.rs rename to examples/boot/application/stm32f3/build.rs diff --git a/examples/boot/stm32f3/memory.x b/examples/boot/application/stm32f3/memory.x similarity index 100% rename from examples/boot/stm32f3/memory.x rename to examples/boot/application/stm32f3/memory.x diff --git a/examples/boot/stm32f3/src/bin/a.rs b/examples/boot/application/stm32f3/src/bin/a.rs similarity index 100% rename from examples/boot/stm32f3/src/bin/a.rs rename to examples/boot/application/stm32f3/src/bin/a.rs diff --git a/examples/boot/stm32f3/src/bin/b.rs b/examples/boot/application/stm32f3/src/bin/b.rs similarity index 100% rename from examples/boot/stm32f3/src/bin/b.rs rename to examples/boot/application/stm32f3/src/bin/b.rs diff --git a/examples/boot/stm32f7/.cargo/config.toml b/examples/boot/application/stm32f7/.cargo/config.toml similarity index 100% rename from examples/boot/stm32f7/.cargo/config.toml rename to examples/boot/application/stm32f7/.cargo/config.toml diff --git a/examples/boot/application/stm32f7/Cargo.toml b/examples/boot/application/stm32f7/Cargo.toml new file mode 100644 index 000000000..ad4a6fa76 --- /dev/null +++ b/examples/boot/application/stm32f7/Cargo.toml @@ -0,0 +1,25 @@ +[package] +edition = "2021" +name = "embassy-boot-stm32f7-examples" +version = "0.1.0" + +[dependencies] +embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } +embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f767zi", "time-driver-any", "exti"] } +embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } +embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } + +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } +panic-reset = { version = "0.1.1" } +embedded-hal = { version = "0.2.6" } + +cortex-m = "0.7.3" +cortex-m-rt = "0.7.0" + +[features] +defmt = [ + "dep:defmt", + "embassy-stm32/defmt", + "embassy-boot-stm32/defmt", +] diff --git a/examples/boot/stm32f7/README.md b/examples/boot/application/stm32f7/README.md similarity index 100% rename from examples/boot/stm32f7/README.md rename to examples/boot/application/stm32f7/README.md diff --git a/examples/boot/stm32f3/build.rs b/examples/boot/application/stm32f7/build.rs similarity index 100% rename from examples/boot/stm32f3/build.rs rename to examples/boot/application/stm32f7/build.rs diff --git a/examples/boot/application/stm32f7/flash-boot.sh b/examples/boot/application/stm32f7/flash-boot.sh new file mode 100755 index 000000000..debdb17a7 --- /dev/null +++ b/examples/boot/application/stm32f7/flash-boot.sh @@ -0,0 +1,8 @@ +#!/bin/bash +mv ../../bootloader/stm32/memory.x ../../bootloader/stm32/memory-old.x +cp memory-bl.x ../../bootloader/stm32/memory.x + +cargo flash --manifest-path ../../bootloader/stm32/Cargo.toml --release --features embassy-stm32/stm32f767zi --chip STM32F767ZITx --target thumbv7em-none-eabihf + +rm ../../bootloader/stm32/memory.x +mv ../../bootloader/stm32/memory-old.x ../../bootloader/stm32/memory.x diff --git a/examples/boot/stm32f7/memory-bl.x b/examples/boot/application/stm32f7/memory-bl.x similarity index 100% rename from examples/boot/stm32f7/memory-bl.x rename to examples/boot/application/stm32f7/memory-bl.x diff --git a/examples/boot/stm32f7/memory.x b/examples/boot/application/stm32f7/memory.x similarity index 100% rename from examples/boot/stm32f7/memory.x rename to examples/boot/application/stm32f7/memory.x diff --git a/examples/boot/stm32f7/src/bin/a.rs b/examples/boot/application/stm32f7/src/bin/a.rs similarity index 100% rename from examples/boot/stm32f7/src/bin/a.rs rename to examples/boot/application/stm32f7/src/bin/a.rs diff --git a/examples/boot/stm32f7/src/bin/b.rs b/examples/boot/application/stm32f7/src/bin/b.rs similarity index 100% rename from examples/boot/stm32f7/src/bin/b.rs rename to examples/boot/application/stm32f7/src/bin/b.rs diff --git a/examples/boot/stm32h7/.cargo/config.toml b/examples/boot/application/stm32h7/.cargo/config.toml similarity index 100% rename from examples/boot/stm32h7/.cargo/config.toml rename to examples/boot/application/stm32h7/.cargo/config.toml diff --git a/examples/boot/application/stm32h7/Cargo.toml b/examples/boot/application/stm32h7/Cargo.toml new file mode 100644 index 000000000..54530cc5b --- /dev/null +++ b/examples/boot/application/stm32h7/Cargo.toml @@ -0,0 +1,25 @@ +[package] +edition = "2021" +name = "embassy-boot-stm32f7-examples" +version = "0.1.0" + +[dependencies] +embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } +embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32h743zi", "time-driver-any", "exti"] } +embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } +embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } + +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } +panic-reset = { version = "0.1.1" } +embedded-hal = { version = "0.2.6" } + +cortex-m = "0.7.3" +cortex-m-rt = "0.7.0" + +[features] +defmt = [ + "dep:defmt", + "embassy-stm32/defmt", + "embassy-boot-stm32/defmt", +] diff --git a/examples/boot/stm32h7/README.md b/examples/boot/application/stm32h7/README.md similarity index 100% rename from examples/boot/stm32h7/README.md rename to examples/boot/application/stm32h7/README.md diff --git a/examples/boot/stm32f7/build.rs b/examples/boot/application/stm32h7/build.rs similarity index 100% rename from examples/boot/stm32f7/build.rs rename to examples/boot/application/stm32h7/build.rs diff --git a/examples/boot/application/stm32h7/flash-boot.sh b/examples/boot/application/stm32h7/flash-boot.sh new file mode 100755 index 000000000..debdb17a7 --- /dev/null +++ b/examples/boot/application/stm32h7/flash-boot.sh @@ -0,0 +1,8 @@ +#!/bin/bash +mv ../../bootloader/stm32/memory.x ../../bootloader/stm32/memory-old.x +cp memory-bl.x ../../bootloader/stm32/memory.x + +cargo flash --manifest-path ../../bootloader/stm32/Cargo.toml --release --features embassy-stm32/stm32f767zi --chip STM32F767ZITx --target thumbv7em-none-eabihf + +rm ../../bootloader/stm32/memory.x +mv ../../bootloader/stm32/memory-old.x ../../bootloader/stm32/memory.x diff --git a/examples/boot/stm32h7/memory-bl.x b/examples/boot/application/stm32h7/memory-bl.x similarity index 100% rename from examples/boot/stm32h7/memory-bl.x rename to examples/boot/application/stm32h7/memory-bl.x diff --git a/examples/boot/stm32h7/memory.x b/examples/boot/application/stm32h7/memory.x similarity index 100% rename from examples/boot/stm32h7/memory.x rename to examples/boot/application/stm32h7/memory.x diff --git a/examples/boot/stm32h7/src/bin/a.rs b/examples/boot/application/stm32h7/src/bin/a.rs similarity index 100% rename from examples/boot/stm32h7/src/bin/a.rs rename to examples/boot/application/stm32h7/src/bin/a.rs diff --git a/examples/boot/stm32h7/src/bin/b.rs b/examples/boot/application/stm32h7/src/bin/b.rs similarity index 100% rename from examples/boot/stm32h7/src/bin/b.rs rename to examples/boot/application/stm32h7/src/bin/b.rs diff --git a/examples/boot/stm32l0/.cargo/config.toml b/examples/boot/application/stm32l0/.cargo/config.toml similarity index 100% rename from examples/boot/stm32l0/.cargo/config.toml rename to examples/boot/application/stm32l0/.cargo/config.toml diff --git a/examples/boot/application/stm32l0/Cargo.toml b/examples/boot/application/stm32l0/Cargo.toml new file mode 100644 index 000000000..de7bea47b --- /dev/null +++ b/examples/boot/application/stm32l0/Cargo.toml @@ -0,0 +1,25 @@ +[package] +edition = "2021" +name = "embassy-boot-stm32l0-examples" +version = "0.1.0" + +[dependencies] +embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } +embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l072cz", "time-driver-any", "exti", "memory-x"] } +embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } +embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } + +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } +panic-reset = { version = "0.1.1" } +embedded-hal = { version = "0.2.6" } + +cortex-m = "0.7.3" +cortex-m-rt = "0.7.0" + +[features] +defmt = [ + "dep:defmt", + "embassy-stm32/defmt", + "embassy-boot-stm32/defmt", +] diff --git a/examples/boot/stm32l0/README.md b/examples/boot/application/stm32l0/README.md similarity index 80% rename from examples/boot/stm32l0/README.md rename to examples/boot/application/stm32l0/README.md index a0e8021fc..762bdfe71 100644 --- a/examples/boot/stm32l0/README.md +++ b/examples/boot/application/stm32l0/README.md @@ -15,7 +15,7 @@ application. ``` # Flash bootloader -cargo flash --manifest-path ../../../embassy-boot/stm32/Cargo.toml --release --features embassy-stm32/stm32l072cz --chip STM32L072CZTx +cargo flash --manifest-path ../../bootloader/stm32/Cargo.toml --release --features embassy-stm32/stm32l072cz --chip STM32L072CZTx # Build 'b' cargo build --release --bin b # Generate binary for 'b' diff --git a/examples/boot/stm32h7/build.rs b/examples/boot/application/stm32l0/build.rs similarity index 100% rename from examples/boot/stm32h7/build.rs rename to examples/boot/application/stm32l0/build.rs diff --git a/examples/boot/stm32l0/memory.x b/examples/boot/application/stm32l0/memory.x similarity index 100% rename from examples/boot/stm32l0/memory.x rename to examples/boot/application/stm32l0/memory.x diff --git a/examples/boot/stm32l0/src/bin/a.rs b/examples/boot/application/stm32l0/src/bin/a.rs similarity index 100% rename from examples/boot/stm32l0/src/bin/a.rs rename to examples/boot/application/stm32l0/src/bin/a.rs diff --git a/examples/boot/stm32l0/src/bin/b.rs b/examples/boot/application/stm32l0/src/bin/b.rs similarity index 100% rename from examples/boot/stm32l0/src/bin/b.rs rename to examples/boot/application/stm32l0/src/bin/b.rs diff --git a/examples/boot/stm32l1/.cargo/config.toml b/examples/boot/application/stm32l1/.cargo/config.toml similarity index 100% rename from examples/boot/stm32l1/.cargo/config.toml rename to examples/boot/application/stm32l1/.cargo/config.toml diff --git a/examples/boot/application/stm32l1/Cargo.toml b/examples/boot/application/stm32l1/Cargo.toml new file mode 100644 index 000000000..3fd6f639a --- /dev/null +++ b/examples/boot/application/stm32l1/Cargo.toml @@ -0,0 +1,25 @@ +[package] +edition = "2021" +name = "embassy-boot-stm32l1-examples" +version = "0.1.0" + +[dependencies] +embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } +embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l151cb-a", "time-driver-any", "exti"] } +embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } +embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } + +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } +panic-reset = { version = "0.1.1" } +embedded-hal = { version = "0.2.6" } + +cortex-m = "0.7.3" +cortex-m-rt = "0.7.0" + +[features] +defmt = [ + "dep:defmt", + "embassy-stm32/defmt", + "embassy-boot-stm32/defmt", +] diff --git a/examples/boot/stm32l1/README.md b/examples/boot/application/stm32l1/README.md similarity index 80% rename from examples/boot/stm32l1/README.md rename to examples/boot/application/stm32l1/README.md index 0d4accbff..428dde7b3 100644 --- a/examples/boot/stm32l1/README.md +++ b/examples/boot/application/stm32l1/README.md @@ -15,7 +15,7 @@ application. ``` # Flash bootloader -cargo flash --manifest-path ../../../embassy-boot/stm32/Cargo.toml --release --features embassy-stm32/stm32l151cb-a --chip STM32L151CBxxA +cargo flash --manifest-path ../../bootloader/stm32/Cargo.toml --release --features embassy-stm32/stm32l151cb-a --chip STM32L151CBxxA # Build 'b' cargo build --release --bin b # Generate binary for 'b' diff --git a/examples/boot/stm32l0/build.rs b/examples/boot/application/stm32l1/build.rs similarity index 100% rename from examples/boot/stm32l0/build.rs rename to examples/boot/application/stm32l1/build.rs diff --git a/examples/boot/stm32l1/memory.x b/examples/boot/application/stm32l1/memory.x similarity index 100% rename from examples/boot/stm32l1/memory.x rename to examples/boot/application/stm32l1/memory.x diff --git a/examples/boot/stm32l1/src/bin/a.rs b/examples/boot/application/stm32l1/src/bin/a.rs similarity index 100% rename from examples/boot/stm32l1/src/bin/a.rs rename to examples/boot/application/stm32l1/src/bin/a.rs diff --git a/examples/boot/stm32l1/src/bin/b.rs b/examples/boot/application/stm32l1/src/bin/b.rs similarity index 100% rename from examples/boot/stm32l1/src/bin/b.rs rename to examples/boot/application/stm32l1/src/bin/b.rs diff --git a/examples/boot/stm32l4/.cargo/config.toml b/examples/boot/application/stm32l4/.cargo/config.toml similarity index 100% rename from examples/boot/stm32l4/.cargo/config.toml rename to examples/boot/application/stm32l4/.cargo/config.toml diff --git a/examples/boot/application/stm32l4/Cargo.toml b/examples/boot/application/stm32l4/Cargo.toml new file mode 100644 index 000000000..7284af662 --- /dev/null +++ b/examples/boot/application/stm32l4/Cargo.toml @@ -0,0 +1,25 @@ +[package] +edition = "2021" +name = "embassy-boot-stm32l4-examples" +version = "0.1.0" + +[dependencies] +embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } +embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l475vg", "time-driver-any", "exti"] } +embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } +embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } + +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } +panic-reset = { version = "0.1.1" } +embedded-hal = { version = "0.2.6" } + +cortex-m = "0.7.3" +cortex-m-rt = "0.7.0" + +[features] +defmt = [ + "dep:defmt", + "embassy-stm32/defmt", + "embassy-boot-stm32/defmt", +] diff --git a/examples/boot/stm32l4/README.md b/examples/boot/application/stm32l4/README.md similarity index 80% rename from examples/boot/stm32l4/README.md rename to examples/boot/application/stm32l4/README.md index 8966c2fb5..83f50748c 100644 --- a/examples/boot/stm32l4/README.md +++ b/examples/boot/application/stm32l4/README.md @@ -15,7 +15,7 @@ application. ``` # Flash bootloader -cargo flash --manifest-path ../../../embassy-boot/stm32/Cargo.toml --release --features embassy-stm32/stm32l475vg --chip STM32L475VG +cargo flash --manifest-path ../../bootloader/stm32/Cargo.toml --release --features embassy-stm32/stm32l475vg --chip STM32L475VG # Build 'b' cargo build --release --bin b # Generate binary for 'b' diff --git a/examples/boot/stm32l1/build.rs b/examples/boot/application/stm32l4/build.rs similarity index 100% rename from examples/boot/stm32l1/build.rs rename to examples/boot/application/stm32l4/build.rs diff --git a/examples/boot/stm32l4/memory.x b/examples/boot/application/stm32l4/memory.x similarity index 100% rename from examples/boot/stm32l4/memory.x rename to examples/boot/application/stm32l4/memory.x diff --git a/examples/boot/stm32l4/src/bin/a.rs b/examples/boot/application/stm32l4/src/bin/a.rs similarity index 100% rename from examples/boot/stm32l4/src/bin/a.rs rename to examples/boot/application/stm32l4/src/bin/a.rs diff --git a/examples/boot/stm32l4/src/bin/b.rs b/examples/boot/application/stm32l4/src/bin/b.rs similarity index 100% rename from examples/boot/stm32l4/src/bin/b.rs rename to examples/boot/application/stm32l4/src/bin/b.rs diff --git a/examples/boot/stm32wl/.cargo/config.toml b/examples/boot/application/stm32wl/.cargo/config.toml similarity index 100% rename from examples/boot/stm32wl/.cargo/config.toml rename to examples/boot/application/stm32wl/.cargo/config.toml diff --git a/examples/boot/application/stm32wl/Cargo.toml b/examples/boot/application/stm32wl/Cargo.toml new file mode 100644 index 000000000..ca22e6134 --- /dev/null +++ b/examples/boot/application/stm32wl/Cargo.toml @@ -0,0 +1,25 @@ +[package] +edition = "2021" +name = "embassy-boot-stm32wl-examples" +version = "0.1.0" + +[dependencies] +embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } +embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32wl55jc-cm4", "time-driver-any", "exti"] } +embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } +embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } + +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } +panic-reset = { version = "0.1.1" } +embedded-hal = { version = "0.2.6" } + +cortex-m = "0.7.3" +cortex-m-rt = "0.7.0" + +[features] +defmt = [ + "dep:defmt", + "embassy-stm32/defmt", + "embassy-boot-stm32/defmt", +] diff --git a/examples/boot/stm32wl/README.md b/examples/boot/application/stm32wl/README.md similarity index 80% rename from examples/boot/stm32wl/README.md rename to examples/boot/application/stm32wl/README.md index edcdacf91..c8dce0387 100644 --- a/examples/boot/stm32wl/README.md +++ b/examples/boot/application/stm32wl/README.md @@ -15,7 +15,7 @@ application. ``` # Flash bootloader -cargo flash --manifest-path ../../../embassy-boot/stm32/Cargo.toml --release --features embassy-stm32/stm32wl55jc-cm4 --chip STM32WLE5JCIx +cargo flash --manifest-path ../../bootloader/stm32/Cargo.toml --release --features embassy-stm32/stm32wl55jc-cm4 --chip STM32WLE5JCIx # Build 'b' cargo build --release --bin b # Generate binary for 'b' diff --git a/examples/boot/stm32l4/build.rs b/examples/boot/application/stm32wl/build.rs similarity index 100% rename from examples/boot/stm32l4/build.rs rename to examples/boot/application/stm32wl/build.rs diff --git a/examples/boot/stm32wl/memory.x b/examples/boot/application/stm32wl/memory.x similarity index 100% rename from examples/boot/stm32wl/memory.x rename to examples/boot/application/stm32wl/memory.x diff --git a/examples/boot/stm32wl/src/bin/a.rs b/examples/boot/application/stm32wl/src/bin/a.rs similarity index 100% rename from examples/boot/stm32wl/src/bin/a.rs rename to examples/boot/application/stm32wl/src/bin/a.rs diff --git a/examples/boot/stm32wl/src/bin/b.rs b/examples/boot/application/stm32wl/src/bin/b.rs similarity index 100% rename from examples/boot/stm32wl/src/bin/b.rs rename to examples/boot/application/stm32wl/src/bin/b.rs diff --git a/embassy-boot/nrf/.cargo/config.toml b/examples/boot/bootloader/nrf/.cargo/config.toml similarity index 100% rename from embassy-boot/nrf/.cargo/config.toml rename to examples/boot/bootloader/nrf/.cargo/config.toml diff --git a/examples/boot/bootloader/nrf/Cargo.toml b/examples/boot/bootloader/nrf/Cargo.toml new file mode 100644 index 000000000..8eb98623c --- /dev/null +++ b/examples/boot/bootloader/nrf/Cargo.toml @@ -0,0 +1,58 @@ +[package] +edition = "2021" +name = "nrf-bootloader-example" +version = "0.1.0" +description = "Bootloader for nRF chips" + +[dependencies] +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } + +embassy = { path = "../../../../embassy", default-features = false } +embassy-nrf = { path = "../../../../embassy-nrf", default-features = false, features = ["nightly"] } +embassy-boot-nrf = { path = "../../../../embassy-boot/nrf", default-features = false } +cortex-m = { version = "0.7" } +cortex-m-rt = { version = "0.7" } +cfg-if = "1.0.0" + +[features] +defmt = [ + "dep:defmt", + "embassy-boot-nrf/defmt", + "embassy-nrf/defmt", +] +softdevice = [ + "embassy-boot-nrf/softdevice", +] +debug = ["defmt-rtt"] + +[profile.dev] +debug = 2 +debug-assertions = true +incremental = false +opt-level = 'z' +overflow-checks = true + +[profile.release] +codegen-units = 1 +debug = 2 +debug-assertions = false +incremental = false +lto = 'fat' +opt-level = 'z' +overflow-checks = false + +# do not optimize proc-macro crates = faster builds from scratch +[profile.dev.build-override] +codegen-units = 8 +debug = false +debug-assertions = false +opt-level = 0 +overflow-checks = false + +[profile.release.build-override] +codegen-units = 8 +debug = false +debug-assertions = false +opt-level = 0 +overflow-checks = false diff --git a/embassy-boot/nrf/README.md b/examples/boot/bootloader/nrf/README.md similarity index 100% rename from embassy-boot/nrf/README.md rename to examples/boot/bootloader/nrf/README.md diff --git a/examples/boot/stm32wl/build.rs b/examples/boot/bootloader/nrf/build.rs similarity index 100% rename from examples/boot/stm32wl/build.rs rename to examples/boot/bootloader/nrf/build.rs diff --git a/embassy-boot/nrf/memory-bm.x b/examples/boot/bootloader/nrf/memory-bm.x similarity index 100% rename from embassy-boot/nrf/memory-bm.x rename to examples/boot/bootloader/nrf/memory-bm.x diff --git a/embassy-boot/nrf/memory-s140.x b/examples/boot/bootloader/nrf/memory-s140.x similarity index 100% rename from embassy-boot/nrf/memory-s140.x rename to examples/boot/bootloader/nrf/memory-s140.x diff --git a/embassy-boot/nrf/memory.x b/examples/boot/bootloader/nrf/memory.x similarity index 100% rename from embassy-boot/nrf/memory.x rename to examples/boot/bootloader/nrf/memory.x diff --git a/embassy-boot/nrf/src/main.rs b/examples/boot/bootloader/nrf/src/main.rs similarity index 100% rename from embassy-boot/nrf/src/main.rs rename to examples/boot/bootloader/nrf/src/main.rs diff --git a/examples/boot/bootloader/stm32/Cargo.toml b/examples/boot/bootloader/stm32/Cargo.toml new file mode 100644 index 000000000..b99a8fbcd --- /dev/null +++ b/examples/boot/bootloader/stm32/Cargo.toml @@ -0,0 +1,57 @@ +[package] +edition = "2021" +name = "stm32-bootloader-example" +version = "0.1.0" +description = "Example bootloader for STM32 chips" + +[dependencies] +defmt = { version = "0.3", optional = true } +defmt-rtt = { version = "0.3", optional = true } + +embassy = { path = "../../../../embassy", default-features = false } +embassy-stm32 = { path = "../../../../embassy-stm32", default-features = false, features = ["nightly"] } +embassy-boot-stm32 = { path = "../../../../embassy-boot/stm32", default-features = false } +cortex-m = { version = "0.7" } +cortex-m-rt = { version = "0.7" } +embedded-storage = "0.3.0" +embedded-storage-async = "0.3.0" +cfg-if = "1.0.0" + +[features] +defmt = [ + "dep:defmt", + "embassy-boot-stm32/defmt", + "embassy-stm32/defmt", +] +debug = ["defmt-rtt"] + +[profile.dev] +debug = 2 +debug-assertions = true +incremental = false +opt-level = 'z' +overflow-checks = true + +[profile.release] +codegen-units = 1 +debug = 2 +debug-assertions = false +incremental = false +lto = 'fat' +opt-level = 'z' +overflow-checks = false + +# do not optimize proc-macro crates = faster builds from scratch +[profile.dev.build-override] +codegen-units = 8 +debug = false +debug-assertions = false +opt-level = 0 +overflow-checks = false + +[profile.release.build-override] +codegen-units = 8 +debug = false +debug-assertions = false +opt-level = 0 +overflow-checks = false diff --git a/examples/boot/bootloader/stm32/README.md b/examples/boot/bootloader/stm32/README.md new file mode 100644 index 000000000..a82b730b9 --- /dev/null +++ b/examples/boot/bootloader/stm32/README.md @@ -0,0 +1,11 @@ +# Bootloader for STM32 + +The bootloader uses `embassy-boot` to interact with the flash. + +# Usage + +Flash the bootloader + +``` +cargo flash --features embassy-stm32/stm32wl55jc-cm4 --release --chip STM32WLE5JCIx +``` diff --git a/embassy-boot/stm32/build.rs b/examples/boot/bootloader/stm32/build.rs similarity index 100% rename from embassy-boot/stm32/build.rs rename to examples/boot/bootloader/stm32/build.rs diff --git a/embassy-boot/stm32/memory.x b/examples/boot/bootloader/stm32/memory.x similarity index 100% rename from embassy-boot/stm32/memory.x rename to examples/boot/bootloader/stm32/memory.x diff --git a/embassy-boot/stm32/src/main.rs b/examples/boot/bootloader/stm32/src/main.rs similarity index 100% rename from embassy-boot/stm32/src/main.rs rename to examples/boot/bootloader/stm32/src/main.rs diff --git a/examples/boot/nrf/Cargo.toml b/examples/boot/nrf/Cargo.toml deleted file mode 100644 index 0a0b76e67..000000000 --- a/examples/boot/nrf/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -edition = "2021" -name = "embassy-boot-nrf-examples" -version = "0.1.0" - -[dependencies] -embassy = { version = "0.1.0", path = "../../../embassy", features = ["nightly"] } -embassy-nrf = { version = "0.1.0", path = "../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly", "nrf52840"] } -embassy-boot-nrf = { version = "0.1.0", path = "../../../embassy-boot/nrf" } -embassy-embedded-hal = { version = "0.1.0", path = "../../../embassy-embedded-hal" } - -defmt = { version = "0.3", optional = true } -defmt-rtt = { version = "0.3", optional = true } -panic-reset = { version = "0.1.1" } -embedded-hal = { version = "0.2.6" } - -cortex-m = "0.7.3" -cortex-m-rt = "0.7.0" diff --git a/examples/boot/stm32f3/Cargo.toml b/examples/boot/stm32f3/Cargo.toml deleted file mode 100644 index 017813691..000000000 --- a/examples/boot/stm32f3/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -edition = "2021" -name = "embassy-boot-stm32f3-examples" -version = "0.1.0" - -[dependencies] -embassy = { version = "0.1.0", path = "../../../embassy", features = ["nightly", "time-tick-32768hz"] } -embassy-stm32 = { version = "0.1.0", path = "../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f303re", "time-driver-any", "exti"] } -embassy-boot-stm32 = { version = "0.1.0", path = "../../../embassy-boot/stm32" } -embassy-embedded-hal = { version = "0.1.0", path = "../../../embassy-embedded-hal" } - -defmt = { version = "0.3", optional = true } -defmt-rtt = { version = "0.3", optional = true } -panic-reset = { version = "0.1.1" } -embedded-hal = { version = "0.2.6" } - -cortex-m = "0.7.3" -cortex-m-rt = "0.7.0" - -[features] -defmt = [ - "dep:defmt", - "embassy-stm32/defmt", - "embassy-boot-stm32/defmt", -] diff --git a/examples/boot/stm32f7/Cargo.toml b/examples/boot/stm32f7/Cargo.toml deleted file mode 100644 index 07aa73892..000000000 --- a/examples/boot/stm32f7/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -edition = "2021" -name = "embassy-boot-stm32f7-examples" -version = "0.1.0" - -[dependencies] -embassy = { version = "0.1.0", path = "../../../embassy", features = ["nightly", "time-tick-32768hz"] } -embassy-stm32 = { version = "0.1.0", path = "../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f767zi", "time-driver-any", "exti"] } -embassy-boot-stm32 = { version = "0.1.0", path = "../../../embassy-boot/stm32" } -embassy-embedded-hal = { version = "0.1.0", path = "../../../embassy-embedded-hal" } - -defmt = { version = "0.3", optional = true } -defmt-rtt = { version = "0.3", optional = true } -panic-reset = { version = "0.1.1" } -embedded-hal = { version = "0.2.6" } - -cortex-m = "0.7.3" -cortex-m-rt = "0.7.0" - -[features] -defmt = [ - "dep:defmt", - "embassy-stm32/defmt", - "embassy-boot-stm32/defmt", -] diff --git a/examples/boot/stm32f7/flash-boot.sh b/examples/boot/stm32f7/flash-boot.sh deleted file mode 100755 index 86074ffa3..000000000 --- a/examples/boot/stm32f7/flash-boot.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -mv ../../../embassy-boot/stm32/memory.x ../../../embassy-boot/stm32/memory-old.x -cp memory-bl.x ../../../embassy-boot/stm32/memory.x - -cargo flash --manifest-path ../../../embassy-boot/stm32/Cargo.toml --release --features embassy-stm32/stm32f767zi --chip STM32F767ZITx --target thumbv7em-none-eabihf - -rm ../../../embassy-boot/stm32/memory.x -mv ../../../embassy-boot/stm32/memory-old.x ../../../embassy-boot/stm32/memory.x diff --git a/examples/boot/stm32h7/Cargo.toml b/examples/boot/stm32h7/Cargo.toml deleted file mode 100644 index d47cb65cc..000000000 --- a/examples/boot/stm32h7/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -edition = "2021" -name = "embassy-boot-stm32f7-examples" -version = "0.1.0" - -[dependencies] -embassy = { version = "0.1.0", path = "../../../embassy", features = ["nightly", "time-tick-32768hz"] } -embassy-stm32 = { version = "0.1.0", path = "../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32h743zi", "time-driver-any", "exti"] } -embassy-boot-stm32 = { version = "0.1.0", path = "../../../embassy-boot/stm32" } -embassy-embedded-hal = { version = "0.1.0", path = "../../../embassy-embedded-hal" } - -defmt = { version = "0.3", optional = true } -defmt-rtt = { version = "0.3", optional = true } -panic-reset = { version = "0.1.1" } -embedded-hal = { version = "0.2.6" } - -cortex-m = "0.7.3" -cortex-m-rt = "0.7.0" - -[features] -defmt = [ - "dep:defmt", - "embassy-stm32/defmt", - "embassy-boot-stm32/defmt", -] diff --git a/examples/boot/stm32h7/flash-boot.sh b/examples/boot/stm32h7/flash-boot.sh deleted file mode 100755 index a910b7312..000000000 --- a/examples/boot/stm32h7/flash-boot.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -mv ../../../embassy-boot/stm32/memory.x ../../../embassy-boot/stm32/memory-old.x -cp memory-bl.x ../../../embassy-boot/stm32/memory.x - -cargo flash --manifest-path ../../../embassy-boot/stm32/Cargo.toml --release --features embassy-stm32/stm32f767zi --chip STM32H743ZITx --target thumbv7em-none-eabihf - -rm ../../../embassy-boot/stm32/memory.x -mv ../../../embassy-boot/stm32/memory-old.x ../../../embassy-boot/stm32/memory.x diff --git a/examples/boot/stm32l0/Cargo.toml b/examples/boot/stm32l0/Cargo.toml deleted file mode 100644 index fbc4fb711..000000000 --- a/examples/boot/stm32l0/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -edition = "2021" -name = "embassy-boot-stm32l0-examples" -version = "0.1.0" - -[dependencies] -embassy = { version = "0.1.0", path = "../../../embassy", features = ["nightly", "time-tick-32768hz"] } -embassy-stm32 = { version = "0.1.0", path = "../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l072cz", "time-driver-any", "exti", "memory-x"] } -embassy-boot-stm32 = { version = "0.1.0", path = "../../../embassy-boot/stm32" } -embassy-embedded-hal = { version = "0.1.0", path = "../../../embassy-embedded-hal" } - -defmt = { version = "0.3", optional = true } -defmt-rtt = { version = "0.3", optional = true } -panic-reset = { version = "0.1.1" } -embedded-hal = { version = "0.2.6" } - -cortex-m = "0.7.3" -cortex-m-rt = "0.7.0" - -[features] -defmt = [ - "dep:defmt", - "embassy-stm32/defmt", - "embassy-boot-stm32/defmt", -] diff --git a/examples/boot/stm32l1/Cargo.toml b/examples/boot/stm32l1/Cargo.toml deleted file mode 100644 index f3f05f611..000000000 --- a/examples/boot/stm32l1/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -edition = "2021" -name = "embassy-boot-stm32l1-examples" -version = "0.1.0" - -[dependencies] -embassy = { version = "0.1.0", path = "../../../embassy", features = ["nightly", "time-tick-32768hz"] } -embassy-stm32 = { version = "0.1.0", path = "../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l151cb-a", "time-driver-any", "exti"] } -embassy-boot-stm32 = { version = "0.1.0", path = "../../../embassy-boot/stm32" } -embassy-embedded-hal = { version = "0.1.0", path = "../../../embassy-embedded-hal" } - -defmt = { version = "0.3", optional = true } -defmt-rtt = { version = "0.3", optional = true } -panic-reset = { version = "0.1.1" } -embedded-hal = { version = "0.2.6" } - -cortex-m = "0.7.3" -cortex-m-rt = "0.7.0" - -[features] -defmt = [ - "dep:defmt", - "embassy-stm32/defmt", - "embassy-boot-stm32/defmt", -] diff --git a/examples/boot/stm32l4/Cargo.toml b/examples/boot/stm32l4/Cargo.toml deleted file mode 100644 index 1b7b2202f..000000000 --- a/examples/boot/stm32l4/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -edition = "2021" -name = "embassy-boot-stm32l4-examples" -version = "0.1.0" - -[dependencies] -embassy = { version = "0.1.0", path = "../../../embassy", features = ["nightly", "time-tick-32768hz"] } -embassy-stm32 = { version = "0.1.0", path = "../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l475vg", "time-driver-any", "exti"] } -embassy-boot-stm32 = { version = "0.1.0", path = "../../../embassy-boot/stm32" } -embassy-embedded-hal = { version = "0.1.0", path = "../../../embassy-embedded-hal" } - -defmt = { version = "0.3", optional = true } -defmt-rtt = { version = "0.3", optional = true } -panic-reset = { version = "0.1.1" } -embedded-hal = { version = "0.2.6" } - -cortex-m = "0.7.3" -cortex-m-rt = "0.7.0" - -[features] -defmt = [ - "dep:defmt", - "embassy-stm32/defmt", - "embassy-boot-stm32/defmt", -] diff --git a/examples/boot/stm32wl/Cargo.toml b/examples/boot/stm32wl/Cargo.toml deleted file mode 100644 index 1bd69ae42..000000000 --- a/examples/boot/stm32wl/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -edition = "2021" -name = "embassy-boot-stm32wl-examples" -version = "0.1.0" - -[dependencies] -embassy = { version = "0.1.0", path = "../../../embassy", features = ["nightly", "time-tick-32768hz"] } -embassy-stm32 = { version = "0.1.0", path = "../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32wl55jc-cm4", "time-driver-any", "exti"] } -embassy-boot-stm32 = { version = "0.1.0", path = "../../../embassy-boot/stm32" } -embassy-embedded-hal = { version = "0.1.0", path = "../../../embassy-embedded-hal" } - -defmt = { version = "0.3", optional = true } -defmt-rtt = { version = "0.3", optional = true } -panic-reset = { version = "0.1.1" } -embedded-hal = { version = "0.2.6" } - -cortex-m = "0.7.3" -cortex-m-rt = "0.7.0" - -[features] -defmt = [ - "dep:defmt", - "embassy-stm32/defmt", - "embassy-boot-stm32/defmt", -]