NCS: 2.1.0
Zephyr: v3.1.99-ncs1
Boards: nrf5340dk
I am looking to perform firmware update of both application and network core using SMP Server. I have a project set up following the peripheral_uart example, and updating the application and network firmware both seem to be working.
However, once I confirm the netcore image in image 1 slot 1, the "pending" flag is not cleared upon subsequent reset. So a netcore update is then performed on every boot. The image 0 (application) image does not seem to be impacted.
To reproduce:
1. On nRF5340DK, wipe flash and build/flash the attached sample project:
2. Check the logs on /dev/ttyACM1:
*** Booting Zephyr OS build v3.1.99-ncs1 *** I: Starting bootloader I: Swap type: none I: Swap type: none I: Bootloader chainload address offset: 0x10000 *** Booting Zephyr OS build v3.1.99-ncs1 *** [00:00:00.086,242] <inf> hello_world: Hello World! nrf5340dk_nrf5340_cpuapp [00:00:00.109,497] <inf> hello_world: Bluetooth enabled (0) [00:00:00.109,527] <inf> hello_world: Settings subsys initialized (0) [00:00:00.110,504] <inf> hello_world: Settings loaded (0) [00:00:00.113,067] <inf> hello_world: Advertising started (0)
3. Modify the netcore image by editing `child_image/hci_rpmsg.conf` L28, replacing `CONFIG_BT_CTLR_TX_PWR_0=y` with `CONFIG_BT_CTLR_TX_PWR_PLUS_3=y` or any such change. Re-build.
4. Upload the new image to image 1 slot 1 using mcumgr (replacing hci and peer_id as needed):
[email protected]:~/hello_world$ sudo mcumgr --hci 1 --conntype ble --connstring peer_id=f6:18:e9:e7:09:b7 image upload build/zephyr/net_core_app_upda te.bin -n 1 -w 1 177.21 KiB / 177.21 KiB [======================================================================================================] 100.00% 7.90 KiB/s 22s Done
5. Check the new image in image 1 slot 1 using mcumgr:
[email protected]lvani-linux:~/hello_world$ sudo mcumgr --hci 1 --conntype ble --connstring peer_id=f6:18:e9:e7:09:b7 image list Images: image=0 slot=0 version: 0.0.0 bootable: true flags: active confirmed hash: 190b1e243ca520b0883f60733b3f12c61486fb30f10ea737a227f28dce380850 image=1 slot=1 version: 0.0.0 bootable: true flags: hash: eee308dac2fba11c12dd2a4d8224f00299ba82fe901a0a81269ff334a066a9a0 Split status: N/A (0)
6. Confirm the image using mcumgr:
[email protected]:~/hello_world$ sudo mcumgr --hci 1 --conntype ble --connstring peer_id=f6:18:e9:e7:09:b7 image confirm eee308dac2fba11c12dd2a4d8224f
00299ba82fe901a0a81269ff334a066a9a0
Images:
image=0 slot=0
version: 0.0.0
bootable: true
flags: active confirmed
hash: 190b1e243ca520b0883f60733b3f12c61486fb30f10ea737a227f28dce380850
image=1 slot=1
version: 0.0.0
bootable: true
flags: pending permanent
hash: eee308dac2fba11c12dd2a4d8224f00299ba82fe901a0a81269ff334a066a9a0
Split status: N/A (0)
7. Reset using mcumgr:
[email protected]:~/hello_world$ sudo mcumgr --hci 1 --conntype ble --connstring peer_id=f6:18:e9:e7:09:b7 reset Done
8. Observe that netcore update was performed in logs:
*** Booting Zephyr OS build v3.1.99-ncs1 *** I: Starting bootloader I: Swap type: none I: Swap type: perm I: Starting network core update I: Turned on network core I: Turned off network core I: Done updating network core I: Bootloader chainload address offset: 0x10000 *** Booting Zephyr OS build v3.1.99-ncs1 *** [00:00:00.005,523] <inf> hello_world: Hello World! nrf5340dk_nrf5340_cpuapp [00:00:00.028,808] <inf> hello_world: Bluetooth enabled (0) [00:00:00.028,808] <inf> hello_world: Settings subsys initialized (0) [00:00:00.029,846] <inf> hello_world: Settings loaded (0) [00:00:00.032,409] <inf> hello_world: Advertising started (0)
9. Reset again and observe that netcore update happens again.
10. List images and observe `pending` flag is still present.
[email protected]:~/hello_world$ sudo mcumgr --hci 1 --conntype ble --connstring peer_id=f6:18:e9:e7:09:b7 image list Images: image=0 slot=0 version: 0.0.0 bootable: true flags: active confirmed hash: 190b1e243ca520b0883f60733b3f12c61486fb30f10ea737a227f28dce380850 image=1 slot=1 version: 0.0.0 bootable: true flags: pending permanent hash: eee308dac2fba11c12dd2a4d8224f00299ba82fe901a0a81269ff334a066a9a0 Split status: N/A (0)