samples/fs/fat_fs: Add support for nrf52840dk_nrf52840

The commits adds support for nrf52840dk_nrf52840 with two additional
configurations:
 - with FAT FS on internal SoC flash
 - with FAT FS on QSPI connected MX25

In case of SoC configuration there is re-configuration of internal
partitions done, doe to need for at least of 64kiB for FAT FS.
The QSPI configuration only defines additional partition on
external device.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
Dominik Ermel 2023-02-28 13:08:08 +00:00 committed by Carles Cufí
parent 1feaa9db06
commit f079225637
4 changed files with 102 additions and 0 deletions

View File

@ -0,0 +1,8 @@
#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
CONFIG_DISK_DRIVERS=y
CONFIG_DISK_DRIVER_FLASH=y

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Because FAT FS needs at least 64kiB partition and default
* storage_partition is 32kiB for that board, we need to reorgatnize
* partitions to get at least 64KiB.
* This overlay removes image slot partitions and strips each of 64kiB,
* and removes the storage partition to add the additional 2*64kiB to
* it.
*/
/delete-node/ &slot0_partition;
/delete-node/ &slot1_partition;
/delete-node/ &storage_partition;
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
slot0_partition: partition@c000 {
reg = <0x0000C000 0x00066000>;
};
slot1_partition: partition@72000 {
reg = <0x00072000 0x00066000>;
};
storage_partition: partition@d8000 {
label = "storage";
reg = <0x000d8000 0x00028000>;
};
};
};
/ {
msc_disk0 {
status="okay";
compatible = "zephyr,flash-disk";
partition = <&storage_partition>;
disk-name = "SD";
/* cache-size == page erase size */
cache-size = <4096>;
};
};

View File

@ -0,0 +1,11 @@
#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
CONFIG_NORDIC_QSPI_NOR=y
# The mx25 erase page size
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_DISK_DRIVERS=y
CONFIG_DISK_DRIVER_FLASH=y

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Note that default partition layout, provided by board DTS, is not
* altered here as external_partition used by the disk is defined
* over QSPI device and does not collide with any other partition
* definition.
*/
&mx25r64 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* 128kiB external storage partition */
external_partition: partition@0 {
reg = <0x00000000 0x00020000>;
};
};
};
/ {
msc_disk0 {
status="okay";
compatible = "zephyr,flash-disk";
partition = <&external_partition>;
disk-name = "SD";
/* cache-size == page erase size */
cache-size = <4096>;
};
};