[riot-notifications] [RIOT-OS/RIOT] sys/auto_init: new auto_init_storage (#16497)

fabian18 notifications at github.com
Tue May 25 18:41:44 CEST 2021

The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.

### Contribution description
- Add new module `auto_init_storage` to auto-initialize storage devices
- A storage device `<d>` shall be auto initialized if the pseudomodule `auto_init_storage_<d>` is pulled in
- If the storage device has an MTD layer, the `auto_init` module  shall setup the MTD device from device `params`
- A board that uses an MTD device for a dedicated purpose can implement a hook `auto_init_mtd_<d>`
- implement `auto_init_storage_at24cxxx` as an example

I´ll mark this as a draft because the implementation of the auto-initialization of the `at24cxxx` should probably be another PR.
This PR could be just the `auto_init_storage` module, if you agree with the code changes.

Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes


### Testing procedure
Board `sam54e-xpro` has an MTD `at24mac`.
Add to `boards/sam54e-xpro/board.c`:
#include <stdio.h>
void auto_init_mtd_at24cxxx(mtd_at24cxxx_t *at24cxxx, at24cxxx_id_t numof)
    puts("auto init at24cxxx");
Try `USEMODULE="mtd auto_init_storage_at24cxxx" BOARD=sam54e-xpro make -C examples/gnrc_networking` and verify that it is called. The board does not use the MTD for a special purpose, so this is just an example.
A board that has to actually read or write something on auto-init must call `mtd_init()` and do whatever it needs to do.
I do not have that board but I have another board that is not in RIOT for which it works well.
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output

### Issues/PRs references
Similar as #11871

Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * sys/auto_init: Allow auto-initialization of storage devices
  * sys/auto_init/storage: auto init at24cxxx
  * boards/same54-xpro: allow at24cxxx MTD auto init

-- File Changes --

    M boards/same54-xpro/board.c (15)
    A drivers/at24cxxx/include/mtd_at24cxxx_params.h (38)
    M drivers/include/at24cxxx.h (25)
    M drivers/include/mtd_at24cxxx.h (15)
    M makefiles/pseudomodules.inc.mk (1)
    M sys/Makefile.dep (8)
    M sys/auto_init/Makefile (4)
    M sys/auto_init/auto_init.c (5)
    A sys/auto_init/storage/Makefile (7)
    A sys/auto_init/storage/at24cxxx.c (111)
    A sys/auto_init/storage/auto_init_storage.c (32)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210525/74f84679/attachment-0001.htm>

More information about the notifications mailing list