-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PatrickKa
force-pushed
the
persistent-variable
branch
3 times, most recently
from
August 3, 2024 23:07
d8feb4e
to
2ea234e
Compare
Codecov ReportAttention: Patch coverage is
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. |
PatrickKa
force-pushed
the
persistent-variable
branch
5 times, most recently
from
August 27, 2024 21:25
36af2e6
to
766ed45
Compare
PatrickKa
changed the title
WIP: Add abstraction for storing persistent variables
Add abstraction for storing persistent variables
Aug 28, 2024
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.
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
force-pushed
the
persistent-variable
branch
from
August 29, 2024 06:30
0577492
to
8a9397d
Compare
This can resolve the circular dependencies between `Time.hpp` and `FramLayout.hpp`.
PatrickKa
force-pushed
the
persistent-variable
branch
from
August 31, 2024 18:41
bf766f4
to
6677121
Compare
PatrickKa
force-pushed
the
persistent-variable
branch
from
August 31, 2024 19:08
6677121
to
3186439
Compare
PatrickKa
force-pushed
the
persistent-variable
branch
from
August 31, 2024 20:18
998c96e
to
6a6594c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #202