Skip to content

Commit

Permalink
Anjay-zephyr-client 23.06
Browse files Browse the repository at this point in the history
Features

- Added support for nRF7002DK board

Improvements

- Updated Zephyr to 3.3.0
- Updated sdk-nrf to 2.3.0
- Updated Anjay-zephyr to 3.4.1
- Adjusted partition layout and MCUboot configuration on nRF9160DK builds to
  support newer version of sdk-nrf
- Added overlay for nRF9160DK in demo application which enables experimental Advanced Firmware Update object (/33629)

Bugfixes

- Fixed firmware update on Thingy:91 - made sure that enough free space is left
  on the flash partition for MCUboot's move algorithm to work
- Fixed runtime certificate configuration on nRF52840 based boards
  • Loading branch information
Mateusz Kwiatkowski committed Jun 23, 2023
1 parent cad976f commit a9472b5
Show file tree
Hide file tree
Showing 36 changed files with 440 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
.vscode
.idea
__pycache__
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 23.06 (June 23rd, 2023)

### Features
- Added support for nRF7002DK board

### Improvements
- Updated Zephyr to 3.3.0
- Updated sdk-nrf to 2.3.0
- Updated Anjay-zephyr to 3.4.1
- Adjusted partition layout and MCUboot configuration on nRF9160DK builds to
support newer version of sdk-nrf
- Added overlay for nRF9160DK in demo application which enables experimental Advanced Firmware Update object (/33629)

### Bugfixes
- Fixed firmware update on Thingy:91 - made sure that enough free space is left
on the flash partition for MCUboot's move algorithm to work
- Fixed runtime certificate configuration on nRF52840 based boards

## 23.02 (Feb 21st, 2023)

### Features
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ The following examples are present:
<a href="https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9160-DK">nRF9160 Development kit</a><br>
<a href="https://www.nordicsemi.com/Products/Development-hardware/Nordic-Thingy-91">Nordic Thingy:91 Prototyping kit</a><br>
<a href="https://www.espressif.com/en/products/devkits/esp32-devkitc">ESP32-DevKitC</a><br>
<a href="https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dk">nRF52840 Development kit</a><br>
<a href="https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK">nRF7002 Development kit</a><br>
<a href="https://store.arduino.cc/products/arduino-nano-33-ble-sense">Arduino Nano 33 BLE Sense Lite</a><br>
any other board of your choice (by adding appropriate <code>*.conf</code>/<code>*.overlay</code> files). FOTA support for selected boards.
</td>
Expand All @@ -39,6 +41,7 @@ The following examples are present:
<a href="https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9160-DK">nRF9160 Development kit</a><br>
<a href="https://www.nordicsemi.com/Products/Development-hardware/Nordic-Thingy-91">Nordic Thingy:91 Prototyping kit</a><br>
<a href="https://www.espressif.com/en/products/devkits/esp32-devkitc">ESP32-DevKitC</a><br>
<a href="https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dk">nRF52840 Development kit</a><br>
<a href="https://store.arduino.cc/products/arduino-nano-33-ble-sense">Arduino Nano 33 BLE Sense Lite</a><br>
</td>
</tr>
Expand Down
15 changes: 14 additions & 1 deletion demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ if(CONFIG_PARTITION_MANAGER_ENABLED)

message(FATAL_ERROR "${pm_missing_message}")
endif()

set(FOTA_BINARY_FILE "${CMAKE_CURRENT_BINARY_DIR}/zephyr/app_update.bin")
elseif(CONFIG_ANJAY_CLIENT_BUILD_MCUBOOT_AUTOMATICALLY)
if("${CONFIG_MCUBOOT_SIGNATURE_KEY_FILE}" STREQUAL "")
if(NOT CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE)
Expand Down Expand Up @@ -81,13 +83,24 @@ elseif(CONFIG_ANJAY_CLIENT_BUILD_MCUBOOT_AUTOMATICALLY)
"${CMAKE_CURRENT_BINARY_DIR}/mcuboot/zephyr/zephyr.hex"
"${CMAKE_CURRENT_BINARY_DIR}/zephyr/zephyr.signed.hex"
DEPENDS mcuboot zephyr_final)
add_custom_target(mergehex ALL DEPENDS "${MERGED_HEX_NAME}")
add_custom_target(merged_hex ALL DEPENDS "${MERGED_HEX_NAME}")

if(TARGET runners_yaml_props_target)
get_target_property(RUNNERS_YAML_CONTENTS runners_yaml_props_target yaml_contents)
string(REGEX REPLACE "zephyr[a-zA-Z0-9._-]*[.]hex" "merged.hex" RUNNERS_YAML_CONTENTS "${RUNNERS_YAML_CONTENTS}")
set_property(TARGET runners_yaml_props_target PROPERTY yaml_contents "${RUNNERS_YAML_CONTENTS}")
endif()

set(FOTA_BINARY_FILE "${CMAKE_CURRENT_BINARY_DIR}/zephyr/zephyr.signed.bin")
endif()

if(CONFIG_ANJAY_ZEPHYR_FOTA AND DEFINED FOTA_BINARY_FILE AND TARGET merged_hex)
# NOTE: Condider removing this (and the validate_fota_file_size.py script
# itself) when https://github.com/nrfconnect/sdk-mcuboot/pull/185 is merged
add_custom_target(validate_fota_file_size ALL DEPENDS merged_hex
COMMAND "${PYTHON_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/../tools/validate_fota_file_size.py"
"${FOTA_BINARY_FILE}")
endif()

if(CONFIG_ANJAY_ZEPHYR_FACTORY_PROVISIONING_INITIAL_FLASH)
Expand Down
47 changes: 32 additions & 15 deletions demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ Project containing all implemented features, intended to be a showcase.
## Supported hardware and overview

This folder contains LwM2M Client application example, which targets
[B-L475E-IOT01A Discovery kit](https://www.st.com/en/evaluation-tools/b-l475e-iot01a.html), [nRF9160 Development kit](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9160-DK), [Nordic Thingy:91 Prototyping kit](https://www.nordicsemi.com/Products/Development-hardware/Nordic-Thingy-91), [ESP32-DevKitC](https://www.espressif.com/en/products/devkits/esp32-devkitc), [nRF52840 Development kit](https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dk) and [Arduino Nano 33 BLE Sense Lite](https://store.arduino.cc/products/arduino-nano-33-ble-sense).
[B-L475E-IOT01A Discovery kit](https://www.st.com/en/evaluation-tools/b-l475e-iot01a.html), [nRF9160 Development kit](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9160-DK), [Nordic Thingy:91 Prototyping kit](https://www.nordicsemi.com/Products/Development-hardware/Nordic-Thingy-91), [ESP32-DevKitC](https://www.espressif.com/en/products/devkits/esp32-devkitc), [nRF52840 Development kit](https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dk), [nRF7002 Development kit](https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK) and [Arduino Nano 33 BLE Sense Lite](https://store.arduino.cc/products/arduino-nano-33-ble-sense).

There's an alternative configuration for nRF9160DK, revisions 0.14.0 and up, which utilizes external flash chip to perform firmware updates.

It's possible to run the demo on other boards of your choice, by adding appropriate configuration files and aliases for available sensors/peripherals (more info below).

The following LwM2M Objects are supported:

| Target | Objects |
|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Common | Security (/0)<br>Server (/1)<br>Device (/3) |
| B-L475E-IOT01A | **Firmware Update (/5)** (experimental)<br>Temperature (/3303)<br>Humidity (/3304)<br>Accelerometer (/3313)<br>Magnetometer (/3314)<br>Barometer (/3315)<br>Distance (/3330)<br>Gyrometer (/3334)<br>Push button (/3347) |
| nRF9160DK | Connectivity Monitoring (/4)<br>**Firmware Update (/5)**<br>Location (/6, configurable in Kconfig)<br>On/Off switch (/3342)<br>Push button (/3347)<br>ECID-Signal Measurement Information (/10256)<br>Location Assistance (/50001, experimental) |
| Thingy:91 | Connectivity Monitoring (/4)<br>**Firmware Update (/5)**<br>Location (/6, configurable in Kconfig)<br>Temperature (/3303)<br>Humidity (/3304)<br>Accelerometer (/3313)<br>Barometer (/3315)<br>Buzzer (/3338)<br>Push button (/3347)<br>LED color light (/3420)<br>ECID-Signal Measurement Information (/10256)<br>Location Assistance (/50001, experimental) |
| nRF52840DK | Push button (/3347) |
| Arduino Nano 33 Ble Sense Lite | Barometer (/3315)<br>Temperature (/3303) |

The following LwM2M Objects are supported by default:

| Target | Objects |
|--------|---------|
| Common | Security (/0)<br>Server (/1)<br>Device (/3) |
| B-L475E-IOT01A | **Firmware Update (/5)** (experimental)<br>Temperature (/3303)<br>Humidity (/3304)<br>Accelerometer (/3313)<br>Magnetometer (/3314)<br>Barometer (/3315)<br>Distance (/3330)<br>Gyrometer (/3334)<br>Push button (/3347) |
| nRF9160DK | Connectivity Monitoring (/4)<br>**Firmware Update (/5)**<br>Location (/6)<br>On/Off switch (/3342)<br>Push button (/3347)<br>ECID-Signal Measurement Information (/10256)<br>GNSS Assistance (/33625) (experimental)<br>Ground Fix Location (/33626) (experimental, to enable in Kconfig)<br>Advanced Firmware Update (/33629) (experimental, to enable in Kconfig) |
| Thingy:91 | Connectivity Monitoring (/4)<br>**Firmware Update (/5)**<br>Location (/6)<br>Temperature (/3303)<br>Humidity (/3304)<br>Accelerometer (/3313)<br>Barometer (/3315)<br>Buzzer (/3338)<br>Push button (/3347)<br>LED color light (/3420)<br>ECID-Signal Measurement Information (/10256)<br>GNSS Assistance (/33625) (experimental)<br>Ground Fix Location (/33626) (experimental, to enable in Kconfig)<br>Advanced Firmware Update (/33629) (experimental, to enable in Kconfig) |
| nRF52840DK | Push button (/3347) |
| nRF7002DK | Light Control (/3311)<br>Push button (/3347) |
| Arduino Nano 33 BLE Sense Lite | Temperature (/3303)<br>Barometer (/3315) |
> **__NOTE:__**
> Lite version of `Arduino Nano 33 BLE Sense` does NOT contain HTS221 sensor.
Expand All @@ -35,7 +35,7 @@ west update

You can now compile the project for B-L475E-IOT01A using `west build -b disco_l475_iot1` in `demo` directory.

### Compilation guide for nRF9160DK, Thingy:91, nRF52840DK and Arduino Nano 33 BLE Sense
### Compilation guide for nRF9160DK, Thingy:91, nRF7002DK, nRF52840DK and Arduino Nano 33 BLE Sense

Because NCS uses different Zephyr version, it is necessary to change our Zephyr workspace, it is handled by using different manifest file.
Set West manifest path to `Anjay-zephyr-client/demo`, and manifest file to `west-nrf.yml` and do `west update`.
Expand All @@ -44,7 +44,7 @@ west config manifest.path Anjay-zephyr-client/demo
west config manifest.file west-nrf.yml
west update
```
Now you can compile the project using `west build -b nrf9160dk_nrf9160_ns`, `west build -b thingy91_nrf9160_ns`, `west build -b nrf52840dk_nrf52840` or `west build -b arduino_nano_33_ble_sense` in `demo` directory, respectively. The last two commands compiles project for use with the OpenThread network, more about this can be found in the section [Connecting to the LwM2M Server with OpenThread](#connecting-to-the-lwm2m-server-with-openthread).
Now you can compile the project using `west build -b nrf9160dk_nrf9160_ns`, `west build -b thingy91_nrf9160_ns`, `west build -b nrf7002dk_nrf5340_cpuapp`, `west build -b nrf52840dk_nrf52840` or `west build -b arduino_nano_33_ble_sense` in `demo` directory, respectively. The last two commands compiles project for use with the OpenThread network, more about this can be found in the section [Connecting to the LwM2M Server with OpenThread](#connecting-to-the-lwm2m-server-with-openthread).


> **__NOTE:__**
Expand All @@ -70,6 +70,22 @@ However, on nRF9160DK revisions 0.14.0 and up, it is possible to switch to softw
To compile in this configuration, use `west build -b nrf9160dk_nrf9160_ns@0.14.0 -- -DCONF_FILE=prj_extflash.conf -DOVERLAY_CONFIG=overlay_nrf_mbedtls.conf`.
### Compiling with experimental Advanced Firmware Update object
For nRF9160-based targets (nRF9160DK and Thingy:91), it is possible to enable Advanced Firmware Update (/33629) object as an alternative
to Firmware Update (/5) object, which allows for upgrading both application firmware and modem firmware over LwM2M.
`application` instance of aforementioned object is used to update the application firmware, while `modem` instance accepts
[modem firmware delta patches](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.0/nrfxlib/nrf_modem/doc/delta_dfu.html).
Binaries used to update the application are the same as those used in default Firmware Update (/5) object. nRF9160 firmware can be found [here](https://www.nordicsemi.com/Products/nRF9160/Download#infotabs).
To compile in this configuration, use `west build -b <board-name> -- -DOVERLAY_CONFIG=overlay_nrf9160_afu.conf`.
Additionally, on nRF9160DK revisions 0.14.0 and up, it's possible to also update modem firmware using [full firmware packages](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.0/nrfxlib/nrf_modem/doc/bootloader.html).
To compile in this configuration, use `west build -b nrf9160dk_nrf9160_ns@0.14.0 -- -DCONF_FILE=prj_extflash.conf -DOVERLAY_CONFIG=overlay_nrf9160_afu_full.conf`.
## Flashing the target
After successful build you can flash the target using `west flash`.
Expand Down Expand Up @@ -114,6 +130,7 @@ Currently, our demo searches for aliases listed below (they map to appropriate L
- `gyrometer`
- `magnetometer`
- `rgb_pwm`
- `light-control`
- `buzzer_pwm`
- `push-button-[0-2]`
- `switch-[0-2]`
Expand Down Expand Up @@ -168,7 +185,7 @@ west build -b <BOARD> -p -- -DCONFIG_ANJAY_ZEPHYR_RUNTIME_CERT_CONFIG=y
where `<BOARD>` should be replaced by the selected board from `boards/` directory.

> **__NOTE:__**
> Runtime certificate and private key do not work with Thingy:91 and Arduino Nano 33 BLE Sense.
> Runtime certificate and private key do not work with Thingy:91.
This feature works with nrf9160dk starting from revision v0.14.0. For this board use configuration which utilizes external flash chip and software-based cryptography:
```
Expand Down
1 change: 1 addition & 0 deletions demo/boards/arduino_nano_33_ble_sense.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y
CONFIG_MBEDTLS_DTLS=y
CONFIG_MBEDTLS_ENTROPY_ENABLED=y
CONFIG_MBEDTLS_HEAP_SIZE=15360

# Sensors
CONFIG_I2C=y
Expand Down
4 changes: 1 addition & 3 deletions demo/boards/disco_l475_iot1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,4 @@ CONFIG_BOOTLOADER_MCUBOOT=y
# Note: if relative paths are used here, it is treated as
# relative to $WEST_TOPDIR (typically ~/zephyrproject)
CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="bootloader/mcuboot/root-rsa-2048.pem"
# TODO: consider a deploy script, which will fill in the release version into config variable below
# Warning: MCUBoot's imgtool doesn't allow leading zeros in version string components, that may be a bug
CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS="--version 22.8.1"
CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS="--version 23.6.0"
1 change: 1 addition & 0 deletions demo/boards/nrf52840dk_nrf52840.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y
CONFIG_MBEDTLS_DTLS=y
CONFIG_MBEDTLS_ENTROPY_ENABLED=y
CONFIG_MBEDTLS_HEAP_SIZE=12288

# Shell settings
CONFIG_SHELL_MINIMAL=y
Expand Down
45 changes: 45 additions & 0 deletions demo/boards/nrf7002dk_nrf5340_cpuapp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# anjay-zephyr-client
CONFIG_ANJAY_ZEPHYR_DEVICE_MANUFACTURER="Nordic Semiconductor"
CONFIG_ANJAY_ZEPHYR_MODEL_NUMBER="nRF7002DK"

# Anjay Settings
CONFIG_ANJAY_COMPAT_MBEDTLS=y
CONFIG_ANJAY_COMPAT_NET=y
CONFIG_ANJAY_COMPAT_TIME=y
CONFIG_ANJAY_LOG_LEVEL_INF=y
CONFIG_ANJAY_WITH_NET_STATS=n
CONFIG_ANJAY_WITH_SENML_JSON=y
CONFIG_ANJAY_WITH_TRACE_LOGS=n
CONFIG_ANJAY_WITH_ACCESS_CONTROL=n

# General Settings
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_LOG_MAX_LEVEL=3
CONFIG_POSIX_MAX_FDS=16

# Networking
CONFIG_NET_NATIVE=y
CONFIG_NET_DHCPV4=y
CONFIG_DNS_RESOLVER=y

# WiFi
CONFIG_WIFI=y
CONFIG_WIFI_NRF700X=y
CONFIG_WPA_SUPP=y
CONFIG_NET_L2_WIFI_MGMT=y
CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL_ERR=y
CONFIG_NET_L2_ETHERNET=y

# Clock synchronization
CONFIG_DATE_TIME=y
CONFIG_DATE_TIME_UPDATE_INTERVAL_SECONDS=600
CONFIG_DATE_TIME_TOO_OLD_SECONDS=600
CONFIG_DATE_TIME_NTP_QUERY_TIME_SECONDS=5

# File system
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# Heap
CONFIG_HEAP_MEM_POOL_SIZE=200000
8 changes: 8 additions & 0 deletions demo/boards/nrf7002dk_nrf5340_cpuapp.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/ {
aliases {
push-button-0 = &button0;
push-button-1 = &button1;
status-led = &led0;
light-control-0 = &led1;
};
};
4 changes: 1 addition & 3 deletions demo/boards/nrf9160dk_nrf9160_ns.conf
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
# TODO: consider a deploy script, which will fill in the release version into config variable below
# Warning: MCUBoot's imgtool doesn't allow leading zeros in version string components, that may be a bug
CONFIG_MCUBOOT_IMAGE_VERSION="22.12.0"
CONFIG_MCUBOOT_IMAGE_VERSION="23.6.0"

# Shell settings
CONFIG_SHELL_MINIMAL=y
Expand Down
5 changes: 1 addition & 4 deletions demo/boards/nrf9160dk_nrf9160_ns_extflash.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# TODO: consider a deploy script, which will fill in the release version into config variable below
# Warning: MCUBoot's imgtool doesn't allow leading zeros in version string components, that may be a bug
CONFIG_MCUBOOT_IMAGE_VERSION="22.12.0"
CONFIG_MCUBOOT_IMAGE_VERSION="23.6.0"

# External flash
CONFIG_SPI=y
Expand Down
Loading

0 comments on commit a9472b5

Please sign in to comment.