$ mkdir -p $HOME/zephyrproject/
$ cd $HOME/zephyrproject/
$ git clone https://github.com/LexxPluss/LexxHard-MainBoard-Firmware
$ export ZEPHYR_BASE=/workdir/LexxHard-MainBoard-Firmware/zephyr
$ cd /workdir/LexxHard-MainBoard-Firmware
$ make setup
$ make bootloader
$ make firmware
$ make firmware_initial
$ make firmware_interlock
$ make firmware_tug
Prepare a development environment referring to https://docs.zephyrproject.org/2.7.0/getting_started/
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install cmake ninja gperf python3 ccache qemu dtc
$ pip3 install -U west
$ west init -l lexxpluss_apps
$ west update
$ west zephyr-export
$ pip3 install -r zephyr/scripts/requirements.txt
Install Toolchain and set environment variables referring to https://docs.zephyrproject.org/2.7.0/getting_started/toolchain_3rd_party_x_compilers.html
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
export GNUARMEMB_TOOLCHAIN_PATH=/Applications/ARM
$ west build -b lexxpluss_mb02 bootloader/mcuboot/boot/zephyr -d build-mcuboot
$ west build -p auto -b lexxpluss_mb02 lexxpluss_apps
$ west build -p auto -b lexxpluss_mb02 lexxpluss_apps -- -DENABLE_INTERLOCK=1
$ west build -p auto -b lexxpluss_mb02 lexxpluss_apps -- -DENABLE_TUG=1
Program the bootloader and signed firmware after erasing the entire Flash ROM. Output binaries are in following output directories.
- :
out
- :
out
- :
build-mcuboot/zephyr
- :
build/zephyr
$ brew install stlink
$ st-flash --reset --connect-under-reset erase
$ st-flash --reset --connect-under-reset write <bootloader output dir>/zephyr.bin 0x8000000
$ st-flash --reset --connect-under-reset write <firmware output dir>/zephyr.signed.bin 0x8040000
Program the firmware for update to the update area.
$ st-flash --reset --connect-under-reset write <firmware output dir>/zephyr.signed.confirmed.bin 0x8080000
$ st-flash --reset --connect-under-reset erase
$ st-flash --reset --connect-under-reset write LexxHard-MainBoard-Firmware-Initial-v?.?.? 0x8000000
Use LexxPluss/LexxHard-MainBoard-Updator.
The firmware is automatically updated when the robot is turned on again after executing the following command.
$ rosrun mainboard_updator mainboard_updator LexxHard-MainBoard-Firmware-Update-v?.?.?.bin
Copyright (c) 2022, LexxPluss Inc. Released under the BSD License.