Skip to content
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

Add abstraction for storing persistent variables #307

Merged
merged 40 commits into from
Aug 31, 2024
Merged

Conversation

PatrickKa
Copy link
Contributor

Fixes #202

@PatrickKa PatrickKa force-pushed the persistent-variable branch 3 times, most recently from d8feb4e to 2ea234e Compare August 3, 2024 23:07
@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 95.93023% with 14 lines in your changes missing coverage. Please review.

Project coverage is 93.84%. Comparing base (5f4baab) to head (6a6594c).

Files with missing lines Patch % Lines
Sts1CobcSw/PersistentState/PersistentVariable.ipp 77.77% 6 Missing ⚠️
Tests/UnitTests/UnitTestThread.cpp 71.42% 4 Missing ⚠️
Sts1CobcSw/Utility/TimeTypes.ipp 0.00% 3 Missing ⚠️
Sts1CobcSw/Utility/Crc32Software.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #307      +/-   ##
==========================================
- Coverage   94.06%   93.84%   -0.22%     
==========================================
  Files          22       38      +16     
  Lines         657     1008     +351     
  Branches        0       18      +18     
==========================================
+ Hits          618      946     +328     
- Misses         39       62      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PatrickKa PatrickKa force-pushed the persistent-variable branch 5 times, most recently from 36af2e6 to 766ed45 Compare August 27, 2024 21:25
@PatrickKa PatrickKa changed the title WIP: Add abstraction for storing persistent variables Add abstraction for storing persistent variables Aug 28, 2024
Tomoya-Hagen and others added 20 commits August 29, 2024 06:28
This utility class allows to pass string literals as non-type template
parameters.
- Turn PersistentVariable.cpp into PersistentVariable.ipp
- Change library target type from STATIC to INTERFACE
- Use fram::Address and fram::Size
- Correctly use fram::WriteTo() and fram::ReadFrom()
- Use one CHECK() per test condition since chaining them is not
  supported by Catch2
- Make cosmetic changes
- Fix function parameters being passed by value instead of const &
- Overload operator==() for UserDefined in unit test
- Initialize FRAM mock in all test cases since ctest runs them as
  individual executables
The Periphery component was getting too full and contained too many
levels of abstraction. I decided to keep only the low-level drivers for
the peripherals in the Periphery component and move the new,
higher-level abstractions for the FRAM sections to a new component
called FramSections. PersistentVariableInfo<> is actually on an even
higher level but I'll keep it in FramSections for now. When the full
implementation of the persistent variables as well as the EDU and
telemetry memories are done I'll decide if I want to split this up
further.
Also remove those functions as well as fram::memoryBegin/End since they
are now obsolete.
Previously we defined the number of entries in the EDU program queue and
EDU status history and then checked if they fit into the FRAM section.
Computing them from the section sizes is more convenient and less error
prone, I think.
Since C++20 CTAD also applies to types of NTTPs. This removes the need
for type deduction with auto and then constaining with isASection<>.
Remember, namespaces are for preventing name clashes not for taxonomy.
None of the sections stuff clashes with any other name so there is no
reason to put it into namespace fram.
This gives us the new target `rodos::without_main` which is required
unit test that want to use Rodos stuff.
PatrickKa and others added 15 commits August 29, 2024 06:29
This enables us to use Rodos stuff in unit tests with Catch2.
They protect `Load()` and `Store()`, ensuring that the persistent
variables maintain a consistent state.
We will need that later for `framIsWorking`.
AST = Abstract Syntrax Tree. We do not have syntax errors or anything
because building works. It is just that Cppcheck can't handle all our
template magic.
This means that we can no longer use Catch2 for testing it. Therefore,
only testing `ComputeMajorityVote()` is left in the unit test.
It's called UnitTestThread.cpp/hpp.
For some reason compiling with `-Og` and `-fkeep-inline-functions`
causes the FRAM test to print lots of error messages like "Programm
ERROR Topic Deleted!!" and "Programm ERROR ListElement deleted!!". A few
commits ago this happened to the persistent variables test. I don't know
why exactly this happens but I think it has to do with using
`rodos::without_main` in combination with Catch2 and a header file that
includes rodos/api/rodos-semaphore.h.
@PatrickKa PatrickKa merged commit df0aa2e into master Aug 31, 2024
6 checks passed
@PatrickKa PatrickKa deleted the persistent-variable branch August 31, 2024 20:44
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.

Add abstraction for storing persistent variables
3 participants