-
Notifications
You must be signed in to change notification settings - Fork 1
Raw Datalogger #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Raw Datalogger #340
Conversation
There was a problem hiding this 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 PR introduces a new raw datalogger system that writes directly to flash memory without using a filesystem, addressing determinism and corruption issues previously encountered with LittleFS in flight software. The raw datalogger supports three modes: Fixed (stops when full), LinkedFixed (creates linked sections in available space), and LinkedTruncate (creates linked sections with size truncation).
Key changes:
- Implements a new
CRawDataLoggertemplate class for direct flash logging with metadata structure and linked list capabilities - Renames existing filesystem-based datalogger from
CDataLoggertoCFsDataLoggerto distinguish it from the raw implementation - Updates all existing usage to use the renamed
CFsDataLoggerclass
Reviewed Changes
Copilot reviewed 21 out of 24 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
include/f_core/os/c_raw_datalogger.h |
New raw datalogger implementation with flash-based logging |
include/f_core/os/c_fs_datalogger.h |
Renamed class from CDataLogger to CFsDataLogger |
include/f_core/os/tenants/c_datalogger_tenant.h |
Updated to use renamed CFsDataLogger |
app/samples/raw_datalogger/ |
Complete sample application demonstrating raw datalogger modes |
| Multiple application files | Updated references from CDataLogger to CFsDataLogger |
west.yml |
Added fatfs dependency and removed duplicate hal_st entry |
lib/f_core/Kconfig |
Added hash function dependencies for raw datalogger |
Files not reviewed (2)
- app/backplane/sensor_module/.idea/editor.xml: Language not supported
- app/backplane/sensor_module/.idea/vcs.xml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…unch-Initiative/FSW into feature/Aaron/FlashLogger
| #include <f_core/messaging/c_msgq_message_port.h> | ||
| #include <f_core/os/n_rtos.h> | ||
| #include <f_core/utils/n_time_utils.h> | ||
| #include <f_core/os/c_raw_datalogger.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make the 512 on line 17 something like 12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im making hw give you less ram next time so you learn
| currentLogSize(logSize), currentOffset(sizeof(DataloggerMetadata)), nextLogAddress(0) { | ||
| resetBuffers(); | ||
|
|
||
| int ret = flash_get_size(flash, &flashSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like it will make the max size of this partition the max size of the flash itself. That kinda undoes any benefit that using the fixed partition api and 'sharing the flash' like we discussed i think you wanna take in the partition size in the constructor (and the macro)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: conversation we had, flashDev arg / flash dev should be flash area and flash writes should be flash area writes
also, action item to make apple crisp in 2 weeks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, we're going to move this feature to a branch we develop for the November Launch so it doesnt get merged in a half-baked way.
Branch created off of main: NovemberTestLaunch
Description
Filesystems are normally not used in flight software applications for a number of reasons (non-determinism, limited resources, corruption risk, etc.). Even though LittleFS mitigates a few of these issues, having it can still be non-deterministic and files were still corrupted in sensor module from its last flight. This made it difficult to try and recover flight data. By doing raw logging, we can just dump the flash contents and identify where log files are located easier.
This new system will log data raw to the flash chip. There are several modes
Each log file starts with a 32 byte metadata structure. This includes a
Note: There will definitely be improvements/changes that would need to be made to this as this gets integrated into actual flight applications and edge cases are caught for running our use cases. Still need reading capabilities as well. Planning a wrapper as well for persistently caching where logs are located.
Type of change
How Has This Been Tested?
Ran sample through native_sim testing the different modes and hexdumped the flash binary

Checklist: