From 82fa02bcac5e278586cb2e3c9cc597699f6f640d Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 5 Apr 2025 11:10:12 +0200 Subject: fw: btl: Configure bootloader build with Meson CMake ExternalProject creates a pretty confusing build tree. Since the rest of the project anyway starts moving to Meson the bootloader is configured via Meson as a first step. --- fw/btl/configure.sh | 14 ++++++++++++++ fw/btl/meson.build | 16 ++++++++++++++++ fw/meson.build | 7 +++++++ fw/rtos/meson.build | 3 +++ fw/rtos/modules/meson.build | 8 ++++++++ meson.build | 1 + 6 files changed, 49 insertions(+) create mode 100755 fw/btl/configure.sh create mode 100644 fw/btl/meson.build create mode 100644 fw/meson.build create mode 100644 fw/rtos/meson.build create mode 100644 fw/rtos/modules/meson.build diff --git a/fw/btl/configure.sh b/fw/btl/configure.sh new file mode 100755 index 0000000..87df3d2 --- /dev/null +++ b/fw/btl/configure.sh @@ -0,0 +1,14 @@ +#!/bin/sh + + +set -eufx + + +cmake \ + "-S$1" \ + "-B$2" \ + "-DBOARD=$3" \ + "-DZEPHYR_BASE=$4" \ + "-DZEPHYR_MODULES=${5}" \ + "-DEXTRA_CONF_FILE=${6}" \ + "-DCONFIG_BOOT_SIGNATURE_KEY_FILE=\"${7}\"" diff --git a/fw/btl/meson.build b/fw/btl/meson.build new file mode 100644 index 0000000..fd6562e --- /dev/null +++ b/fw/btl/meson.build @@ -0,0 +1,16 @@ +bootloader_config = meson.current_source_dir() / 'bootloader.conf' + +external_project = import('unstable-external_project') +bootloader_bin = meson.current_build_dir() / 'zephyr' / 'zephyr.bin' +bootloader_project = external_project.add_project('configure.sh', + configure_options: [ + bootloader_firmware, + meson.current_build_dir(), + board, + zephyr, + ';'.join(zephyr_modules), + bootloader_config, + signing_key, + ], + verbose: true, +) diff --git a/fw/meson.build b/fw/meson.build new file mode 100644 index 0000000..7f9bead --- /dev/null +++ b/fw/meson.build @@ -0,0 +1,7 @@ +board = 'nucleo_f767zi' + +fs = import('fs') +signing_key = fs.expanduser('~') / 'mcuboot' / 'key.pem' + +subdir('rtos') +subdir('btl') diff --git a/fw/rtos/meson.build b/fw/rtos/meson.build new file mode 100644 index 0000000..800153d --- /dev/null +++ b/fw/rtos/meson.build @@ -0,0 +1,3 @@ +subdir('modules') + +zephyr = meson.current_source_dir() / 'zephyr' diff --git a/fw/rtos/modules/meson.build b/fw/rtos/modules/meson.build new file mode 100644 index 0000000..52f50c2 --- /dev/null +++ b/fw/rtos/modules/meson.build @@ -0,0 +1,8 @@ +zephyr_modules = [ + meson.current_source_dir() / 'cmsis', + meson.current_source_dir() / 'hal_stm32', + meson.current_source_dir() / 'mbedtls', + meson.current_source_dir() / 'mcuboot', +] + +bootloader_firmware = meson.current_source_dir() / 'mcuboot' / 'boot' / 'zephyr' diff --git a/meson.build b/meson.build index 73206f4..9205388 100644 --- a/meson.build +++ b/meson.build @@ -8,5 +8,6 @@ css = fs.copyfile( install_dir: 'website/static', ) +subdir('fw') subdir('pcb') subdir('web') -- cgit v1.2.3-70-g09d2