Skip to content

Storage#345

Merged
jtguggedal merged 1 commit intomainfrom
storage
Aug 19, 2025
Merged

Storage#345
jtguggedal merged 1 commit intomainfrom
storage

Conversation

@jtguggedal
Copy link
Copy Markdown
Contributor

@jtguggedal jtguggedal commented Aug 7, 2025

This pull request introduces a new, configurable storage module for the application, supporting both RAM and internal flash backends. It adds Kconfig options for fine-grained control, implements a modular backend interface, and provides a RAM ring buffer backend. The changes also define a flexible system for registering and handling multiple data types for storage, and introduce new shell commands for interacting with the storage module.

New Storage Module Implementation

  • Added a new storage module with configurable Kconfig options, allowing selection between RAM and internal flash backends, control of memory usage, FIFO settings, and shell command support. (Kconfig.storage [1] CMakeLists.txt [2]
  • Implemented a backend interface in storage_backend.h, enabling easy addition of new storage backends (RAM, flash, etc.) via a unified API. (storage_backend.h app/src/modules/storage/storage_backend.hR1-R73)
  • Developed a RAM ring buffer backend for data storage, supporting multiple data types, automatic overwriting of old data, and efficient memory use. (backends/ram_ring_buffer_backend.c app/src/modules/storage/backends/ram_ring_buffer_backend.cR1-R365)

Data Type Registration and Handling

  • Introduced a flexible system for registering and processing multiple storage data types, with helper macros and functions for extracting and checking data from different modules (power, environmental, location). (storage_data_types.c app/src/modules/storage/storage_data_types.cR1-R86)

Storage Module API and Messaging

  • Defined the main storage module API and message structures, including support for various storage operations (buffering, flushing, FIFO, stats) and Zbus channel integration. (storage.h app/src/modules/storage/storage.hR1-R122)

Workflow and Build System Updates

  • Updated the build system and workflow to include the new storage module and its configuration, and made a minor change to the SonarCloud workflow to adjust sanitizer usage. (CMakeLists.txt [1] .github/workflows/sonarcloud.yml [2]

This comment was marked as outdated.

@jtguggedal jtguggedal force-pushed the storage branch 2 times, most recently from ced358c to 0811af6 Compare August 7, 2025 13:32
@jtguggedal jtguggedal requested a review from Copilot August 7, 2025 13:34

This comment was marked as outdated.

@jtguggedal jtguggedal force-pushed the storage branch 7 times, most recently from af89bab to eb04650 Compare August 7, 2025 15:31
@jtguggedal jtguggedal requested a review from Copilot August 8, 2025 06:04

This comment was marked as outdated.

@jtguggedal jtguggedal force-pushed the storage branch 6 times, most recently from f543b37 to a00571a Compare August 11, 2025 12:22
@jtguggedal jtguggedal force-pushed the storage branch 5 times, most recently from 72b51ce to f47d1ce Compare August 19, 2025 09:06
@jtguggedal jtguggedal requested a review from Copilot August 19, 2025 09:10

This comment was marked as outdated.

The storage module adds the ability to buffer data in a chosen
backend. Currently, RAM backend is implemented.

The module subscribes to a list of zbus channels and stores all
the sampled data it receives on those channels, as long as there
is available space. The RAM buffer acts as a ring buffer, where
the oldest entry is discarded if all capacity is used.

There are two operational modes:
- Pass-through: Data is passed on immediately with no storage
- Buffer: Data is stored and passed on when the storage module
  receives a message over its zbus channel to do so.

Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
@sonarqubecloud
Copy link
Copy Markdown

@jtguggedal jtguggedal requested a review from Copilot August 19, 2025 10:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces a comprehensive new storage module for the Asset Tracker Template, providing flexible data storage capabilities with both RAM and internal flash backends. The module implements a state machine-based architecture supporting pass-through mode for real-time data forwarding and buffer mode for persistent storage, along with a batch interface for safe concurrent data access.

  • Adds a configurable storage module with Kconfig options for backend selection, memory limits, and operational modes
  • Implements a modular backend interface with RAM ring buffer backend for efficient FIFO storage
  • Introduces a flexible data type registration system that automatically discovers and handles multiple data types from enabled modules

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.

File Description
tests/module/storage/ Comprehensive test suite with sample data, module tests, and configuration for validating storage functionality
docs/modules/storage.md Detailed documentation covering architecture, API usage, configuration options, and implementation guidelines
app/src/modules/storage/ Core storage module implementation including state machine, backend interface, data type registration, and shell commands

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jtguggedal jtguggedal merged commit b38c021 into main Aug 19, 2025
5 checks passed
@jtguggedal jtguggedal deleted the storage branch August 19, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants