d20456a39ce933dae3917549f94cbd87fcb94072
UTAT Firmware Development Environment
My firmware development environment for the University of Toronto Aerospace Team
https://docs.zephyrproject.org/latest/develop/getting_started/index.html
west init zephyrproject
cd zepyhrproject
west update
west zephyr-export
cd zepyhr
west sdk install
west build -p always -b nucleo_g431rb samples/basic/blinky
west flash --runner pyocd # had to su root first to run this (after running nix develop)
# MCUBoot
cd ~/utat-dev/zephyrproject
# Configure the DTS for partition sizes: https://docs.zephyrproject.org/latest/build/dts/intro-scope-purpose.html
# https://docs.zephyrproject.org/latest/build/dts/api/bindings/mtd/fixed-partitions.html
nvim "zephyr/boards/st/nucleo_g431rb/nucleo_g431rb.dts"
# Create a private key: https://docs.mcuboot.com/readme-zephyr.html
./scripts/imgtool.py keygen -k mykey.pem -t rsa-2048
# Create its public key
openssl rsa -in mykey.pem -pubout > pubkey.pem
# Set up signing: https://docs.mcuboot.com/readme-zephyr.html
# ./bootloader/mcuboot/samples/zephyr/Makefile
python scripts/imgtool.py sign \
--key mykey.pem \
--header-size 0x200 \
--align 8 \
--version 1.2 \
--slot-size 0x8000 \
./
# Add the key file path to the KConfig https://docs.zephyrproject.org/latest/build/kconfig/setting.html
echo "
# Set the key file
CONFIG_BOOT_SIGNATURE_KEY_FILE=pubkey.pem" >> "./zephyr/boards/st/nucleo_g431rb/nucleo_g431rb_defconfig"
west build -p always -b nucleo_g431rb bootloader/mcuboot/boot/zephyr -d build/mcuboot -- -DEXTRA_CONF_FILE=mcuboot-nucleo-g431rb.conf
west flash -d build/mcuboot --runner pyocd # (as root, with nix develop)
cd zephyr
# Package 1
west build -p always -b nucleo_g431rb samples/basic/blinky -d build/app -- -DCONFIG_BOOTLOADER_MCUBOOT=y -DCONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=y
west flash -d build/app --runner pyocd # (as root, with nix develop)
# Package 2
west build -p always -b nucleo_g431rb samples/basic/blinkyslow -d build/blinkyslow -- -DCONFIG_BOOTLOADER_MCUBOOT=y -DCONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=y
pyocd flash --target stm32g431rbtx --base-address 0x08014800 build/blinkyslow/zephyr/zephyr.signed.hex
Description
Implementation guide for the MCUboot bootloader for the University of Toronto Aerospace Team
3.2 MiB
Languages
CMake
97.1%
Makefile
2.2%
Nix
0.7%