Skip to content

Commit

Permalink
Anjay-zephyr-client 22.08
Browse files Browse the repository at this point in the history
Features:
- Added support for factory provisioning
- Added `nls_agps_req` shell command for Nordic Location Services A-GPS testing purposes

Improvements:
- Updated Anjay-zephyr to 3.1.1
- Updated static partition definitions
- Improved logging in Location Assistance object
- Cleaned up use of logging statements
- Separated factory provisioning-related code from the main application

Bugfixes:
- Enabled full printf to work with Zephyr SDK 0.14.2
- Fixed PWM code for Thingy:91
- LwM2M 1.1 is not enforced anymore when using persistence
- Fixed memleak in persist_target_to_settings()
  • Loading branch information
Mateusz Kwiatkowski committed Aug 5, 2022
1 parent 7aa3399 commit 44ea5a1
Show file tree
Hide file tree
Showing 45 changed files with 1,291 additions and 393 deletions.
66 changes: 39 additions & 27 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,73 @@
# Changelog

## 22.08 (Aug 5th, 2022)

### Features
- Added support for factory provisioning
- Added `nls_agps_req` shell command for Nordic Location Services A-GPS testing purposes

### Improvements
- Updated Anjay-zephyr to 3.1.1
- Updated static partition definitions
- Improved logging in Location Assistance object
- Cleaned up use of logging statements
- Separated factory provisioning-related code from the main application

### Bugfixes
- Enabled full printf to work with Zephyr SDK 0.14.2
- Fixed PWM code for Thingy:91
- LwM2M 1.1 is not enforced anymore when using persistence
- Fixed memleak in persist_target_to_settings()

## 22.06 (Jun 21st, 2022)

### Improvements
- Updated Anjay-zephyr to 3.0.0
- Reformatted code so it meets Zephyr standards

### Added

### Features
- Implemented Location Assistance object
- Implemented Connectivity Monitoring object
- Added shell command to enable runtime lifetime reconfiguration
- Added persistence implementation

## 22.03 (Mar 24th, 2022)

- Updated Anjay-zephyr to 2.14.1
- Updated Zephyr to 2.7.0
- Updated sdk-nrf to 1.9.1
- Updated ei_demo to use the Edge Impulse wrapper from sdk-nrf

### Added

### Features
- Added support for firmware update

### Improvements

- Made GPS support configurable through Kconfig
- Migrated nRF targets to use nrfxlib sockets
- Migrated configuration to use Zephyr settings API
- Updated Anjay-zephyr to 2.14.1
- Updated Zephyr to 2.7.0
- Updated sdk-nrf to 1.9.1
- Updated ei_demo to use the Edge Impulse wrapper from sdk-nrf

### Fixes

### Bugfixes
- Made the code more thread-safe
- Fixed erroneous uses of memset()

## 21.10 (Oct 11th, 2021)

- Updated Anjay-zephyr to 2.14.0

### Added

### Features
- Edge Impulse example
- L475 support in minimal client
- nRF9160 DK support in minimal client
- Thingy:91 support in minimal client

### Improvements

- Cleaner code using Anjay event loop
- Simpler demo implementation using Anjay IPSO objects
- Updated Anjay-zephyr to 2.14.0

### Fixes

### Bugfixes
- Fixed global names

## 21.07 (Jul 30th, 2021)

- Updated Anjay-zephyr to 2.13.0
- Updated Zephyr to 2.6.0
- Updated sdk-nrf to 1.6.0

### Added
### Features
- Moved client containing all features to demo folder
- Minimal client example for qemu_x86
- Support for Thingy:91 in demo application
Expand All @@ -71,22 +78,27 @@
- Changed regulatory domain on eS-WiFi modem to World Wide
- Sensor objects implementation depends on sensor presence, rather than
board name.
- Updated Anjay-zephyr to 2.13.0
- Updated Zephyr to 2.6.0
- Updated sdk-nrf to 1.6.0

## 21.06 (Jun 7th, 2021)

### Added
### Improvements
- Use Anjay-zephyr 2.11.1 integration layer
- Use Zephyr v2.5.0
- Use Zephyr logger as log handler

## 20.10 (Oct 1st, 2020)

### Added
### Features
- Add initial support for nRF9160DK board

### Fixed
### Bugfixes
- Fix assertion failure when invalid URI is passed
- Fix problem with invalid file state after write

## 20.07 (Jul 7th, 2020)

### Features
- Initial release
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The following examples are present:

| Directory | Description |
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| demo/ | Showcase example implementing all features and sensors available on board. Supported boards:<br>[B-L475E-IOT01A Discovery kit](https://www.st.com/en/evaluation-tools/b-l475e-iot01a.html)<br>[nRF9160 Development kit](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9160-DK)<br>[Nordic Thingy:91 Prototyping kit](https://www.nordicsemi.com/Products/Development-hardware/Nordic-Thingy-91)<br>any other board of your choice (by adding appropriate `*.conf`/`*.overlay` files). FOTA support for selected boards.|
| demo/ | Showcase example implementing all features and sensors available on board. Supports experimental **factory provisioning** feature of Anjay 3.0. Supported boards:<br>[B-L475E-IOT01A Discovery kit](https://www.st.com/en/evaluation-tools/b-l475e-iot01a.html)<br>[nRF9160 Development kit](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9160-DK)<br>[Nordic Thingy:91 Prototyping kit](https://www.nordicsemi.com/Products/Development-hardware/Nordic-Thingy-91)<br>any other board of your choice (by adding appropriate `*.conf`/`*.overlay` files). FOTA support for selected boards.|
| minimal/ | Minimalistic client samples which may serve as a base for specific application. Supported boards/targets:<br>[qemu_x86](https://docs.zephyrproject.org/latest/boards/x86/qemu_x86/doc/index.html)<br>[B-L475E-IOT01A Discovery kit](https://www.st.com/en/evaluation-tools/b-l475e-iot01a.html)<br>[nRF9160 Development kit](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9160-DK)<br>[Nordic Thingy:91 Prototyping kit](https://www.nordicsemi.com/Products/Development-hardware/Nordic-Thingy-91)|
| ei_demo/ | An example containing motion recognition model, built with Edge Impulse. Supported boards/targets:<br>[Nordic Thingy:91 Prototyping kit](https://www.nordicsemi.com/Products/Development-hardware/Nordic-Thingy-91)|

Expand Down Expand Up @@ -101,12 +101,12 @@ started by choosing Actions -> Build.

To connect to [Coiote IoT Device
Management](https://www.avsystem.com/products/coiote-iot-device-management-platform/)
LwM2M Server, please register at https://www.avsystem.com/try-anjay/. Then have
LwM2M Server, please register at https://eu.iot.avsystem.cloud/. Then have
a look at the example configuration to configure security credentials and other
necessary settings (like Wi-Fi SSID etc.).

[Video guide showing basic usage of Try-Anjay](https://www.youtube.com/watch?v=fgy38XfttM8)
is available on YouTube.
[Guide showing basic usage of Coiote DM](https://iotdevzone.avsystem.com/docs/Coiote_DM_Device_Onboarding/Quick_start/)
is available on IoT Developer Zone.

> **__NOTE:__**
> You may use any LwM2M Server compliant with LwM2M 1.0 TS. The server URI can
Expand Down
136 changes: 87 additions & 49 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,6 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(anjay_zephyr_demo)
set(root_dir ${ANJAY_ZEPHYR_CLIENT_DIR})

set(app_common_sources
src/anjay_shell.c
src/common.h
src/config.c
src/config.h
src/default_config.h
src/firmware_update.h
src/gps.h
src/main.c
src/persistence.h
src/status_led.c
src/status_led.h
src/utils.c
src/utils.h
src/objects/basic_sensors.c
src/objects/buzzer.c
src/objects/device.c
src/objects/led_color_light.c
src/objects/location.c
src/objects/objects.h
src/objects/push_button.c
src/objects/switch.c
src/objects/three_axis_sensors.c)

if(CONFIG_ANJAY_CLIENT_GPS_NRF)
list(APPEND app_common_sources
src/gps_impl/gps_nrf.c)
endif()

if(CONFIG_ANJAY_CLIENT_NRF_LC_INFO)
list(APPEND app_common_sources
src/nrf_lc_info.c
src/nrf_lc_info.h
src/objects/conn_mon.c
src/objects/ecid.c)
endif()

if(CONFIG_ANJAY_CLIENT_LOCATION_SERVICES)
list(APPEND app_common_sources
src/objects/loc_assist.c)
endif()

if(CONFIG_ANJAY_CLIENT_FOTA)
# defined in nrf/cmake/partition_manager.cmake
if(NOT EXISTS "${static_configuration_file}")
Expand All @@ -75,15 +33,95 @@ if(CONFIG_ANJAY_CLIENT_FOTA)

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

list(APPEND app_common_sources
src/firmware_update.c)
endif()

if(CONFIG_ANJAY_CLIENT_PERSISTENCE)
list(APPEND app_common_sources
src/persistence.c)
if(CONFIG_ANJAY_CLIENT_FACTORY_PROVISIONING_INITIAL_FLASH)
set(app_sources
src/config.c
src/config.h
src/persistence.c
src/persistence.h
src/utils.c
src/utils.h
src/factory_provisioning/factory_flash.c
src/factory_provisioning/factory_flash.h
src/factory_provisioning/provisioning_app.c)
else()
set(app_sources
src/anjay_shell.c
src/common.h
src/config.c
src/config.h
src/default_config.h
src/firmware_update.h
src/gps.h
src/main_app.c
src/persistence.h
src/status_led.c
src/status_led.h
src/utils.c
src/utils.h
src/objects/basic_sensors.c
src/objects/buzzer.c
src/objects/device.c
src/objects/led_color_light.c
src/objects/location.c
src/objects/objects.h
src/objects/push_button.c
src/objects/switch.c
src/objects/three_axis_sensors.c)

if(CONFIG_ANJAY_CLIENT_PERSISTENCE)
list(APPEND app_sources
src/persistence.c)
endif()

if(CONFIG_ANJAY_CLIENT_GPS_NRF)
list(APPEND app_sources
src/gps_impl/gps_nrf.c)
endif()

if(CONFIG_ANJAY_CLIENT_NRF_LC_INFO)
list(APPEND app_sources
src/nrf_lc_info.c
src/nrf_lc_info.h
src/objects/conn_mon.c
src/objects/ecid.c)
endif()

if(CONFIG_ANJAY_CLIENT_LOCATION_SERVICES)
list(APPEND app_sources
src/objects/loc_assist.c)
endif()

if(CONFIG_ANJAY_CLIENT_FOTA)
list(APPEND app_sources
src/firmware_update.c)
endif()
endif()

target_sources(app PRIVATE
${app_common_sources})
${app_sources})

if(CONF_FILE_BUILD_TYPE STREQUAL "extflash" AND CONFIG_BOOTLOADER_MCUBOOT)
# This is a workaround for a bug in nCS' integration with TF-M.
#
# When MCUboot and TF-M are both in use, the CONFIG_BOOTLOADER_MCUBOOT
# option is propagated to TF-M (https://github.com/nrfconnect/sdk-nrf/blob/v2.0.0/modules/tfm/zephyr/CMakeLists.txt#L115),
# which in turn enables the BL2 option (https://github.com/nrfconnect/sdk-nrf/blob/v2.0.0/modules/tfm/tfm/boards/CMakeLists.txt#L34)
# and that declares a flash region (https://github.com/nrfconnect/sdk-trusted-firmware-m/blob/v1.5.0-ncs2/platform/ext/target/nordic_nrf/common/nrf9160/target_cfg.c#L420)
# which TF-M will try to configure as non-secure
# (https://github.com/nrfconnect/sdk-trusted-firmware-m/blob/v1.5.0-ncs2/platform/ext/target/nordic_nrf/common/nrf9160/target_cfg.c#L552).
#
# Because the hardware flash protection only works for the internal flash,
# and these addresses are not valid in that context, the MCU hard-faults and
# consequently enters a boot loop.
#
# This workaround overrides the CONFIG_BOOTLOADER_MCUBOOT setting, so that
# BL2 macro is not defined, and this issue does not happen.
#
# See also the bug report on Nordic DevZone:
# https://devzone.nordicsemi.com/f/nordic-q-a/89735/nrf9160-external-flash-mcuboot-buggy-flash-protection-configuration-in-sdk
set_property(TARGET zephyr_property_target APPEND PROPERTY TFM_CMAKE_OPTIONS
-DCONFIG_BOOTLOADER_MCUBOOT=FALSE)
endif()
34 changes: 29 additions & 5 deletions demo/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ menuconfig ANJAY_CLIENT_GPS_NRF
help
Attempt to retrieve A-GPS data using Nordic Location Services over LwM2M.

This is a experimental feature under active development, which is currently
This is an experimental feature under active development, which is currently
available only on selected instances of AVSystem's Coiote IoT DM servers.

config ANJAY_CLIENT_LOCATION_SERVICES_MANUAL_CELL_BASED
Expand All @@ -72,7 +72,7 @@ config ANJAY_CLIENT_LOCATION_SERVICES_MANUAL_CELL_BASED
Enable "anjay nls_cell_request" command for retrieving cell-based location using
Nordic Location Services over LwM2M.

This is a experimental feature under active development, which is currently
This is an experimental feature under active development, which is currently
available only on selected instances of AVSystem's Coiote IoT DM servers.

config ANJAY_CLIENT_NRF_LC_INFO
Expand All @@ -92,15 +92,39 @@ config ANJAY_CLIENT_FOTA

config ANJAY_CLIENT_PERSISTENCE
bool "Enable persistence"
# FIXME: This shouldn't be required, but currently using LwM2M 1.0
# with structured credentials bug in Anjay causes some hardfaults to pop up
select ANJAY_WITH_LWM2M11
select ANJAY_WITH_ACCESS_CONTROL
select ANJAY_WITH_MODULE_ACCESS_CONTROL
help
Enables persistence of Access Control Object, Attribute Storage, Security Object
and Server Object.

config ANJAY_CLIENT_FACTORY_PROVISIONING
bool "Use factory provisioning"
depends on ANJAY_CLIENT_PERSISTENCE
help
Use the Factory Provisioning process to configure the client instead of CLI.

This option causes the client to load the provisioned settings at boot and disables
the shell commands that would allow modifying them.

To provision the settings for use with this configuration, please flash a firmware
compiled with (TBD) enabled first.

config ANJAY_CLIENT_FACTORY_PROVISIONING_INITIAL_FLASH
bool "Build the app in initial flashing mode"
depends on ANJAY_CLIENT_FACTORY_PROVISIONING
select ANJAY_WITH_CBOR
select ANJAY_WITH_MODULE_FACTORY_PROVISIONING
select FILE_SYSTEM
select MCUMGR
select MCUMGR_CMD_FS_MGMT
select MCUMGR_SMP_SHELL
select UART_CONSOLE_MCUMGR
help
An application built in this mode will not perform any normal LwM2M client
operation, but instead it will allow to perform the initial flashing of the factory
provisioning data.

endmenu

source "Kconfig.zephyr"
16 changes: 13 additions & 3 deletions demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ Additionally, you can define `status-led` alias for a LED, which blinks when Anj

To connect to [Coiote IoT Device
Management](https://www.avsystem.com/products/coiote-iot-device-management-platform/)
LwM2M Server, please register at https://www.avsystem.com/try-anjay/. Then have
LwM2M Server, please register at https://eu.iot.avsystem.cloud/. Then have
a look at the Configuration menu to configure security credentials and other
necessary settings (like Wi-Fi SSID etc.).

[Video guide showing basic usage of Try-Anjay](https://www.youtube.com/watch?v=fgy38XfttM8)
is available on YouTube.
[Guide showing basic usage of Coiote DM](https://iotdevzone.avsystem.com/docs/Coiote_DM_Device_Onboarding/Quick_start/)
is available on IoT Developer Zone.

NOTE: You may use any LwM2M Server compliant with LwM2M 1.0 TS. The server URI
can be changed in the Configuration menu.
Expand Down Expand Up @@ -126,3 +126,13 @@ Subcommands:
## Upgrading the firmware over-the-air

To upgrade the firmware, upload `build/zephyr/app_update.bin` file using standard means of LwM2M Firmware Update object.

## Factory provisioning (experimental)

This application supports experimental factory provisioning feature of Anjay 3.0, thanks
to which the user is able to pre-provision credentials to the device using a specially
tailored version of the application. This feature allows to easily pre-provision large
quantities of devices in a semi-automatic manner.

To use this feature, generate a special file containing the credentials using our [Factory Provisioning Tool](https://avsystem.github.io/Anjay-doc/Tools/FactoryProvisioning.html).
Then, follow the flow described in `src/factory_provisioning/factory_flash.c` file to finish the process.
Loading

0 comments on commit 44ea5a1

Please sign in to comment.