diff options
Diffstat (limited to 'fw')
-rw-r--r-- | fw/app/meson.build | 45 | ||||
-rw-r--r-- | fw/btl/meson.build | 19 | ||||
-rw-r--r-- | fw/meson.build | 17 | ||||
-rw-r--r-- | fw/sim/meson.build | 4 | ||||
-rw-r--r-- | fw/sim/srv/README.md | 17 | ||||
-rw-r--r-- | fw/sim/srv/zeth.netdev (renamed from fw/radvd.conf) | 15 | ||||
-rw-r--r-- | fw/sim/srv/zeth.network | 13 | ||||
-rwxr-xr-x | fw/simulate-network.sh | 56 |
8 files changed, 67 insertions, 119 deletions
diff --git a/fw/app/meson.build b/fw/app/meson.build index ddd5aa6..6665fe4 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, @@ -25,35 +24,37 @@ application = custom_target( ], ) -application_signed = custom_target( - 'application_signed', - output: ['application.signed.bin'], +version = '0.0.0' +header_size = '0x200' +slot_size = '0xc0000' + +update_image = custom_target( + output: ['update-image.bin'], command: [ imgtool, 'sign', - '--version', '0.0.0', - '--header-size', '0x200', - '--slot-size', '0xc0000', + '--version', version, + '--header-size', header_size, + '--slot-size', slot_size, '--key', signing_key, - meson.current_build_dir() / 'application.bin', - meson.current_build_dir() / 'application.signed.bin', + application, + '@OUTPUT@', ], - build_by_default: true, depends: application, - install: true, - install_dir: '/', ) -flash_application = custom_target( - build_always_stale: true, - build_by_default: false, +application_signed_confirmed = custom_target( + output: ['application.signed.confirmed.bin'], command: [ - 'st-flash', - '--connect-under-reset', - 'write', - meson.current_build_dir() / 'application.signed.bin', - '0x8040000', + imgtool, + 'sign', + '--version', version, + '--header-size', header_size, + '--slot-size', slot_size, + '--key', signing_key, + '--confirm', + application, + '@OUTPUT@', ], - depends: application_signed, - output: ['flash'], + depends: application, ) diff --git a/fw/btl/meson.build b/fw/btl/meson.build index 8ca1eb3..204fe20 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, @@ -22,21 +22,4 @@ bootloader = custom_target('bootloader', '--binary-name', 'zephyr.bin', '--target-name', 'bootloader.bin', ], - build_by_default: true, - 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'], ) diff --git a/fw/meson.build b/fw/meson.build index f61058c..8f45d5b 100644 --- a/fw/meson.build +++ b/fw/meson.build @@ -8,13 +8,16 @@ subdir('app') subdir('btl') subdir('sim') -erase = custom_target( - build_always_stale: true, - build_by_default: false, +factory_image = custom_target( + output: ['factory-image.bin'], command: [ - 'st-flash', - '--connect-under-reset', - 'erase', + make_factory_image, + '--bootloader', bootloader, + '--application', application_signed_confirmed, + '--factory-image', '@OUTPUT@', + ], + depends: [ + bootloader, + application_signed_confirmed, ], - output: ['erase'], ) diff --git a/fw/sim/meson.build b/fw/sim/meson.build index 7667f9b..2e0b4fa 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, @@ -21,7 +20,4 @@ simulation = custom_target( '--binary-name', 'zephyr.exe', '--target-name', 'simulation-linux-amd64.exe', ], - build_by_default: true, - install: true, - install_dir: '/', ) diff --git a/fw/sim/srv/README.md b/fw/sim/srv/README.md new file mode 100644 index 0000000..455800f --- /dev/null +++ b/fw/sim/srv/README.md @@ -0,0 +1,17 @@ +# Network setup for native sim firmware + +This folder contains documentation to provide a network setup suitable to run +the native sim build of the firmware. + +It assumes a Linux host, an executable file with the native sim firmware, +`systemd-networkd` as network configuration solution and `ufw` as firewall. + +For network configuration the `zeth.netdev` and `zeth.network` files from this +folder have to be used with `systemd-networkd`. + +The following is required to open the firewall for the firmware on the `zeth` +virtual network interface created by `systemd-networkd`: + +``` +ufw allow in on zeth to any port 1883 proto tcp +``` diff --git a/fw/radvd.conf b/fw/sim/srv/zeth.netdev index 98c703f..e8de39d 100644 --- a/fw/radvd.conf +++ b/fw/sim/srv/zeth.netdev @@ -2,15 +2,6 @@ # 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/. -interface zeth -{ - AdvSendAdvert on; - MinRtrAdvInterval 3; - MaxRtrAdvInterval 10; - AdvDefaultPreference low; - prefix 2001:db8::/64 - { - AdvOnLink on; - AdvAutonomous on; - }; -}; +[NetDev] +Name=zeth +Kind=tap diff --git a/fw/sim/srv/zeth.network b/fw/sim/srv/zeth.network new file mode 100644 index 0000000..7bf386a --- /dev/null +++ b/fw/sim/srv/zeth.network @@ -0,0 +1,13 @@ +# 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/. + +[Match] +Name=zeth + +[Network] +IPv6SendRA=yes +Address=2001:db8::36/64 + +[IPv6Prefix] +Prefix=2001:db8::/64 diff --git a/fw/simulate-network.sh b/fw/simulate-network.sh deleted file mode 100755 index 1f28a03..0000000 --- a/fw/simulate-network.sh +++ /dev/null @@ -1,56 +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/. - -# This script provides a simulated network environment for a simulated Zephyr -# firmware. -# -# It is based on providing a simulated layer 2 network interface (TAP) and -# providing required services as Linux processes there. One example is the -# radvd service which send router advertisements which are required for IPv6 -# stateless address auto configuration (SLAAC). -# -# Root rights are required to run this script. Use your preferred privilege -# escalation program to call this script like this: -# -# sudo ./simulate-network.sh - - -set -euf - - -FW="$(dirname "$0")" -RADVD_CONF="${FW}/radvd.conf" - -INTERFACE='zeth' -LINUX_IP='fdb3:c9f2:efda:1::2' -NETMASK='64' - -radvd_pid='' - - -cleanup() { - if test "$radvd_pid" != "" - then - kill "$radvd_pid" - fi - - ip link delete "$INTERFACE" -} - - -trap cleanup EXIT - -set -x - -ip tuntap add "$INTERFACE" mode tap -ip link set dev "$INTERFACE" up -ip addr add "${LINUX_IP}/${NETMASK}" dev "$INTERFACE" - -radvd --nodaemon --config "$RADVD_CONF" > /dev/null 2>&1 & -radvd_pid="$!" - -wait |