-
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
drivers: add support for MTDs emulated in RAM #19443
Conversation
0401d1b
to
bf98644
Compare
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.
Quick round of review.
I didn't test it yet.
@gschorcht Please squash ! |
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.
spotted this on lastest commit
19460: cpu/stm32/usbdev_fs: fix ep registration and EP_REG assignments r=gschorcht a=dylad ### Contribution description This PR provides two fixes for the `usbdev_fs` driver: - Fix endpoints registration - Fix assignment of toggleable bits in EP_REG(x) registers These bugs were encountered with the USBUS MSC implementation. Regarding the endpoints registration: For the `usbdev_fs` peripheral, IN and OUT endpoints of the same index must have the same type. For instance, if EP1 OUT is a bulk endpoint, EP1 IN must either be unused or used as bulk too but it cannot be used as interrupt or isochronous. With the previous check, the following registration pattern (EP OUT Bulk -> EP IN Interrupt -> EP IN Bulk) would assign both EP OUT Bulk and EP IN Interrupt to same endpoint index. So the configuration would be broken. Applying the same registration pattern with this patch would now produce EP OUT Bulk -> 1 / EP IN Interrupt -> 2 / EP IN Bulk 1. Which is a working configuration for this IP. and for the second fix: EP_REG(x) registers have a total of 6 toggleable bits. Those bits can only be toggled if we write a one to it, otherwise writing a zero has no effect This commit fixes all the access to these registers to prevent from modifying these bits when not needed. Without this patch, the endpoint status (VALID / NACK / STALL) can be erroneously modify because bits are not cleared when assigning the new content to the register and thus make the bits toggle and change values. ### Testing procedure This can be tested with tests/usbus_msc on any board using this `usbdev_fs` driver. It is easier to test this PR with #19443 alongside. Then the following would be enough: `CFLAGS='-DSECTOR_COUNT=64' USEMODULE='mtd_emulated' make -j8 BOARD=p-nucleo-wb55 -C tests/usbus_msc flash` Otherwise this can also be tested by attaching a SPI<->SDCARD adapter. ### Issues/PRs references None. Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
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 (including these two nitpicks)
43f12e9
to
7ea26f7
Compare
7ea26f7
to
a03d416
Compare
Squashed |
This driver provides support for MTDs emulated in RAM to test MTD-based applications on boards that do not provide MTDs in hardware.
a03d416
to
816caf7
Compare
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.
CI complains about unittests.
816caf7
to
1d4d3e4
Compare
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.
ACK.
bors merge |
19443: drivers: add support for MTDs emulated in RAM r=dylad a=gschorcht ### Contribution description This PR adds a driver to provide MTDs that are emulated in RAM. It allows to test MTD-based applications on boards that do not provide MTDs by hardware. It includes also some small documentation fixes for `mtd.h` that were found while writing the driver. ### Testing procedure The following tests should work on any board: `tests/pkg_littlefs` `tests/pkg_littlefs2` `tests/pkg_spiffs` ### Issues/PRs references Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Build failed: |
A `SECTOR_COUNT` of 12 seems to be sufficient to work for this test in emulated MTD.
Removing boards blacklisted for insufficient memory after reducing the number of sectors of the emulated MTD.
bors merge |
Build succeeded: |
Thanks |
19465: drivers/mtd: use XFA for pointers to defined MTDs r=benpicco a=gschorcht ### Contribution description This PR provides the support to hold pointers to defined MTDs within a XFA. The XFA allows - to access MTDs of different types (`mtd_flashpage`, `mtd_sdcard`, `mtd_emulated`, ...) by an index - to determine the number of MTDs defined in the system. ### Testing procedure To be defined once PR #19443 is merged because emulated MTDs will allow to test this PR on arbitrary boards. ### Porting Guide For external boards: - remove the `MTD_NUMOF` definition from `board.h` - add `MTD_XFA_ADD(<mtd_dev>, <idx>);` to the definition of `<mtd_dev>`. - `MTD_0`, `MTD_1`, … defines are no longer needed. ### Issues/PRs references Related to PR #19443 19981: Fletcher32: Add incremental API r=benpicco a=bergzand ### Contribution description This PR extends the current fletcher32 checksum with an incremental API mode. This way the bytes to be checksummed can be supplied via multiple successive calls and do not have to be provided in a single consecutive buffer. I've also rephrased the warning with the original function a bit as that function uses an `unaligned_get_u16` to access the data. The data thus does not require alignment, but the length does need to be supplied as number of 16 bit words. ### Testing procedure The test has been extended ### Issues/PRs references None 19995: sys/psa_crypto: Fix macro for public key max size and SE example r=benpicco a=Einhornhool ### Contribution description #### 1. Wrong public key size when using secure elements, introduced by #19954 Fixed conditions for key size macros in `crypto_sizes.h`. #### 2. EdDSA and ECDSA examples fail when using a secure element because of unsopported changes introduced by #19954 Updated `example/psa_crypto` to use only supported functions for secure elements. ### Testing procedure Build `example/psa_crypto` for secure elements and run application Output on master: ``` 2023-10-19 14:33:24,372 # main(): This is RIOT! (Version: 2019.07-devel-22378-gb6772) 2023-10-19 14:33:24,372 # HMAC SHA256 took 56393 us 2023-10-19 14:33:24,372 # Cipher AES 128 took 68826 us 2023-10-19 14:33:24,372 # *** RIOT kernel panic: 2023-10-19 14:33:24,373 # HARD FAULT HANDLER 2023-10-19 14:33:24,373 # 2023-10-19 14:33:24,373 # *** rebooting... ``` Output with fixes: ``` 2023-10-19 13:35:24,715 # main(): This is RIOT! (Version: 2019.07-devel-22384-g8ef66-dev/psa-crypto-fixes) 2023-10-19 13:35:24,715 # HMAC SHA256 took 56374 us 2023-10-19 13:35:24,715 # Cipher AES 128 took 68805 us 2023-10-19 13:35:24,715 # ECDSA took 281164 us 2023-10-19 13:35:24,715 # All Done ``` Co-authored-by: Gunar Schorcht <gunar@schorcht.net> Co-authored-by: Koen Zandberg <koen@bergzand.net> Co-authored-by: Lena Boeckmann <lena.boeckmann@haw-hamburg.de>
Contribution description
This PR adds a driver to provide MTDs that are emulated in RAM. It allows to test MTD-based applications on boards that do not provide MTDs by hardware.
It includes also some small documentation fixes for
mtd.h
that were found while writing the driver.Testing procedure
The following tests should work on any board:
tests/pkg_littlefs
tests/pkg_littlefs2
tests/pkg_spiffs
Issues/PRs references