summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-04-06 20:02:56 +0200
committerxengineering <me@xengineering.eu>2025-04-06 20:02:56 +0200
commitee1dea051b0a43c02cf56dfc6a812c1a32910bc6 (patch)
tree6f555191efc74f7ada207990a233466e953175b8
parentd19fc7e34f783b343e77b757c4f37aaadb5b66ca (diff)
parentda27d61588202d6b460e36d29a8789d206495bd6 (diff)
downloadiot-contact-ee1dea051b0a43c02cf56dfc6a812c1a32910bc6.tar
iot-contact-ee1dea051b0a43c02cf56dfc6a812c1a32910bc6.tar.zst
iot-contact-ee1dea051b0a43c02cf56dfc6a812c1a32910bc6.zip
Merge website and CMake to Meson transition
Building a website to structure and deploy the artifacts was planned and requires a well set-up build system to handle all the file paths targets and dependencies. Since multiple CMake Zephyr builds are required for the application firmware, bootloader firmware and the native_sim application firmware simulation CMake external project was used. Since this generates a build tree with a confusing structure Meson was evaluated. Finally the Meson build system was a good fit as top-level build system and allows external projects as an experimental feature if they can configure a Make-based build system which is given for Zephyr.
-rw-r--r--.gitignore1
-rw-r--r--.gitmodules3
-rw-r--r--CMakeLists.txt9
-rw-r--r--README.md53
-rw-r--r--cmake/hugo.cmake21
-rw-r--r--cmake/kicad.cmake50
l---------compile_commands.json1
-rw-r--r--fw/CMakeLists.txt37
-rw-r--r--fw/README.md6
-rw-r--r--fw/app/meson.build45
-rw-r--r--fw/btl/meson.build28
-rw-r--r--fw/meson.build9
-rwxr-xr-xfw/nucleo.sh38
-rw-r--r--fw/rtos/CMakeLists.txt16
-rw-r--r--fw/rtos/meson.build3
-rw-r--r--fw/rtos/modules/meson.build10
-rw-r--r--fw/sim/meson.build27
-rw-r--r--meson.build15
-rw-r--r--pcb/CMakeLists.txt21
-rw-r--r--pcb/meson.build42
m---------simple.css0
-rw-r--r--tools/LICENSE.txt (renamed from cmake/LICENSE.txt)0
-rwxr-xr-xtools/build_zephyr.py48
-rwxr-xr-xtools/configure_zephyr.py52
-rw-r--r--tools/meson.build2
-rw-r--r--web/CMakeLists.txt9
-rw-r--r--web/layouts/baseof.html1
-rw-r--r--web/layouts/home.html10
-rw-r--r--web/meson.build22
29 files changed, 334 insertions, 245 deletions
diff --git a/.gitignore b/.gitignore
index 60fd437..14f1e78 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.cache
build
log.txt
+compile_commands.json
diff --git a/.gitmodules b/.gitmodules
index 755d4f6..8fcd4bb 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -13,3 +13,6 @@
[submodule "fw/zephyrproject/bootloader/mcuboot"]
path = fw/rtos/modules/mcuboot
url = https://github.com/zephyrproject-rtos/mcuboot.git
+[submodule "simple.css"]
+ path = simple.css
+ url = https://github.com/kevquirk/simple.css.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 90eac62..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-
-project(iot-contact LANGUAGES NONE)
-
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
-
-add_subdirectory(fw)
-add_subdirectory(pcb)
-add_subdirectory(web)
diff --git a/README.md b/README.md
index 8b39597..7e794bf 100644
--- a/README.md
+++ b/README.md
@@ -3,61 +3,40 @@
iot-contact is an IoT device to check if doors and windows are closed or open.
Furthermore roller shutter motors should be controlled.
-Currently two boards are supported:
-
-- `native_sim/native/64` without bootloader
-- `nucleo_f767zi` with bootloader
-
## Usage
-To build the device repository a firmware signing key is required. It is
-generated with the `imgtool.py`.
-
-```
-mkdir ~/mcuboot
-./imgtool.py keygen --key ~/mcuboot/key.pem --type ed25519
-```
-
-The content of this repository can be build with CMake and Ninja. The
-application firmware will be built for the simulation board to easily use it
-without special hardware.
-
-The bootloader is built for `nucleo_f767zi` since the simulation board is
-currently not supported.
+The source code can be retrieved with `git`.
```
-cmake -Bbuild -GNinja
-ninja -C build
+git clone https://cgit.xengineering.eu/iot-contact
+cd iot-contact
+git submodule update --init
```
-A custom key location can be set by providing `-DKEY=/path/to/key` to the CMake
-call.
-
-To run the simulated firmware a virtual network interface `zeth` and a router
-advertisement daemon have to be provided with an embedded script. Root rights
-are required for that (prefix e.g. with `sudo`).
+To sign the application firmware and thus to build the project a cryptographic
+signing key is required. It can be generated with `imgtool.py`.
```
-./fw/simulate-network.sh
+mkdir ~/mcuboot
+./imgtool.py keygen --key ~/mcuboot/key.pem --type ed25519
```
-With the firmware built and the network being prepared the simulated firmware
-can be run.
+The project is built with the Meson build system.
```
-./build/fw/app/zephyr/zephyr.exe
+meson setup build
+meson compile -C build
+meson install -C build --destdir artifacts
```
-To build the firmware in a clean `nucleo` build folder, flash it and open a
-serial interface another script can be used for convenience.
+The resulting artifacts can be listed with `tree`.
```
-./fw/nucleo.sh
+tree build/artifacts
```
-Next to the firmware artifacts the exported files related to the printed
-circuit board (PCB) can be found in the build folder.
+These artifacts are organized as static website. It can be opened with Firefox.
```
-tree build/pcb
+find build/artifacts -name 'index.html' -exec firefox {} \;
```
diff --git a/cmake/hugo.cmake b/cmake/hugo.cmake
deleted file mode 100644
index e065f8b..0000000
--- a/cmake/hugo.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at https://mozilla.org/MPL/2.0/.
-
-function(hugo_site target source sink)
- add_custom_target(
- "${target}"
- ALL
- DEPENDS
- ${sink}
- )
-
- add_custom_command(
- OUTPUT
- ${sink}
- COMMAND
- hugo --source ${source} --destination ${sink}
- DEPENDS
- ${source}
- )
-endfunction()
diff --git a/cmake/kicad.cmake b/cmake/kicad.cmake
deleted file mode 100644
index 0feac80..0000000
--- a/cmake/kicad.cmake
+++ /dev/null
@@ -1,50 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at https://mozilla.org/MPL/2.0/.
-
-function(kicad_schematic_pdf target sink source)
- add_custom_target(
- "${target}"
- ALL
- DEPENDS
- ${sink}
- )
-
- add_custom_command(
- OUTPUT
- ${sink}
- COMMAND
- kicad-cli sch export pdf --output ${sink} ${source}
- COMMAND
- echo "Exported schematic: ${sink}"
- DEPENDS
- ${source}
- JOB_POOL
- kicad
- )
-endfunction()
-
-function(kicad_bom_csv target sink source)
- add_custom_target(
- "${target}"
- ALL
- DEPENDS
- ${sink}
- )
-
- add_custom_command(
- OUTPUT
- ${sink}
- COMMAND
- kicad-cli sch export bom
- --fields 'Reference,Description,Value,Footprint,Manufacturer,MPN,Datasheet'
- --output ${sink}
- ${source}
- COMMAND
- echo "Exported BOM: ${sink}"
- DEPENDS
- ${source}
- JOB_POOL
- kicad
- )
-endfunction()
diff --git a/compile_commands.json b/compile_commands.json
deleted file mode 120000
index 25eb4b2..0000000
--- a/compile_commands.json
+++ /dev/null
@@ -1 +0,0 @@
-build/compile_commands.json \ No newline at end of file
diff --git a/fw/CMakeLists.txt b/fw/CMakeLists.txt
deleted file mode 100644
index 2affe92..0000000
--- a/fw/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public License,
-# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/.
-
-cmake_minimum_required(VERSION 3.20.0)
-
-include(ExternalProject)
-
-set(KEY_DEFAULT "$ENV{HOME}/mcuboot/key.pem")
-set(KEY ${KEY_DEFAULT} CACHE STRING "Firmware signing key path")
-message(STATUS "Firmware signing key path: ${KEY}")
-
-set(BOARD_DEFAULT "native_sim/native/64")
-set(BOARD ${BOARD_DEFAULT} CACHE STRING "Zephyr board identifier")
-message(STATUS "Selected board: ${BOARD}")
-
-add_subdirectory(rtos)
-string(REPLACE ";" "," ZEPHYR_MODULES_COMMA "${ZEPHYR_MODULES}")
-
-if(BOARD STREQUAL "nucleo_f767zi")
- ExternalProject_Add(
- btl
- PREFIX btl
- SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rtos/modules/mcuboot/boot/zephyr"
- BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/btl"
- INSTALL_COMMAND ""
- LIST_SEPARATOR ","
- CMAKE_ARGS
- "-DBOARD=${BOARD}"
- "-DZEPHYR_BASE=${ZEPHYR_BASE}"
- "-DZEPHYR_MODULES=${ZEPHYR_MODULES_COMMA}"
- "-DEXTRA_CONF_FILE=${CMAKE_CURRENT_SOURCE_DIR}/btl/bootloader.conf"
- -DCONFIG_BOOT_SIGNATURE_KEY_FILE="${KEY}"
- )
-endif()
-
-add_subdirectory(app)
diff --git a/fw/README.md b/fw/README.md
deleted file mode 100644
index 9883b2d..0000000
--- a/fw/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# iot-contact Firmware
-
-This is the firmware for iot-contact. It is based on the Zephyr real time
-operating system [1].
-
-[1]: https://zephyrproject.org
diff --git a/fw/app/meson.build b/fw/app/meson.build
new file mode 100644
index 0000000..97c17f1
--- /dev/null
+++ b/fw/app/meson.build
@@ -0,0 +1,45 @@
+external_project = import('unstable-external_project')
+
+application_source = meson.current_source_dir()
+
+external_project.add_project(
+ configure_zephyr,
+ configure_options: [
+ '--source-tree', application_source,
+ '--build-tree', meson.current_build_dir() / 'build',
+ '--board', board,
+ '--zephyr-base', zephyr,
+ '--zephyr-modules', ';'.join(zephyr_modules),
+ ],
+ verbose: true,
+)
+
+application = custom_target(
+ 'application',
+ output: ['application.bin'],
+ command: [
+ build_zephyr,
+ '--build-tree', meson.current_build_dir() / 'build',
+ '--binary-name', 'zephyr.bin',
+ '--target-name', 'application.bin',
+ ],
+)
+
+application_signed = custom_target(
+ 'application_signed',
+ output: ['application.signed.bin'],
+ command: [
+ imgtool,
+ 'sign',
+ '--version', '0.0.0',
+ '--header-size', '0x200',
+ '--slot-size', '0xc0000',
+ '--key', signing_key,
+ meson.current_build_dir() / 'application.bin',
+ meson.current_build_dir() / 'application.signed.bin',
+ ],
+ build_by_default: true,
+ depends: application,
+ install: true,
+ install_dir: 'website/static',
+)
diff --git a/fw/btl/meson.build b/fw/btl/meson.build
new file mode 100644
index 0000000..4d80a58
--- /dev/null
+++ b/fw/btl/meson.build
@@ -0,0 +1,28 @@
+external_project = import('unstable-external_project')
+
+external_project.add_project(
+ configure_zephyr,
+ configure_options: [
+ '--source-tree', bootloader_firmware,
+ '--build-tree', meson.current_build_dir() / 'build',
+ '--board', board,
+ '--zephyr-base', zephyr,
+ '--zephyr-modules', ';'.join(zephyr_modules),
+ '--extra-config', meson.current_source_dir() / 'bootloader.conf',
+ '--signing-key', signing_key,
+ ],
+ verbose: true,
+)
+
+bootloader = custom_target('bootloader',
+ output: ['bootloader.bin'],
+ command: [
+ build_zephyr,
+ '--build-tree', meson.current_build_dir() / 'build',
+ '--binary-name', 'zephyr.bin',
+ '--target-name', 'bootloader.bin',
+ ],
+ build_by_default: true,
+ install: true,
+ install_dir: 'website/static',
+)
diff --git a/fw/meson.build b/fw/meson.build
new file mode 100644
index 0000000..8194827
--- /dev/null
+++ b/fw/meson.build
@@ -0,0 +1,9 @@
+board = 'nucleo_f767zi'
+
+fs = import('fs')
+signing_key = fs.expanduser('~') / 'mcuboot' / 'key.pem'
+
+subdir('rtos')
+subdir('app')
+subdir('btl')
+subdir('sim')
diff --git a/fw/nucleo.sh b/fw/nucleo.sh
deleted file mode 100755
index ad0467b..0000000
--- a/fw/nucleo.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-
-# This Source Code Form is subject to the terms of the Mozilla Public License,
-# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/.
-
-
-set -euf
-
-
-SCRIPT="$(realpath "$0")"
-FW="$(dirname "$SCRIPT")"
-ROOT="$(dirname "$FW")"
-BUILD="${ROOT}/build"
-BOOTLOADER_FIRMWARE="${BUILD}/fw/btl/zephyr/zephyr.bin"
-APPLICATION_FIRMWARE="${BUILD}/fw/app/zephyr/zephyr.bin"
-APPLICATION_FIRMWARE_SIGNED="${BUILD}/fw/app/zephyr/zephyr.signed.bin"
-BOOTLOADER_FLASH_ADDRESS='0x8000000'
-APPLICATION_FLASH_ADDRESS='0x8040000'
-IMGTOOL="${ROOT}/imgtool.py"
-KEY="${HOME}/mcuboot/key.pem"
-BOARD='nucleo_f767zi'
-
-
-set -x
-
-python "$IMGTOOL" sign \
- --version 0.0.0 \
- --header-size 0x200 \
- --slot-size 0xc0000 \
- --key "$KEY" \
- "$APPLICATION_FIRMWARE" \
- "$APPLICATION_FIRMWARE_SIGNED"
-st-flash --connect-under-reset write "$BOOTLOADER_FIRMWARE" \
- "$BOOTLOADER_FLASH_ADDRESS"
-st-flash --connect-under-reset write "$APPLICATION_FIRMWARE_SIGNED" \
- "$APPLICATION_FLASH_ADDRESS"
diff --git a/fw/rtos/CMakeLists.txt b/fw/rtos/CMakeLists.txt
deleted file mode 100644
index d9f116c..0000000
--- a/fw/rtos/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public License,
-# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/.
-
-set(ZEPHYR_MODULES
- "${CMAKE_CURRENT_SOURCE_DIR}/modules/cmsis"
- "${CMAKE_CURRENT_SOURCE_DIR}/modules/hal_stm32"
- "${CMAKE_CURRENT_SOURCE_DIR}/modules/mbedtls"
- "${CMAKE_CURRENT_SOURCE_DIR}/modules/mcuboot"
- PARENT_SCOPE
-)
-
-set(ZEPHYR_BASE
- "${CMAKE_CURRENT_SOURCE_DIR}/zephyr"
- PARENT_SCOPE
-)
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..14b14f5
--- /dev/null
+++ b/fw/rtos/modules/meson.build
@@ -0,0 +1,10 @@
+zephyr_modules = [
+ meson.current_source_dir() / 'cmsis',
+ meson.current_source_dir() / 'hal_stm32',
+ meson.current_source_dir() / 'mbedtls',
+ meson.current_source_dir() / 'mcuboot',
+]
+
+mcuboot = meson.current_source_dir() / 'mcuboot'
+bootloader_firmware = mcuboot / 'boot' / 'zephyr'
+imgtool = mcuboot / 'scripts' / 'imgtool.py'
diff --git a/fw/sim/meson.build b/fw/sim/meson.build
new file mode 100644
index 0000000..a4dcb8a
--- /dev/null
+++ b/fw/sim/meson.build
@@ -0,0 +1,27 @@
+external_project = import('unstable-external_project')
+
+external_project.add_project(
+ configure_zephyr,
+ configure_options: [
+ '--source-tree', application_source,
+ '--build-tree', meson.current_build_dir() / 'build',
+ '--board', 'native_sim/native/64',
+ '--zephyr-base', zephyr,
+ '--zephyr-modules', ';'.join(zephyr_modules),
+ ],
+ verbose: true,
+)
+
+simulation = custom_target(
+ 'simulation',
+ output: ['simulation-linux-amd64.exe'],
+ command: [
+ build_zephyr,
+ '--build-tree', meson.current_build_dir() / 'build',
+ '--binary-name', 'zephyr.exe',
+ '--target-name', 'simulation-linux-amd64.exe',
+ ],
+ build_by_default: true,
+ install: true,
+ install_dir: 'website/static',
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..85faf87
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,15 @@
+project('iot-contact')
+
+subdir('tools')
+
+fs = import('fs')
+css = fs.copyfile(
+ meson.current_source_dir() / 'simple.css' / 'simple.css',
+ 'simple.css',
+ install: true,
+ install_dir: 'website/static',
+)
+
+subdir('fw')
+subdir('pcb')
+subdir('web')
diff --git a/pcb/CMakeLists.txt b/pcb/CMakeLists.txt
deleted file mode 100644
index 8d2c49a..0000000
--- a/pcb/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-
-project(iot-contact-pcb LANGUAGES NONE)
-
-include(kicad)
-
-set_property(GLOBAL PROPERTY JOB_POOLS kicad=1)
-
-set(schematic "${CMAKE_CURRENT_SOURCE_DIR}/iot-contact.kicad_sch")
-
-kicad_schematic_pdf(
- "schematic"
- "${CMAKE_CURRENT_BINARY_DIR}/schematic.pdf"
- "${schematic}"
-)
-
-kicad_bom_csv(
- "bom"
- "${CMAKE_CURRENT_BINARY_DIR}/bom.csv"
- "${schematic}"
-)
diff --git a/pcb/meson.build b/pcb/meson.build
new file mode 100644
index 0000000..7f8b85f
--- /dev/null
+++ b/pcb/meson.build
@@ -0,0 +1,42 @@
+schematic_files = [
+ 'iot-contact.kicad_sch',
+ 'contacts.kicad_sch',
+ 'ethernet.kicad_sch',
+ 'io.kicad_sch',
+ 'power.kicad_sch',
+ 'processor.kicad_sch',
+]
+
+schematic = custom_target('schematic',
+ output: ['schematic.pdf'],
+ command: [
+ 'kicad-cli',
+ 'sch',
+ 'export',
+ 'pdf',
+ '--output', meson.current_build_dir() / 'schematic.pdf',
+ meson.current_source_dir() / 'iot-contact.kicad_sch',
+ ],
+ depend_files: schematic_files,
+ build_by_default: true,
+ install: true,
+ install_dir: 'website/static',
+)
+
+bom = custom_target('bom',
+ output: ['bill-of-materials.csv'],
+ command: [
+ 'kicad-cli',
+ 'sch',
+ 'export',
+ 'bom',
+ '--fields',
+ 'Reference,Description,Value,Footprint,Manufacturer,MPN,Datasheet',
+ '--output', meson.current_build_dir() / 'bill-of-materials.csv',
+ meson.current_source_dir() / 'iot-contact.kicad_sch',
+ ],
+ depend_files: schematic_files,
+ build_by_default: true,
+ install: true,
+ install_dir: 'website/static',
+)
diff --git a/simple.css b/simple.css
new file mode 160000
+Subproject 9f62bf3630812239712693886af032311c2dfa3
diff --git a/cmake/LICENSE.txt b/tools/LICENSE.txt
index d0a1fa1..d0a1fa1 100644
--- a/cmake/LICENSE.txt
+++ b/tools/LICENSE.txt
diff --git a/tools/build_zephyr.py b/tools/build_zephyr.py
new file mode 100755
index 0000000..1d9e783
--- /dev/null
+++ b/tools/build_zephyr.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+
+
+# This Source Code Form is subject to the terms of the Mozilla Public License,
+# v. 2.0. If a copy of the MPL was not distributed with this file, You can
+# obtain one at https://mozilla.org/MPL/2.0/.
+
+
+import argparse
+import multiprocessing
+import shutil
+import subprocess
+import pathlib
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser(
+ description="Build a Zephyr GNU Make build",
+ )
+
+ parser.add_argument("-B", "--build-tree", required=True)
+ parser.add_argument("-b", "--binary-name", required=True)
+ parser.add_argument("-n", "--target-name", required=True)
+
+ args = parser.parse_args()
+
+ build_tree = pathlib.Path(args.build_tree)
+ output_dir = build_tree.parent
+
+ subprocess.run(
+ [
+ "make",
+ f"-j{multiprocessing.cpu_count()}",
+ "-C",
+ f"{str(build_tree)}",
+ ],
+ shell=False,
+ check=True,
+ )
+
+ shutil.copy(
+ build_tree / "zephyr" / args.binary_name,
+ output_dir / args.target_name
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/configure_zephyr.py b/tools/configure_zephyr.py
new file mode 100755
index 0000000..e709063
--- /dev/null
+++ b/tools/configure_zephyr.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+
+
+# This Source Code Form is subject to the terms of the Mozilla Public License,
+# v. 2.0. If a copy of the MPL was not distributed with this file, You can
+# obtain one at https://mozilla.org/MPL/2.0/.
+
+
+import argparse
+import subprocess
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser(
+ description="Configure a Zephyr CMake build",
+ )
+
+ parser.add_argument("-S", "--source-tree", required=True)
+ parser.add_argument("-B", "--build-tree", required=True)
+ parser.add_argument("-b", "--board", required=True)
+ parser.add_argument("-z", "--zephyr-base", required=True)
+ parser.add_argument("-m", "--zephyr-modules", required=False)
+ parser.add_argument("-c", "--extra-config", required=False)
+ parser.add_argument("-k", "--signing-key", required=False)
+ parser.add_argument("--prefix", required=False)
+ parser.add_argument("--libdir", required=False)
+ parser.add_argument("--bindir", required=False)
+
+ args = parser.parse_args()
+
+ command = [
+ "cmake",
+ f"-S{args.source_tree}",
+ f"-B{args.build_tree}",
+ f"-DBOARD={args.board}",
+ f"-DZEPHYR_BASE={args.zephyr_base}",
+ ]
+
+ if args.zephyr_modules is not None:
+ command.append(f"-DZEPHYR_MODULES={args.zephyr_modules}")
+
+ if args.extra_config is not None:
+ command.append(f"-DEXTRA_CONF_FILE={args.extra_config}")
+
+ if args.signing_key is not None:
+ command.append(f"-DCONFIG_BOOT_SIGNATURE_KEY_FILE=\"{args.signing_key}\"")
+
+ subprocess.run(command, shell=False, check=True)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..85ddbb3
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,2 @@
+configure_zephyr = meson.current_source_dir() / 'configure_zephyr.py'
+build_zephyr = meson.current_source_dir() / 'build_zephyr.py'
diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt
deleted file mode 100644
index 0cdb498..0000000
--- a/web/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-
-include(hugo)
-
-hugo_site(
- "website"
- "${CMAKE_CURRENT_SOURCE_DIR}"
- "${CMAKE_CURRENT_BINARY_DIR}/public"
-)
diff --git a/web/layouts/baseof.html b/web/layouts/baseof.html
index 983e6e1..96d8e07 100644
--- a/web/layouts/baseof.html
+++ b/web/layouts/baseof.html
@@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" type="text/css" href="static/simple.css">
<title>{{ .Site.Title }}</title>
</head>
<body>
diff --git a/web/layouts/home.html b/web/layouts/home.html
index 5425ac9..3bf37d9 100644
--- a/web/layouts/home.html
+++ b/web/layouts/home.html
@@ -1,3 +1,13 @@
{{- define "main" -}}
<h1>{{ .Site.Title }}</h1>
+<ul>
+ <h4>Printed circuit board</h4>
+ <li><a href="static/schematic.pdf">schematic.pdf</a></li>
+ <li><a href="static/bill-of-materials.csv">bill-of-materials.csv</a></li>
+
+ <h4>Firmware</h4>
+ <li><a href="static/application.signed.bin">application.signed.bin</a></li>
+ <li><a href="static/bootloader.bin">bootloader.bin</a></li>
+ <li><a href="static/simulation-linux-amd64.exe">simulation-linux-amd64.exe</a></li>
+</ul>
{{- end -}}
diff --git a/web/meson.build b/web/meson.build
new file mode 100644
index 0000000..da45440
--- /dev/null
+++ b/web/meson.build
@@ -0,0 +1,22 @@
+website = custom_target('website',
+ output: ['index.html'],
+ command: [
+ 'hugo',
+ '--source', meson.current_source_dir(),
+ '--destination', meson.current_build_dir(),
+ ],
+ depend_files: [
+ 'hugo.toml',
+ 'layouts/baseof.html',
+ 'layouts/home.html',
+ ],
+ depends: [
+ schematic,
+ bom,
+ application,
+ bootloader,
+ ],
+ build_by_default: true,
+ install: true,
+ install_dir: 'website',
+)