tests/pkg/fatfs*: cleanup MTD default dependencies#21478
tests/pkg/fatfs*: cleanup MTD default dependencies#21478gschorcht merged 3 commits intoRIOT-OS:masterfrom
Conversation
tests/pkg/fatfs/Makefile
Outdated
|
|
||
| include $(RIOTBASE)/Makefile.include | ||
|
|
||
| ifneq (,$(filter native native32 native64,$(BOARD))) |
There was a problem hiding this comment.
| ifneq (,$(filter native native32 native64,$(BOARD))) | |
| ifneq (,$(filter native32 native64,$(BOARD))) |
When checked after including Makefile.include, the board alias will already have been replaced by either native32 or native64. Same below
|
Hm, it doesn't seem to be as easy as I though. Enabling |
|
I had to change the approach to clean up the dependencies. Now, the makefile variable |
|
The same functionality is already implemented in Lines 9 to 23 in e0a6628 Just removing the following lines from the ifneq (,$(filter native native32 native64,$(BOARD)))
#overwrite default mtd_native-config to use fat image as flash device
CFLAGS += -DMTD_NATIVE_FILENAME=\"./bin/riot_fatfs_disk.img\"
CFLAGS += -DFATFS_IMAGE_FILE_SIZE_MIB=$(FATFS_IMAGE_FILE_SIZE_MIB)
CFLAGS += -DMTD_SECTOR_NUM=\(\(\(FATFS_IMAGE_FILE_SIZE_MIB\)*1024*1024\)/MTD_SECTOR_SIZE\)
- else
- # for actual hardware use mtd_sdcard as storage device
- USEMODULE += mtd_sdcard
endifThis is the console log (also works for devices with |
🤔 that's interesting but makes the life much more easier. |
Dependencies for MTDs are just bit tricky. Some years ago I had a discussion with @benpicco whether it would make sense to define the used SD Card interface as a feature of the board. At that time, we decided not to define according features to be able to wire any SD Card breakout module for testing anytime. |
|
In hindsight it would make sense to define the feature by the board. Even when wiring the SD card manually, that requires a change to the board configuration, so adding the feature would be no big hassle. Also back then we didn't have many boards with proper / native SD card interfaces, so manual wiring was the way to go. We should probably also remove the |
5bd7fb5 to
a401f80
Compare
Not really. It works for boards that have an SDMMC or SPI SD Card interfac and enable Therefore, I dropped the last two fixups. |
|
We could use a ifeq (,$(filter mtd_sdcard mtd_sdmmc,$(USEMODULE)))
# if no SD interface is specified, use mtd_sdcard by default
USEMODULE += mtd_sdcard
endifThis results in the following output: |
|
But for boards with SD Card connected to SDMMC, we have the problem as before:
|
|
Yes indeed. While I generally consider this behavior a bug of #12755, I'm not sure if changing that behavior won't introduce other issues in other applications... Consider this Note that Make does not support incrementing a counter variable, therefore I used a string. Not the prettiest thing, but more elegant than a load of shell calls IMO. This leads to this output: |
Nice hack 😉 |
|
Murdock seems to be happy 👍 |
crasbe
left a comment
There was a problem hiding this comment.
I can't really test it locally on real hardware, but if you're happy and CI is happy, I'm happy too.
Please squash.
To prevent `mtd_sdcard` from being used by default for boards that use a different default MTD, which can lead to module conflicts, `mtd_sdcard` is now only enabled if no other MTD is enabled by default with the corresponding `mtd_*_default` module.
To prevent `mtd_sdcard` from being used by default for boards that use a different default MTD, which can lead to module conflicts, `mtd_sdcard` is now only enabled if no other MTD is enabled by default with the corresponding `mtd_*_default` module.
494bbc1 to
0908b86
Compare
|
@crasbe Thanks for reviewing and the test application "hack". |
Contribution description
To prevent
mtd_sdcardfrom being used by default for boards that use a different default MTD, which can lead to module conflicts,mtd_sdcardis now only enabled intests/pkg/fatfsandtests/pkg/fatfs_vfatif no other MTD is enabled by default with the correspondingmtd_*_defaultmodule.With this PR, MTD dependencies for
esp32-wrover-kitcould be fixed.Testing procedure
Compilation in CI should succeed.
Use any board definition with SDMMC as SD Card interface und try the following command with and w/o this PR:
Without the PR, the list of MTD modules is:
With the PR the command should give:
Issues/PRs references
Prerequisite for PR #21471