Skip to content

Commit 0ff5470

Browse files
committed
readme: general update after integration of llext support
1 parent 695273d commit 0ff5470

File tree

1 file changed

+98
-62
lines changed

1 file changed

+98
-62
lines changed

README.md

Lines changed: 98 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This project is used with a [NUCLEO-L4A6ZG](https://www.st.com/en/evaluation-too
1313

1414
![NUCLEO-L4A6ZG and W5500 wiring](https://raw.githubusercontent.com/joelguittet/mender-stm32l4a6-zephyr-example/master/.github/docs/wiring.png)
1515

16-
The project is built using Zephyr RTOS v3.4.0 and Zephyr SDK >= v0.16.0. It depends on [cJSON](https://github.com/DaveGamble/cJSON). There is no other dependencies.
16+
The project is built using Zephyr RTOS v3.7.0 and Zephyr SDK >= v0.16.0. It depends on [cJSON](https://github.com/DaveGamble/cJSON). There is no other dependencies.
1717

1818
To start using Mender, we recommend that you begin with the Getting started section in [the Mender documentation](https://docs.mender.io).
1919

@@ -75,45 +75,47 @@ west flash --hex-file build/zephyr/zephyr.signed.hex
7575
After flashing the application on the NUCLEO-L4A6ZG evaluation board and displaying logs, you should be able to see the following:
7676

7777
```
78-
*** Booting Zephyr OS build zephyr-v3.4.0 ***
78+
*** Booting MCUboot v2.1.0-rc1-4-g898a1ca64a75 ***
79+
*** Using Zephyr OS build v3.6.0-7116-g40810983ead2 ***
7980
I: Starting bootloader
8081
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
8182
I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
8283
I: Boot source: primary slot
83-
I: Swap type: none
84+
I: Image index: 0, Swap type: none
8485
I: Bootloader chainload address offset: 0xe000
8586
I: Jumping to the first image slot
8687
8788
88-
[00:00:00.012,000] <inf> eth_w5500: W5500 Initialized
89-
*** Booting Zephyr OS build zephyr-v3.4.0 ***
90-
[00:00:05.038,000] <inf> mender_stm32l4a6_zephyr_example: Your address: 192.168.1.216
91-
[00:00:05.048,000] <inf> mender_stm32l4a6_zephyr_example: Lease time: 43200 seconds
92-
[00:00:05.059,000] <inf> mender_stm32l4a6_zephyr_example: Subnet: 255.255.255.0
93-
[00:00:05.068,000] <inf> mender_stm32l4a6_zephyr_example: Router: 192.168.1.1
94-
[00:00:05.078,000] <inf> mender_stm32l4a6_zephyr_example: MAC address of the device '00:08:dc:01:02:03'
95-
[00:00:05.090,000] <inf> mender_stm32l4a6_zephyr_example: Running project 'mender-stm32l4a6-zephyr-example' version '0.1'
96-
[00:00:05.109,000] <inf> fs_nvs: 4 Sectors of 2048 bytes
97-
[00:00:05.116,000] <inf> fs_nvs: alloc wra: 0, 7e8
98-
[00:00:05.124,000] <inf> fs_nvs: data wra: 0, 0
99-
[00:00:05.131,000] <inf> mender_stm32l4a6_zephyr_example: Mender client initialized
100-
[00:00:05.141,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/storage/zephyr/nvs/src/mender-storage.c (262): Device configuration not available
101-
[00:00:05.159,000] <inf> mender_stm32l4a6_zephyr_example: Mender configure initialized
102-
[00:00:05.169,000] <inf> mender_stm32l4a6_zephyr_example: Mender inventory initialized
103-
[00:00:05.180,000] <inf> mender_stm32l4a6_zephyr_example: Device configuration retrieved
104-
[00:00:05.191,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/storage/zephyr/nvs/src/mender-storage.c (111): Authentication keys are not available
105-
[00:00:05.209,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/tls/generic/mbedtls/src/mender-tls.c (126): Generating authentication keys...
106-
[00:01:24.195,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/storage/zephyr/nvs/src/mender-storage.c (187): OTA ID not available
107-
[00:01:36.160,000] <err> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-api.c (854): [401] Unauthorized: dev auth: unauthorized
108-
[00:01:36.177,000] <inf> mender_stm32l4a6_zephyr_example: Mender client authentication failed (1/3)
89+
[00:00:02.016,000] <inf> eth_w5500: eth_w5500@0: Link up
90+
[00:00:02.033,000] <inf> mender_stm32l4a6_zephyr_example: IPv4 address: 192.168.1.216
91+
[00:00:02.044,000] <inf> mender_stm32l4a6_zephyr_example: Lease time: 43200 seconds
92+
[00:00:02.054,000] <inf> mender_stm32l4a6_zephyr_example: Subnet: 255.255.255.0
93+
[00:00:02.064,000] <inf> mender_stm32l4a6_zephyr_example: Router: 192.168.1.1
94+
[00:00:02.074,000] <inf> mender_stm32l4a6_zephyr_example: MAC address of the device '00:08:dc:01:02:03'
95+
[00:00:02.085,000] <inf> mender_stm32l4a6_zephyr_example: Running project 'mender-stm32l4a6-zephyr-example' version '0.1.0'
96+
[00:00:02.104,000] <inf> mender_stm32l4a6_zephyr_example: Mender client initialized
97+
[00:00:02.114,000] <inf> mender_stm32l4a6_zephyr_example: Mender client registered hello-world module
98+
[00:00:02.126,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/storage/zephyr/nvs/src/mender-storage.c (242): Device configuration not available
99+
[00:00:02.144,000] <inf> mender_stm32l4a6_zephyr_example: Mender configure add-on registered
100+
[00:00:02.155,000] <inf> mender_stm32l4a6_zephyr_example: Mender inventory add-on registered
101+
[00:00:02.166,000] <inf> mender_stm32l4a6_zephyr_example: Device configuration retrieved
102+
[00:00:02.177,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/storage/zephyr/nvs/src/mender-storage.c (110): Authentication keys are not available
103+
[00:00:02.195,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/tls/generic/mbedtls/src/mender-tls.c (126): Generating authentication keys...
104+
[00:04:54.037,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/storage/zephyr/nvs/src/mender-storage.c (182): Deployment data not available
105+
[00:04:54.054,000] <inf> mender_stm32l4a6_zephyr_example: Mender client connect network
106+
[00:05:04.953,000] <err> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-api.c (900): [401] Unauthorized: Unauthorized
107+
[00:05:04.969,000] <inf> mender_stm32l4a6_zephyr_example: Mender client authentication failed
108+
[00:05:04.980,000] <inf> mender_stm32l4a6_zephyr_example: Mender client released network
109109
```
110110

111111
Which means you now have generated authentication keys on the device. Generating is a bit long but authentication keys are stored in `storage_partition` of the MCU so it's done only the first time the device is flashed. You now have to accept your device on the mender interface. Once it is accepted on the mender interface the following will be displayed:
112112

113113
```
114-
[00:03:17.168,000] <inf> mender_stm32l4a6_zephyr_example: Mender client authenticated
115-
[00:03:17.178,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (433): Checking for deployment...
116-
[00:03:21.774,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (441): No deployment available
114+
[00:10:02.176,000] <inf> mender_stm32l4a6_zephyr_example: Mender client connect network
115+
[00:10:13.205,000] <inf> mender_stm32l4a6_zephyr_example: Mender client authenticated
116+
[00:10:13.215,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (884): Checking for deployment...
117+
[00:10:17.791,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (892): No deployment available
118+
[00:10:17.805,000] <inf> mender_stm32l4a6_zephyr_example: Mender client released network
117119
```
118120

119121
Congratulation! Your device is connected to the mender server. Device type is `mender-stm32l4a6-zephyr-example` and the current software version is displayed.
@@ -122,7 +124,7 @@ Congratulation! Your device is connected to the mender server. Device type is `m
122124

123125
First retrieve [mender-artifact](https://docs.mender.io/downloads#mender-artifact) tool.
124126

125-
Change `VERSION.txt` file to `0.2`, rebuild and sign the firmware using the following commands. We previously used `hex` file because it is required to flash the device, but we now use `bin` file that is required for the mender-mcu-client:
127+
Change `VERSION` file to `VERSION_MAJOR=0` and `VERSION_MINOR=2`, rebuild and sign the firmware using the following commands. We previously used `hex` file because it is required to flash the device, but we now use `bin` file that is required for the mender-mcu-client:
126128

127129
```
128130
west build -b nucleo_l4a6zg path/to/mender-stm32l4a6-zephyr-example
@@ -131,55 +133,58 @@ west build -b nucleo_l4a6zg path/to/mender-stm32l4a6-zephyr-example
131133
Then create a new artifact using the following command line:
132134

133135
```
134-
path/to/mender-artifact write rootfs-image --compression none --device-type mender-stm32l4a6-zephyr-example --artifact-name mender-stm32l4a6-zephyr-example-v$(head -n1 path/to/mender-stm32l4a6-zephyr-example/VERSION.txt) --output-path build/zephyr/mender-stm32l4a6-zephyr-example-v$(head -n1 path/to/mender-stm32l4a6-zephyr-example/VERSION.txt).mender --file build/zephyr/zephyr.signed.bin
136+
path/to/mender-artifact write rootfs-image --compression none --device-type mender-stm32l4a6-zephyr-example --artifact-name mender-stm32l4a6-zephyr-example-v0.2.0 --output-path build/zephyr/mender-stm32l4a6-zephyr-example-v0.2.0.mender --file build/zephyr/zephyr.signed.bin
135137
```
136138

137-
Upload the artifact `mender-stm32l4a6-zephyr-example-v0.2.mender` to the mender server and create a new deployment.
139+
Upload the artifact `mender-stm32l4a6-zephyr-example-v0.2.0.mender` to the mender server and create a new deployment.
138140

139141
The device checks for the new deployment, downloads the artifact and installs it on the `slot1_partition`. Then it reboots to apply the update:
140142

141143
```
142-
[00:06:05.131,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (433): Checking for deployment...
143-
[00:06:09.763,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (453): Downloading deployment artifact with id 'ef67ed77-aef1-470e-872e--
144-
[00:06:14.406,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'downloading'
145-
[00:06:20.146,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-artifact.c (380): Artifact has valid version
146-
[00:06:20.166,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/ota/zephyr/src/mender-ota.c (42): Start flashing OTA artifact 'zephyr.signed.bin' with s6
147-
[00:06:46.936,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (463): Download done, installing artifact
148-
[00:06:51.476,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'installing'
149-
[00:06:56.047,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'rebooting'
150-
[00:06:56.058,000] <inf> mender_stm32l4a6_zephyr_example: Restarting system
151-
uart:~$ *** Booting Zephyr OS build zephyr-v3.4.0 ***
144+
[00:40:02.176,000] <inf> mender_stm32l4a6_zephyr_example: Mender client connect network
145+
[00:40:02.186,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (884): Checking for deployment...
146+
[00:40:07.045,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (918): Downloading deployment artifact with id 'eac3b245-5bdd-427f-b763-?
147+
[00:40:11.614,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'downloading'
148+
[00:40:17.565,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-artifact.c (382): Artifact has valid version
149+
[00:40:17.585,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/flash/zephyr/src/mender-flash.c (42): Start flashing artifact 'zephyr.signed.bin' with s6
150+
[00:40:45.410,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (930): Download done, installing artifact
151+
[00:40:50.039,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'installing'
152+
[00:40:54.588,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'rebooting'
153+
[00:40:54.599,000] <inf> mender_stm32l4a6_zephyr_example: Mender client released network
154+
[00:40:54.610,000] <inf> mender_stm32l4a6_zephyr_example: Restarting system
155+
uart:~$ *** Booting MCUboot v2.1.0-rc1-4-g898a1ca64a75 ***
156+
*** Using Zephyr OS build v3.6.0-7116-g40810983ead2 ***
152157
I: Starting bootloader
153158
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
154159
I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
155160
I: Boot source: primary slot
156-
I: Swap type: test
161+
I: Image index: 0, Swap type: test
157162
I: Starting swap using scratch algorithm.
158163
I: Bootloader chainload address offset: 0xe000
159164
I: Jumping to the first image slot
160165
161166
162-
[00:00:00.012,000] <inf> eth_w5500: W5500 Initialized
163-
*** Booting Zephyr OS build zephyr-v3.4.0 ***
164-
[00:00:06.038,000] <inf> mender_stm32l4a6_zephyr_example: Your address: 192.168.1.216
165-
[00:00:06.048,000] <inf> mender_stm32l4a6_zephyr_example: Lease time: 43200 seconds
166-
[00:00:06.058,000] <inf> mender_stm32l4a6_zephyr_example: Subnet: 255.255.255.0
167-
[00:00:06.068,000] <inf> mender_stm32l4a6_zephyr_example: Router: 192.168.1.1
168-
[00:00:06.078,000] <inf> mender_stm32l4a6_zephyr_example: MAC address of the device '00:08:dc:01:02:03'
169-
[00:00:06.090,000] <inf> mender_stm32l4a6_zephyr_example: Running project 'mender-stm32l4a6-zephyr-example' version '0.2'
170-
[00:00:06.108,000] <inf> fs_nvs: 4 Sectors of 2048 bytes
171-
[00:00:06.115,000] <inf> fs_nvs: alloc wra: 1, 7d0
172-
[00:00:06.123,000] <inf> fs_nvs: data wra: 1, 1f8
173-
[00:00:06.130,000] <inf> mender_stm32l4a6_zephyr_example: Mender client initialized
174-
[00:00:06.140,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/storage/zephyr/nvs/src/mender-storage.c (262): Device configuration not available
175-
[00:00:06.158,000] <inf> mender_stm32l4a6_zephyr_example: Mender configure initialized
176-
[00:00:06.169,000] <inf> mender_stm32l4a6_zephyr_example: Mender inventory initialized
177-
[00:00:06.179,000] <inf> mender_stm32l4a6_zephyr_example: Device configuration retrieved
178-
[00:00:18.219,000] <inf> mender_stm32l4a6_zephyr_example: Mender client authenticated
179-
[00:00:18.230,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/ota/zephyr/src/mender-ota.c (146): Application has been mark valid and rollback canceled
180-
[00:00:22.783,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'success'
181-
[00:00:22.794,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (433): Checking for deployment...
182-
[00:00:27.366,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (441): No deployment available
167+
[00:00:02.016,000] <inf> eth_w5500: eth_w5500@0: Link up
168+
[00:00:02.033,000] <inf> mender_stm32l4a6_zephyr_example: IPv4 address: 192.168.1.216
169+
[00:00:02.044,000] <inf> mender_stm32l4a6_zephyr_example: Lease time: 43200 seconds
170+
[00:00:02.054,000] <inf> mender_stm32l4a6_zephyr_example: Subnet: 255.255.255.0
171+
[00:00:02.064,000] <inf> mender_stm32l4a6_zephyr_example: Router: 192.168.1.1
172+
[00:00:02.074,000] <inf> mender_stm32l4a6_zephyr_example: MAC address of the device '00:08:dc:01:02:03'
173+
[00:00:02.086,000] <inf> mender_stm32l4a6_zephyr_example: Running project 'mender-stm32l4a6-zephyr-example' version '0.2.0'
174+
[00:00:02.103,000] <inf> mender_stm32l4a6_zephyr_example: Mender client initialized
175+
[00:00:02.113,000] <inf> mender_stm32l4a6_zephyr_example: Mender client registered hello-world module
176+
[00:00:02.125,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/storage/zephyr/nvs/src/mender-storage.c (242): Device configuration not available
177+
[00:00:02.143,000] <inf> mender_stm32l4a6_zephyr_example: Mender configure add-on registered
178+
[00:00:02.154,000] <inf> mender_stm32l4a6_zephyr_example: Mender inventory add-on registered
179+
[00:00:02.165,000] <inf> mender_stm32l4a6_zephyr_example: Device configuration retrieved
180+
[00:00:02.177,000] <inf> mender_stm32l4a6_zephyr_example: Mender client connect network
181+
[00:00:12.840,000] <inf> mender_stm32l4a6_zephyr_example: Mender client authenticated
182+
[00:00:12.851,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/platform/flash/zephyr/src/mender-flash.c (146): Application has been mark valid and rollback cancd
183+
[00:00:17.383,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'success'
184+
[00:00:17.394,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (884): Checking for deployment...
185+
[00:00:21.935,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (892): No deployment available
186+
[00:00:21.949,000] <inf> mender_stm32l4a6_zephyr_example: Mender client released network
187+
183188
```
184189

185190
Congratulation! You have updated the device. Mender server displays the success of the deployment.
@@ -189,6 +194,37 @@ Congratulation! You have updated the device. Mender server displays the success
189194
In case of failure to connect and authenticate to the server the current example application performs a rollback to the previous release.
190195
You can customize the behavior of the example application to add your own checks and perform the rollback in case the tests fail.
191196

197+
### Download and execute an LLEXT module
198+
199+
This example application supports LLEXT feature to permit loading and executing LLEXT modules using mender-mcu-client.
200+
201+
Compile the hello-world LLEXT sample from Zephyr as below:
202+
203+
```
204+
west build -d build-llext -b nucleo_l4a6zg samples/subsys/llext/modules
205+
```
206+
207+
Then create a new artifact using the following command line:
208+
209+
```
210+
path/to/mender-artifact write module-image --compression none --device-type mender-stm32l4a6-zephyr-example --artifact-name hello-world-v1 --type hello-world --output-path build-llext/zephyr/mender-module-hello-world-v1.mender --file build-llext/zephyr/hello_world.llext
211+
```
212+
213+
Upload the artifact `mender-module-hello-world-v1.mender` to the mender server and create a new deployment.
214+
215+
The device checks for the new deployment, downloads the artifact and call the `hellow_world` function of the module, which is simply displyaing `Hello, world, from an llext!` log in the console:
216+
217+
```
218+
[00:00:12.987,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (884): Checking for deployment...
219+
[00:00:17.583,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (918): Downloading deployment artifact with id '360e14aa-33d2-4f99-af7d-A
220+
[00:00:22.177,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'downloading'
221+
[00:00:27.725,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-artifact.c (382): Artifact has valid version
222+
[00:00:27.751,000] <inf> mender: CMAKE_SOURCE_DIR/components/mender-mcu-client/core/src/mender-client.c (930): Download done, installing artifact
223+
[00:00:32.275,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'installing'
224+
Hello, world, from an llext!
225+
[00:00:36.817,000] <inf> mender_stm32l4a6_zephyr_example: Deployment status is 'success'
226+
```
227+
192228
### Using an other zephyr evaluation board
193229

194230
The zephyr integration into the mender-mcu-client is generic and it is not limited to STM32 MCUs.

0 commit comments

Comments
 (0)