diff --git a/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840.conf b/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000..b1f556a4202 --- /dev/null +++ b/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840.conf @@ -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 diff --git a/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840.overlay b/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000..44f7dc1ea05 --- /dev/null +++ b/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840.overlay @@ -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>; + }; +}; diff --git a/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840_qspi.conf b/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840_qspi.conf new file mode 100644 index 00000000000..9ef2abc6d0b --- /dev/null +++ b/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840_qspi.conf @@ -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 diff --git a/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840_qspi.overlay b/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840_qspi.overlay new file mode 100644 index 00000000000..64107833fd6 --- /dev/null +++ b/samples/subsys/fs/fat_fs/boards/nrf52840dk_nrf52840_qspi.overlay @@ -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>; + }; +};