nihalpasham / rustBoot

rustBoot is a standalone bootloader written entirely in `Rust`, designed to run on anything from a microcontroller to a system on chip. It can be used to boot into bare-metal firmware or Linux.
MIT License
214 stars 21 forks source link

Rust signing tool support was added #43

Closed yashwanthsinghm closed 2 years ago

yashwanthsinghm commented 2 years ago

Rust signing support added for stm32f411 , stm32f446 , stm32f723 , stm32h746 , stm32f334 , nrf52840.

nihalpasham commented 2 years ago

a couple of points:

yashwanthsinghm commented 2 years ago

1)variable names were changed to meaning full in rbsiger/main.rs line number 75,76,81. 2)All the bin files were moved to signed_images folder. 3) rbSigner was renamed to sign_images

Single command to build sign and flash : cargo [board] build-sign-flash rustBoot

yashwanthsingh@Yashwanths-MBP rustBoot % cargo stm32f411 build-sign-flash rustBoot
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/xtask stm32f411 build-sign-flash rustBoot`
$ cargo build --release
warning: unused config key `build.runner` in `/Users/yashwanthsingh/Yash/Projects/git_rustBoot_yash/rustBoot/boards/firmware/stm32f411/boot_fw_blinky_green/.cargo/config.toml`
    Finished release [optimized] target(s) in 0.08s
$ cargo build --release
warning: unused config key `build.runner` in `/Users/yashwanthsingh/Yash/Projects/git_rustBoot_yash/rustBoot/boards/firmware/stm32f411/updt_fw_blinky_red/.cargo/config.toml`
    Finished release [optimized] target(s) in 0.08s
$ cargo build --release
    Finished release [optimized] target(s) in 0.07s
$ rust-objcopy ../boards/target/thumbv7em-none-eabihf/release/stm32f411_bootfw -O binary ../boards/sign_images/signed_images/stm32f411_bootfw.bin
$ rust-objcopy ../boards/target/thumbv7em-none-eabihf/release/stm32f411_updtfw -O binary ../boards/sign_images/signed_images/stm32f411_updtfw.bin
$ cargo run mcu-image ../boards/sign_images/signed_images/stm32f411_bootfw.bin ../boards/sign_images/keygen/ecc256.der nistp256
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `/Users/yashwanthsingh/Yash/Projects/git_rustBoot_yash/rustBoot/target/debug/rbsigner mcu-image ../boards/sign_images/signed_images/stm32f411_bootfw.bin ../boards/sign_images/keygen/ecc256.der nistp256`
stm32f411_bootfw_v1234_signed.bin
bytes_written: 1908
$ cargo run mcu-image ../boards/sign_images/signed_images/stm32f411_updtfw.bin ../boards/sign_images/keygen/ecc256.der nistp256
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `/Users/yashwanthsingh/Yash/Projects/git_rustBoot_yash/rustBoot/target/debug/rbsigner mcu-image ../boards/sign_images/signed_images/stm32f411_updtfw.bin ../boards/sign_images/keygen/ecc256.der nistp256`
bytes_written: 1996
$ probe-rs-cli erase --chip stm32f411vetx
$ probe-rs-cli download --format Bin --base-address 0x8020000 --chip stm32f411vetx stm32f411_bootfw_v1234_signed.bin
     Erasing sectors ✔ [00:00:01] [#############################] 128.00KiB/128.00KiB @ 64.94KiB/s (eta 0s )
 Programming pages   ✔ [00:00:00] [###############################]  2.00KiB/ 2.00KiB @     677B/s (eta 0s )
    Finished in 2.056s
$ probe-rs-cli download --format Bin --base-address 0x8040000 --chip stm32f411vetx stm32f411_updtfw_v1235_signed.bin
     Erasing sectors ✔ [00:00:01] [#############################] 128.00KiB/128.00KiB @ 65.37KiB/s (eta 0s )
 Programming pages   ✔ [00:00:00] [###############################]  2.00KiB/ 2.00KiB @     680B/s (eta 0s )
    Finished in 2.049s
$ cargo flash --chip stm32f411vetx --release
    Finished release [optimized] target(s) in 0.09s
    Flashing /Users/yashwanthsingh/Yash/Projects/git_rustBoot_yash/rustBoot/boards/target/thumbv7em-none-eabihf/release/stm32f411
     Erasing sectors ✔ [00:00:01] [###############################] 48.00KiB/48.00KiB @ 40.76KiB/s (eta 0s )
 Programming pages   ✔ [00:00:01] [###############################] 43.00KiB/43.00KiB @ 17.54KiB/s (eta 0s )
    Finished in 2.211s
yashwanthsingh@Yashwanths-MBP rustBoot % 
nihalpasham commented 2 years ago

@yashwanthsinghm - close this. Lets build on top of #44

yashwanthsinghm commented 2 years ago

@nihalpasham okay i'm closing this.