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.
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.
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.
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.featuresit 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.
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.
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.
tests/pkg/flashdb_fal_cfg/main.c:99: undefined reference to 'rtc_get_time'
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.
Looks like this output messes up CI
The specified board Using does not exist.
There was a problem hiding this comment.
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.
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
#endifDo 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.
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.
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
|
|
||
| #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.
| * @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.
| #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_initmodule for FLashDB.Testing procedure
Test output of
BOARD=same54-xpro make -C tests/pkg/flashdb_fal_cfg flash termIssues/PRs references