drivers: add support for MTDs emulated in RAM#19443
Merged
bors[bot] merged 10 commits intoRIOT-OS:masterfrom Apr 12, 2023
Merged
drivers: add support for MTDs emulated in RAM#19443bors[bot] merged 10 commits intoRIOT-OS:masterfrom
bors[bot] merged 10 commits intoRIOT-OS:masterfrom
Conversation
0401d1b to
bf98644
Compare
dylad
reviewed
Apr 4, 2023
Member
dylad
left a comment
There was a problem hiding this comment.
Quick round of review.
I didn't test it yet.
Member
|
@gschorcht Please squash ! |
bors bot
added a commit
that referenced
this pull request
Apr 9, 2023
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 <[email protected]>
dylad
reviewed
Apr 10, 2023
Member
dylad
left a comment
There was a problem hiding this comment.
Please squash (including these two nitpicks)
43f12e9 to
7ea26f7
Compare
7ea26f7 to
a03d416
Compare
Contributor
Author
|
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
816caf7 to
1d4d3e4
Compare
Member
|
bors merge |
bors bot
added a commit
that referenced
this pull request
Apr 12, 2023
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 <[email protected]>
Contributor
|
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.
Member
|
bors merge |
Contributor
|
Build succeeded: |
Contributor
Author
|
Thanks |
bors bot
added a commit
that referenced
this pull request
Oct 19, 2023
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 <[email protected]> Co-authored-by: Koen Zandberg <[email protected]> Co-authored-by: Lena Boeckmann <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.hthat were found while writing the driver.Testing procedure
The following tests should work on any board:
tests/pkg_littlefstests/pkg_littlefs2tests/pkg_spiffsIssues/PRs references