Skip to content

Commit

Permalink
tests: drivers: disk: add test for the FFAT disk
Browse files Browse the repository at this point in the history
Add FAT16 and FAT32 tests for the FFAT disk using ELM FAT file system
support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
  • Loading branch information
jfischer-no committed Oct 16, 2024
1 parent a93c867 commit 38d33bc
Show file tree
Hide file tree
Showing 5 changed files with 622 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/drivers/disk/ffat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(test_ffat)

target_sources(app PRIVATE
src/main.c
)
71 changes: 71 additions & 0 deletions tests/drivers/disk/ffat/app.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
ffatdisk0 {
compatible = "zephyr,ffat-disk";
disk-name = "RAM";
sector-size = <512>;
sector-count = <32680>;
sector-per-cluster = <1>;
};

ffatdisk1 {
compatible = "zephyr,ffat-disk";
disk-name = "NAND";
sector-size = <512>;
sector-count = <262144>;
sector-per-cluster = <4>;
};

ffatdisk2 {
compatible = "zephyr,ffat-disk";
disk-name = "CF";
sector-size = <1024>;
sector-count = <524288>;
sector-per-cluster = <8>;
};

ffatdisk3 {
compatible = "zephyr,ffat-disk";
disk-name = "SD";
sector-size = <4096>;
sector-count = <1048576>;
sector-per-cluster = <32>;
};

ffatdisk4 {
compatible = "zephyr,ffat32-disk", "zephyr,ffat-disk";
disk-name = "SD2";
sector-size = <512>;
sector-count = <131072>;
sector-per-cluster = <1>;
};

ffatdisk5 {
compatible = "zephyr,ffat32-disk", "zephyr,ffat-disk";
disk-name = "USB";
sector-size = <512>;
sector-count = <524288>;
sector-per-cluster = <4>;
};

ffatdisk6 {
compatible = "zephyr,ffat32-disk", "zephyr,ffat-disk";
disk-name = "USB2";
sector-size = <1024>;
sector-count = <1048576>;
sector-per-cluster = <8>;
};

ffatdisk7 {
compatible = "zephyr,ffat32-disk", "zephyr,ffat-disk";
disk-name = "USB3";
sector-size = <4096>;
sector-count = <16777216>;
sector-per-cluster = <64>;
};
};
12 changes: 12 additions & 0 deletions tests/drivers/disk/ffat/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

CONFIG_LOG=y
CONFIG_ZTEST=y

CONFIG_DISK_ACCESS=y
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y
CONFIG_FS_FATFS_MOUNT_MKFS=n
CONFIG_FS_FATFS_MIN_SS=512
CONFIG_FS_FATFS_MAX_SS=4096
Loading

0 comments on commit 38d33bc

Please sign in to comment.