From b1838d1c5b6bd27757d50d784543ea0ae16c1769 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 24 May 2025 11:17:46 +0200 Subject: Remove `st-flash`-based build targets This was used since flashing was complex. Thus the build system should help making it easier. The new approach is more to provide artifacts by the build system which are easy to flash / remote-update. A `factory-image.bin` and `update-image.bin` should be provided. --- fw/btl/meson.build | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'fw/btl') diff --git a/fw/btl/meson.build b/fw/btl/meson.build index 8ca1eb3..c22ba3c 100644 --- a/fw/btl/meson.build +++ b/fw/btl/meson.build @@ -26,17 +26,3 @@ bootloader = custom_target('bootloader', install: true, install_dir: '/', ) - -flash_bootloader = custom_target( - build_always_stale: true, - build_by_default: false, - command: [ - 'st-flash', - '--connect-under-reset', - 'write', - meson.current_build_dir() / 'bootloader.bin', - '0x8000000', - ], - depends: bootloader, - output: ['flash'], -) -- cgit v1.2.3-70-g09d2 From caf416218623d6778b3d0c2fe12ee08135c2d126 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 24 May 2025 11:18:38 +0200 Subject: Remove installation step Using the installation step to copy selected artifacts into one folder was anyway a hack. This commit shows that the complexity can be reduced by adding copy targets. The `build/artifacts` folder contains the selected artifacts, they are always up to date, the user does not have to call the install step separately and the target definitions do not require install-related keyword arguments. --- README.md | 8 +++----- artifacts/meson.build | 22 ++++++++++++++++++++++ fw/app/meson.build | 4 ---- fw/btl/meson.build | 4 +--- fw/sim/meson.build | 3 --- meson.build | 19 ++++++------------- pcb/meson.build | 8 ++------ web/meson.build | 7 +------ 8 files changed, 35 insertions(+), 40 deletions(-) create mode 100644 artifacts/meson.build (limited to 'fw/btl') diff --git a/README.md b/README.md index 3d81e83..a6dfe0a 100644 --- a/README.md +++ b/README.md @@ -25,19 +25,17 @@ The project is built with the Meson build system. ``` meson setup build -cd build -ninja -meson install --destdir artifacts +ninja -C build ``` The resulting artifacts can be listed with `tree`. ``` -tree artifacts +tree build/artifacts ``` These artifacts are organized as static website. It can be opened with Firefox. ``` -firefox artifacts/index.html +firefox build/artifacts/index.html ``` diff --git a/artifacts/meson.build b/artifacts/meson.build new file mode 100644 index 0000000..ea6fc39 --- /dev/null +++ b/artifacts/meson.build @@ -0,0 +1,22 @@ +artifacts = [ + index_html, + css, + schematic, + bom, + simulation, + bootloader, + application_signed, +] + +foreach artifact : artifacts + custom_target( + output: [fs.name(artifact.full_path())], + command: [ + cp, + artifact.full_path(), + meson.current_build_dir(), + ], + depends: artifact, + build_by_default: true, + ) +endforeach diff --git a/fw/app/meson.build b/fw/app/meson.build index 8d84209..84e4c21 100644 --- a/fw/app/meson.build +++ b/fw/app/meson.build @@ -15,7 +15,6 @@ external_project.add_project( ) application = custom_target( - 'application', output: ['application.bin'], command: [ build_zephyr, @@ -26,7 +25,6 @@ application = custom_target( ) application_signed = custom_target( - 'application_signed', output: ['application.signed.bin'], command: [ imgtool, @@ -40,6 +38,4 @@ application_signed = custom_target( ], build_by_default: true, depends: application, - install: true, - install_dir: '/', ) diff --git a/fw/btl/meson.build b/fw/btl/meson.build index c22ba3c..2ba1cf4 100644 --- a/fw/btl/meson.build +++ b/fw/btl/meson.build @@ -14,7 +14,7 @@ external_project.add_project( verbose: true, ) -bootloader = custom_target('bootloader', +bootloader = custom_target( output: ['bootloader.bin'], command: [ build_zephyr, @@ -23,6 +23,4 @@ bootloader = custom_target('bootloader', '--target-name', 'bootloader.bin', ], build_by_default: true, - install: true, - install_dir: '/', ) diff --git a/fw/sim/meson.build b/fw/sim/meson.build index 7667f9b..5edcad9 100644 --- a/fw/sim/meson.build +++ b/fw/sim/meson.build @@ -13,7 +13,6 @@ external_project.add_project( ) simulation = custom_target( - 'simulation', output: ['simulation-linux-amd64.exe'], command: [ build_zephyr, @@ -22,6 +21,4 @@ simulation = custom_target( '--target-name', 'simulation-linux-amd64.exe', ], build_by_default: true, - install: true, - install_dir: '/', ) diff --git a/meson.build b/meson.build index eb7f9ad..9b7d7c1 100644 --- a/meson.build +++ b/meson.build @@ -1,20 +1,13 @@ -project( - 'iot-contact', - default_options: { - 'prefix': '/', - }, -) +project('iot-contact') -subdir('tools') +cp = find_program('cp', required : true) fs = import('fs') -css = fs.copyfile( - meson.current_source_dir() / 'simple.css' / 'simple.css', - 'simple.css', - install: true, - install_dir: '/', -) +css = fs.copyfile(meson.current_source_dir() / 'simple.css' / 'simple.css') + +subdir('tools') subdir('fw') subdir('pcb') subdir('web') +subdir('artifacts') diff --git a/pcb/meson.build b/pcb/meson.build index f320aae..293b2a1 100644 --- a/pcb/meson.build +++ b/pcb/meson.build @@ -7,7 +7,7 @@ schematic_files = [ 'processor.kicad_sch', ] -schematic = custom_target('schematic', +schematic = custom_target( output: ['schematic.pdf'], command: [ 'kicad-cli', @@ -19,11 +19,9 @@ schematic = custom_target('schematic', ], depend_files: schematic_files, build_by_default: true, - install: true, - install_dir: '/', ) -bom = custom_target('bom', +bom = custom_target( output: ['bill-of-materials.csv'], command: [ 'kicad-cli', @@ -37,6 +35,4 @@ bom = custom_target('bom', ], depend_files: schematic_files, build_by_default: true, - install: true, - install_dir: '/', ) diff --git a/web/meson.build b/web/meson.build index f8c2024..19551a5 100644 --- a/web/meson.build +++ b/web/meson.build @@ -1,6 +1 @@ -website = fs.copyfile( - meson.current_source_dir() / 'index.html', - 'index.html', - install: true, - install_dir: '/', -) +index_html = fs.copyfile(meson.current_source_dir() / 'index.html') -- cgit v1.2.3-70-g09d2 From fc3b3cbf7fecee7226f249f7b62cf36aa82a545a Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 24 May 2025 11:20:08 +0200 Subject: Provide `factory-image.bin` with Meson This automatically creates `build/artifacts/factory-image.bin` with the Meson build system. The resulting file can simply be moved to the virtual file system of the `nucleo_f767zi` board to flash bootloader and application making the board ready for operation and remote updates. --- artifacts/meson.build | 1 + fw/btl/meson.build | 1 - fw/meson.build | 14 ++++++++++++++ tools/meson.build | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) (limited to 'fw/btl') diff --git a/artifacts/meson.build b/artifacts/meson.build index ea6fc39..9e14232 100644 --- a/artifacts/meson.build +++ b/artifacts/meson.build @@ -6,6 +6,7 @@ artifacts = [ simulation, bootloader, application_signed, + factory_image, ] foreach artifact : artifacts diff --git a/fw/btl/meson.build b/fw/btl/meson.build index 2ba1cf4..204fe20 100644 --- a/fw/btl/meson.build +++ b/fw/btl/meson.build @@ -22,5 +22,4 @@ bootloader = custom_target( '--binary-name', 'zephyr.bin', '--target-name', 'bootloader.bin', ], - build_by_default: true, ) diff --git a/fw/meson.build b/fw/meson.build index 8194827..8f45d5b 100644 --- a/fw/meson.build +++ b/fw/meson.build @@ -7,3 +7,17 @@ subdir('rtos') subdir('app') subdir('btl') subdir('sim') + +factory_image = custom_target( + output: ['factory-image.bin'], + command: [ + make_factory_image, + '--bootloader', bootloader, + '--application', application_signed_confirmed, + '--factory-image', '@OUTPUT@', + ], + depends: [ + bootloader, + application_signed_confirmed, + ], +) diff --git a/tools/meson.build b/tools/meson.build index 85ddbb3..f58c54b 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -1,2 +1,3 @@ configure_zephyr = meson.current_source_dir() / 'configure_zephyr.py' build_zephyr = meson.current_source_dir() / 'build_zephyr.py' +make_factory_image = meson.current_source_dir() / 'make_factory_image.py' -- cgit v1.2.3-70-g09d2