-
Notifications
You must be signed in to change notification settings - Fork 2k
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
pkg/flashdb: enhance FAL config #20221
Conversation
tests/pkg/flashdb_fal_cfg/Makefile
Outdated
ifeq (,$(filter periph_rtc,$(FEATURES_PROVIDED))) | ||
FEATURES_REQUIRED += periph_rtt | ||
USEMODULE += rtt_rtc | ||
USEMODULE += ztimer_no_periph_rtt | ||
else | ||
FEATURES_REQUIRED += periph_rtc | ||
endif |
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 won't work unfortunately.
You don't have the FEATURES_PROVIDED
information at this point, so you will always select periph_rtt
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 is the known issue with the make dependency resolution... Maybe DEFAULT_MODULE
can somehow be used but that only gets resolved on the last iteration.
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.
I did not figure out how to resolve this with DEFAULT_MODULE
but FEATURES_REQUIRED_ANY
seems to do a good job here.
When I compile with BOARD=same54-xpro make
it compiles fine.
And when I remove FEATURES_PROVIDED += periph_rtc
from boards/same54-xpro/Makefile.features
it also compiles fine with "Using real-time-timer RTC"
.
$(info Using real-time-timer RTC) | ||
USEMODULE += rtt_rtc | ||
USEMODULE += ztimer_no_periph_rtt | ||
endif |
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.
Does this work? I would expect that doing this after the dependency resolution won't have any effect.
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.
I don´t know the magic behind it but I assume it works. When I remove FEATURES_PROVIDED += periph_rtc
from boards/same54-xpro/Makefile.features
and do an info-modules
I see that rtt_rtc
and ztimer_no_periph_rtt
are in. When I try to build after I remove USEMODULE += rtt_rtc
linking fails, as expected.
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.
tests/pkg/flashdb_fal_cfg/main.c:99: undefined reference to 'rtc_get_time'
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 squash
6a8af08
to
94f074e
Compare
tests/pkg/flashdb_fal_cfg/Makefile
Outdated
|
||
# handle RTC backend after inclusion of $(RIOTBASE)/Makefile.include | ||
ifeq (,$(filter periph_rtc,$(FEATURES_USED))) | ||
$(info Using real-time-timer RTC) |
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.
Looks like this output messes up CI
The specified board Using does not exist.
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.
I was not able to figure this out by the CI message.
pkg/flashdb/include/fal_cfg.h
Outdated
* a KV with a length of 10K, you can use the control function to set the sector size to 12K or larger. | ||
* | ||
*/ | ||
#define CONFIG_FLASHDB_MIN_SECTOR_SIZE_EXP 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.
I should say that this is just the default but it can be different for 2 databases.
For that I would rename this to CONFIG_FLASHDB_DEFAULT_MIN_SECTOR_SIZE_EXP
.
A module M
that initializes a database should have something like:
#ifndef M_FLASHDB_MIN_SECTOR_SIZE_EXP
#define M_FLASHDB_MIN_SECTOR_SIZE_EXP CONFIG_FLASHDB_MIN_SECTOR_SIZE_EXP
#endif
Do you agree?
Hmm and the fact that it can be 10K or 12 actually means that it is not necessarily a power of 2.
I would change it to a factor x KiB
Default would be 4 for 4K
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.
the fact that it can be 10K or 12
Ah ok so there are no assumptions about this being a power of two in the code then - where did you find the 10k sector?
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.
In the documentation of now CONFIG_FLASHDB_MIN_SECTOR_SIZE_DEFAULT_FACTOR
I copied something from the documentation of flashDB Sector size and block size.
pkg/flashdb/include/fal_cfg.h
Outdated
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#if !defined(CONFIG_FLASHDB_MIN_SECTOR_SIZE_DEFAULT_FACTOR) || defined(DOXYGEN) | ||
/** | ||
* @brief Virtual sector size factor in multiples of 1KiB for FlashDB |
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.
* @brief Virtual sector size factor in multiples of 1KiB for FlashDB | |
* @brief Minimal virtual sector size in KiB for FlashDB |
pkg/flashdb/include/fal_cfg.h
Outdated
* a KV with a length of 10K, you can use the control function to set the sector size to 12K or larger. | ||
* | ||
*/ | ||
#define CONFIG_FLASHDB_MIN_SECTOR_SIZE_DEFAULT_FACTOR 4 |
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.
#define CONFIG_FLASHDB_MIN_SECTOR_SIZE_DEFAULT_FACTOR 4 | |
#define CONFIG_FLASHDB_MIN_SECTOR_SIZE_DEFAULT_KiB 4 |
Instead of FACTOR
you can just use the unit.
The MIN DEFAULT is a bit confusion, maybe add a note that this is only for the automatic partition configuration.
e6b67ee
to
057695b
Compare
You might have to run |
f702848
to
bf4bfdf
Compare
Contribution description
I wanted to split out the FlashDB fal_cfg partition offset fix from #19557.
This also adds a short test to see if all partitions initialize fine and it adds a configuration option for the sector size.
The test very much reminds of an
auto_init
module for FLashDB.Testing procedure
Test output of
BOARD=same54-xpro make -C tests/pkg/flashdb_fal_cfg flash term
Issues/PRs references