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

samples: usb: mass: demonstrate mounting littlefs file systems on Linux/FreeBSD hosts #24696

Merged
merged 5 commits into from
May 6, 2020

Conversation

pabigot
Copy link
Collaborator

@pabigot pabigot commented Apr 25, 2020

The https://github.com/ARMmbed/littlefs-fuse project in combination with Zephyr's USB Mass Storage support allows mounting embedded file systems directly onto Linux and FreeBSD hosts for inspection and modification.

pabigot added 4 commits April 25, 2020 07:58
Flash drivers may impose alignment requirements on the destination
buffers due to use of DMA transfers.  In particular Nordic QSPI flash
API requires that addresses, sizes, and buffers all by 4-byte aligned.
Align the page buffer to satisfy this requirement.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Flash drivers may impose alignment requirements on the destination
buffers due to use of DMA transfers.  In particular Nordic QSPI flash
API requires that addresses, sizes, and buffers all be 4-byte aligned.
Align the ready/copy buffer to satisfy this requirement.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
The API call to close the flash area was only invoked when the flash
area was erased.  It should be closed in all paths.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Drop the old redefine-everything-in-a-special-conf approach and put
the customization appropriate for this board into the board directory
where it's handled automatically.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
@zephyrbot
Copy link
Collaborator

zephyrbot commented Apr 25, 2020

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

This allows mass storage exposure of a littlefs file system,
specifically one on the SPI NOR flash of the nrf52840dk_nrf52840.  In
combination with littlefs-fuse this allows a host system to examine
and change the local storage of a Zephyr application.

Note that it is critical that all parameters of the file system match
between what Zephyr is using and what littlefs-fuse is using.
Inconsistencies can produce confusing results where each system sees
different content.  The README has been updated with a detailed
example.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
@pabigot pabigot force-pushed the pabigot/20200425a branch from 96cba5b to e5e34d8 Compare April 25, 2020 14:36
@pabigot pabigot removed the DNM This PR should not be merged (Do Not Merge) label Apr 28, 2020
@pabigot pabigot added this to the v2.3.0 milestone Apr 28, 2020
*/
static u8_t page[BLOCK_SIZE + CONFIG_MASS_STORAGE_BULK_EP_MPS];
static u8_t __aligned(4) page[BLOCK_SIZE + CONFIG_MASS_STORAGE_BULK_EP_MPS];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__aligned(sizeof(u32_t)) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most existing _aligned attributes in Zephyr use integer values directly rather than deriving them from sizeof(type).

@@ -19,7 +19,7 @@
static struct device *flash_dev;

/* flash read-copy-erase-write operation */
static u8_t read_copy_buf[CONFIG_DISK_ERASE_BLOCK_SIZE];
static u8_t __aligned(4) read_copy_buf[CONFIG_DISK_ERASE_BLOCK_SIZE];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__aligned(sizeof(u32_t)) ?

@carlescufi carlescufi merged commit 88c0545 into zephyrproject-rtos:master May 6, 2020
@pabigot pabigot deleted the pabigot/20200425a branch May 13, 2020 18:49
@eobalski eobalski mentioned this pull request Jun 18, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants