Skip to content

Commit

Permalink
chore: update asset tracker from upstream + bump memfault (#69)
Browse files Browse the repository at this point in the history
### Summary

This PR updates the asset tracker application to the latest upstream
version using the [recently synced `dogfood` branch](memfault/sdk-nrf@2e8bda0) from our NCS fork.
Command used:

```
diff -duwr memfault-asset-tracker/ nrf/applications/asset_tracker_v2/ | patch -p0
```

Updating memfault to the latest version otherwise we hit the `CONFIG_MBEDTLS_SHA1` build
failure that was fixed in 1.12.0.

Additionally, there was an [unexpected build failure in CI](https://github.com/memfault/memfault-asset-tracker/actions/runs/11443614998/job/31837392151#step:6:2177) when building the meta
file that I can't reproduce, and isn't fixed by blasting the cache or running a full west update...
Disabled meta file building in CI for now.

 ### Test Plan

 Built locally & flashed a thingy91.

---
Resolves: MCU-739
  • Loading branch information
gminn authored Oct 25, 2024
1 parent a86fe67 commit b577d86
Show file tree
Hide file tree
Showing 30 changed files with 102 additions and 204 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ jobs:
build:
runs-on: ubuntu-latest

# Image generated from: https://github.com/memfault/memfault-port-playground/tree/master/docker/nrf-connect-sdk
container:
image: memfault/nrf-connect-sdk:2024-01-05
image: ghcr.io/memfault/nrf-connect-sdk:2024-10-07
steps:
- uses: actions/checkout@v3

Expand All @@ -35,7 +34,7 @@ jobs:
run: |
${ZEPHYR_SDK_INSTALL_DIR}/setup.sh -c
- name: Build app without Memfault overlay
- name: Setup west workspace
run: |
cd $GITHUB_WORKSPACE
cd ../
Expand All @@ -47,18 +46,35 @@ jobs:
west update --narrow -o=--depth=1 -o=--recurse-submodules --path-cache ~/zephyr-thingy91-path-cache
pip install -r zephyr/scripts/requirements.txt
pip install -r nrf/scripts/requirements-build.txt
west build -b thingy91/nrf9160/ns -p always memfault-asset-tracker
- name: Build app without Memfault overlay
run: |
cd $GITHUB_WORKSPACE
cd ../
python -m venv venv
. venv/bin/activate
# disable building meta file, it is unexpectedly causing the build to
# fail in CI
west build -b thingy91/nrf9160/ns -p always memfault-asset-tracker -- \
-DCONFIG_BUILD_OUTPUT_META=n \
-Dmcuboot_CONFIG_BUILD_OUTPUT_META=n
- name: Build app with Memfault overlay
run: |
cd $GITHUB_WORKSPACE
cd ../
. venv/bin/activate
# disable building meta file, it is unexpectedly causing the build to
# fail in CI
west build -b thingy91/nrf9160/ns -p always memfault-asset-tracker -- \
-DCONFIG_MEMFAULT_NCS_PROJECT_KEY=\"DUMMY_KEY\" \
-DOVERLAY_CONFIG=overlay-memfault.conf \
-DCONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y \
-DCONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.SOFTWARE_VERSION }}\"
-DCONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.SOFTWARE_VERSION }}\" \
-DCONFIG_BUILD_OUTPUT_META=n \
-Dmcuboot_CONFIG_BUILD_OUTPUT_META=n
rm -rf ~/zephyr-thingy91-path-cache
cp -r ${PWD} ~/zephyr-thingy91-path-cache
Expand Down
2 changes: 1 addition & 1 deletion Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ config SECURE_BOOT_APPCORE
|| BOARD_NRF9151DK_NRF9151_NS \
|| BOARD_NRF9161DK_NRF9161_NS

config WIFI_NRF700X
config WIFI_NRF70
default y if BOARD_THINGY91X_NRF9151_NS

config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
Expand Down
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ Asset Tracker v2
:local:
:depth: 2

The Asset Tracker v2 is a real-time configurable ultra-low power capable application firmware for the nRF91 Series :term:`System in Package (SiP)`.
.. important::
|ATv2_maintenance_note|

Asset Tracker v2 is a real-time configurable ultra-low power capable application firmware for the nRF91 Series :term:`System in Package (SiP)`.

See the subpages for detailed documentation on the application and its modules:

Expand Down
6 changes: 3 additions & 3 deletions boards/thingy91x_nrf9151_ns.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ CONFIG_ADXL367_ACTIVITY_TIME=0

# configs for Wi-Fi
CONFIG_WIFI=y
CONFIG_WIFI_NRF700X=y
CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC=y
CONFIG_WIFI_NRF70=y
CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC=y
# Align this with CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT
CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT=10

Expand All @@ -50,7 +50,7 @@ CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE=4096
CONFIG_NRF_MODEM_LIB_SHMEM_RX_SIZE=4096

# Scan only using offload API
CONFIG_WPA_SUPP=n
CONFIG_WIFI_NM_WPA_SUPPLICANT=n

# For nRF9160 the default is socket interface
CONFIG_NET_DEFAULT_IF_ETHERNET=y
Expand Down
3 changes: 0 additions & 3 deletions configuration/memfault/memfault_metrics_heartbeat_config.def
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
* Please refer to https://docs.memfault.com/docs/embedded/metrics-api for more details.
*/

MEMFAULT_METRICS_KEY_DEFINE(gnss_time_to_fix_ms, kMemfaultMetricType_Unsigned)
MEMFAULT_METRICS_KEY_DEFINE(gnss_satellites_tracked_count, kMemfaultMetricType_Unsigned)
MEMFAULT_METRICS_KEY_DEFINE(location_timeout_search_time_ms, kMemfaultMetricType_Unsigned)
MEMFAULT_METRICS_KEY_DEFINE(battery_voltage_mv, kMemfaultMetricType_Unsigned)
3 changes: 3 additions & 0 deletions doc/app_behavior.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Application behavior and functionality
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

This section describes the general functioning of the Asset Tracker v2 application.

Data types
Expand Down
5 changes: 3 additions & 2 deletions doc/app_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Application module
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The application module controls key mechanisms in the Asset Tracker v2.
It decides when to sample data, what types of data to sample, and has explicit control over some aspects of the application.

Expand Down Expand Up @@ -78,5 +81,3 @@ API documentation
| Source files: :file:`asset_tracker_v2/src/events/app_module_event.c`, :file:`asset_tracker_v2/src/main.c`
.. doxygengroup:: app_module_event
:project: nrf
:members:
3 changes: 3 additions & 0 deletions doc/asset_tracker_v2_description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Application description
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The Asset Tracker v2 application is built on the following principles:

* Ultra-low power by design - The application highlights the power saving features of the nRF91 Series SiP, which is critical for successfully developing small form-factor devices and products which need very long battery lifetime.
Expand Down
5 changes: 3 additions & 2 deletions doc/cloud_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Cloud module
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The cloud module establishes and maintains the connection to a supported cloud service.
It uses the :ref:`Cloud wrapper API <api_cloud_wrapper>` to integrate and handle the client libraries present in the |NCS|.

Expand Down Expand Up @@ -258,5 +261,3 @@ API documentation
:file:`asset_tracker_v2/src/modules/cloud_module.c`
.. doxygengroup:: cloud_module_event
:project: nrf
:members:
5 changes: 3 additions & 2 deletions doc/cloud_wrapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Cloud wrapper API
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The cloud wrapper API is a generic API used for controlling the connection to a supported |NCS| client library through :ref:`Integration layers <integration_layers>`.
It exposes generic functions such as ``send``, ``connect``, and ``disconnect``, hiding the functionality that is specific to a single client library implementation.

Expand Down Expand Up @@ -317,5 +320,3 @@ API documentation
:file:`asset_tracker_v2/src/cloud/lwm2m_integration.c`
.. doxygengroup:: cloud_wrapper
:project: nrf
:members:
5 changes: 3 additions & 2 deletions doc/data_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Data module
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The data module gathers data that has been sampled by other modules in the system and stores it into ring buffers.
It keeps track of data requested by the :ref:`asset_tracker_v2_app_module` and decides when data is sent to the cloud.

Expand Down Expand Up @@ -188,5 +191,3 @@ API documentation
| Source files: :file:`asset_tracker_v2/src/events/data_module_event.c`, :file:`asset_tracker_v2/src/modules/data_module.c`
.. doxygengroup:: data_module_event
:project: nrf
:members:
13 changes: 4 additions & 9 deletions doc/debug_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Debug module
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The debug module intends to improve the overall debugging experience in the application.
By default, it subscribes to all the events in the system and implements support for `Memfault`_ through the :ref:`mod_memfault` module integrated in |NCS|.

Expand All @@ -22,13 +25,7 @@ This section documents the various features implemented by the module.
Memfault
========

The debug module uses `Memfault SDK`_ to track |NCS| specific metrics such as LTE and stack metrics.
In addition, the following types of custom Memfault metrics are defined and tracked when compiling in the debug module:

* ``gnss_time_to_fix_ms`` - Time duration between the start of a GNSS search and obtaining a fix.
* ``gnss_satellites_tracked_count`` - Number of satellites tracked during a GNSS search window.
* ``location_timeout_search_time_ms`` - Time duration between the start of a location search and a search timeout.

The debug module uses `Memfault SDK`_ to track |NCS| specific metrics such as LTE, location, Bluetooth and stack metrics.
The debug module also implements `Memfault SDK`_ software watchdog, which is designed to trigger an assert before an actual watchdog timeout.
This enables the application to be able to collect coredump data before a reboot occurs.

Expand Down Expand Up @@ -111,5 +108,3 @@ API documentation
| Source files: :file:`asset_tracker_v2/src/events/debug_module_event.c`
.. doxygengroup:: debug_module_event
:project: nrf
:members:
3 changes: 3 additions & 0 deletions doc/firmware_architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Firmware architecture
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The Asset Tracker v2 application has a modular structure, where each module has a defined scope of responsibility.
The application makes use of the :ref:`app_event_manager` to distribute events between modules in the system.
The Application Event Manager is used for all the communication between the modules.
Expand Down
5 changes: 3 additions & 2 deletions doc/location_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Location module
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The location module controls the GNSS, cellular and Wi-Fi positioning functionality.
It can be used to retrieve the location of the device in the form of events containing a position, velocity and time (PVT) structure.

Expand Down Expand Up @@ -155,5 +158,3 @@ API documentation
| Source files: :file:`asset_tracker_v2/src/events/location_module_event.c`
.. doxygengroup:: location_module_event
:project: nrf
:members:
4 changes: 4 additions & 0 deletions doc/lwm2m_carrier_library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Using the carrier library
#########################

.. important::
|ATv2_maintenance_note|


.. |application_sample_name| replace:: Asset Tracker v2 application

.. include:: /includes/lwm2m_carrier_library.txt
5 changes: 3 additions & 2 deletions doc/modem_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Modem module
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The modem module communicates with the modem to control the LTE connection and retrieve information from the modem about the device and LTE network.

Features
Expand Down Expand Up @@ -137,5 +140,3 @@ API documentation
| Source files: :file:`asset_tracker_v2/src/events/modem_module_event.c`, :file:`asset_tracker_v2/src/modules/modem_module.c`
.. doxygengroup:: modem_module_event
:project: nrf
:members:
4 changes: 4 additions & 0 deletions doc/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Application modules
###################

.. important::
|ATv2_maintenance_note|


The Asset Tracker v2 application consists of a set of modules.
See :ref:`asset_tracker_v2_architecture` for more information on how the application is structured.

Expand Down
5 changes: 3 additions & 2 deletions doc/modules_common.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Modules common API
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The Modules common API provides the functionality to administer mechanisms in the application architecture, and consist of functions that are shared between modules.
The API supports the following functionalities:

Expand All @@ -22,5 +25,3 @@ API documentation
| Source files: :file:`asset_tracker_v2/src/modules_common.c`
.. doxygengroup:: modules_common
:project: nrf
:members:
9 changes: 5 additions & 4 deletions doc/sensor_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Sensor module
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The sensor module interacts with external sensors present on the `Thingy:91 <Thingy\:91 product page_>`_ and Thingy:91 X.
It collects environmental data and detects motion over a set threshold value.

Expand Down Expand Up @@ -36,7 +39,7 @@ The following table lists the sensors and sensor data types supported by the mod
| Acceleration (Impact) | `ADXL372`_ |
+-------------------------+-----------------+

The module controls and collects data from the sensors by interacting with their :ref:`device drivers <device_model_api>` using :ref:`Zephyr's generic sensor API <sensor_api>`.
The module controls and collects data from the sensors by interacting with their :ref:`device drivers <device_model_api>` using :ref:`Zephyr's generic sensor API <sensor>`.

Thingy:91 X has a `BME688`_ gas sensor and `ADXL367`_ motion sensor that can be used by the :ref:`asset_tracker_v2_sensor_module` module.

Expand Down Expand Up @@ -189,7 +192,7 @@ Dependencies

This module uses the following Zephyr API:

* :ref:`Generic sensor API <sensor_api>`
* :ref:`Generic sensor API <sensor>`

API documentation
*****************
Expand All @@ -199,5 +202,3 @@ API documentation
:file:`asset_tracker_v2/src/modules/sensor_module.c`
.. doxygengroup:: sensor_module_event
:project: nrf
:members:
5 changes: 3 additions & 2 deletions doc/ui_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ User Interface module
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The User Interface module controls and monitors the UI elements on nRF91 Series development kits, Thingy:91, and Thingy:91 X.

Features
Expand Down Expand Up @@ -115,5 +118,3 @@ API documentation
| Source files: :file:`asset_tracker_v2/src/events/ui_module_event.c`, :file:`asset_tracker_v2/src/modules/ui_module.c`
.. doxygengroup:: ui_module_event
:project: nrf
:members:
3 changes: 3 additions & 0 deletions doc/unit_test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Unit tests
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The internal modules of the :ref:`asset_tracker_v2` application have a set of unit tests in the :file:`asset_tracker_v2/tests` folder.
Following are the modules that have unit tests:

Expand Down
5 changes: 3 additions & 2 deletions doc/util_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Utility module
:local:
:depth: 2

.. important::
|ATv2_maintenance_note|

The utility module provides the functionality to administer and monitor mechanisms in the application architecture.

Features
Expand Down Expand Up @@ -89,5 +92,3 @@ API documentation
| Source files: :file:`asset_tracker_v2/src/events/util_module_event.c`, :file:`asset_tracker_v2/src/modules/util_module.c`
.. doxygengroup:: util_module_event
:project: nrf
:members:
1 change: 1 addition & 0 deletions overlay-memfault.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CONFIG_MEMFAULT_NCS_PROJECT_KEY=""
CONFIG_MEMFAULT_NCS_DEVICE_ID_IMEI=y
CONFIG_MEMFAULT_NCS_LTE_METRICS=y
CONFIG_MEMFAULT_NCS_STACK_METRICS=y
CONFIG_MEMFAULT_NCS_LOCATION_METRICS=y
CONFIG_MEMFAULT_LOGGING_ENABLE=y

CONFIG_MEMFAULT_ROOT_CERT_STORAGE_NRF9160_MODEM=y
Expand Down
Loading

0 comments on commit b577d86

Please sign in to comment.