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

drivers/mtd_default: add external declarations for mtd* #19538

Merged
merged 1 commit into from
May 4, 2023

Conversation

gschorcht
Copy link
Contributor

Contribution description

The mtd_default module defines MTD_NUMOF, if not present, based on the MTD_* defines. These defines are set to the corresponding mtd* MTD device pointer variables in the board definitions. However, not all mtd* MTD device pointer variables are always made known by external variable declarations. An example are SD Card Interfaces that are defined via the mtd_sdcard_default module. As a result, it may be necessary for an application using mtd_default to declare an external MTD device pointer variable mtd. To be able to use SD card for testing MTD based application, mtd_default also declares up to six mtd* MTD device pointer variables.

Testing procedure

Use any board without SD Card definition and compile tests/pkg_litllefs, tests/pkg_litllefs2 or tests/pkg_spiffs, for example to use a temporary connected SD Card interface.

CFLAGS='-DMTD_0=mtd0 -DCONFIG_USE_HARDWARE_MTD' USEMODULE='sdcard_spi mtd_sdcard_default' BOARD=nucleo-f411re make -j8 -C tests/pkg_littlefs

Without this PR, compilation fails due to undeclared mtd0 variable

tests/pkg_littlefs/bin/nucleo-f411re/riotbuild/riotbuild.h:2:15: error: 'mtd0' undeclared (first use in this function)
    2 | #define MTD_0 mtd0
      |               ^~~~

Compilation works with this PR and the temporary connected SD Card interface can be used with this test applications.

Issues/PRs references

The `mtd_default` module defines `MTD_NUMOF` if not existing based on the `MTD_*` defines which are usually set to the corresponding MTD device pointer variables `mtd*`. However, these MTD device pointer variables are not always made known by external variable declarations. An example are SD Card Interfaces which are defined via the `mtd_sdcard_default` module. As a consequence, an application that uses `mtd_default` has still to be modified. Therefore, `mtd_default` also declares up to 6 `mtd*` MTD device pointer variables.
@github-actions github-actions bot added the Area: drivers Area: Device drivers label May 2, 2023
@gschorcht gschorcht added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 2, 2023
@gschorcht gschorcht requested a review from benpicco May 2, 2023 22:01
@riot-ci
Copy link

riot-ci commented May 2, 2023

Murdock results

✔️ PASSED

714b3e3 drivers/mtd_default: add external declarations for mtd*

Success Failures Total Runtime
6931 0 6931 10m:37s

Artifacts

@benpicco
Copy link
Contributor

benpicco commented May 4, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented May 4, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit ecc3249 into RIOT-OS:master May 4, 2023
@gschorcht
Copy link
Contributor Author

Thanks

@benpicco benpicco added this to the Release 2023.07 milestone Aug 2, 2023
@gschorcht gschorcht deleted the drivers/mtd_default_extern branch September 10, 2023 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants