Part 1
요약·해설
SD card·internal/external flash 조건과 mount 실패 시 재format 경고를 포함합니다.
FAT · Ext2
SDHC · SoC · QSPI
Mount may reformat
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
57E2B872E55615E1837FA43BC7E1209EAEBA96A827A45C76D5BBCD63F9C77D52
.. zephyr:code-sample:: fs
:name: File system manipulation
:relevant-api: file_system_api disk_access_interface
Use file system API with various filesystems and storage devices.
Overview
********
This sample app demonstrates use of the file system API and uses the FAT or Ext2 file
system driver with SDHC card, SoC flash or external flash chip.
To access device the sample uses :ref:`disk_access_api`.
Requirements for SD card support
********************************
This project requires SD card support and microSD card formatted with proper file system
(FAT or Ext2) See the :ref:`disk_access_api` documentation for Zephyr implementation details.
Boards that by default use SD card for storage: ``arduino_mkrzero``, ``esp_wrover_kit``,
``mimxrt1050_evk``, ``nrf52840_blip`` and ``olimexino_stm32``. The sample should be able
to run with any other board that has "zephyr,sdmmc-disk" DT node enabled.
Requirements for setting up FAT FS on SoC flash
***********************************************
For the FAT FS to work with internal flash, the device needs to support erase
pages of size <= 4096 bytes and have at least 64kiB of flash available for
FAT FS partition alone.
Currently the following boards are supported:
``nrf52840dk/nrf52840``
Requirements for setting up FAT FS on external flash
****************************************************
This type of configuration requires external flash device to be available
on DK board. Currently following boards support the configuration:
``nrf52840dk/nrf52840`` by ``nrf52840dk_nrf52840_qspi`` configuration.
Building and Running FAT samples
********************************
Boards with default configurations, for example ``arduino_mkrzero`` or
``nrf52840dk/nrf52840`` using internal flash can be build using command:
.. zephyr-app-commands::
:zephyr-app: samples/subsys/fs/fs_sample
:board: nrf52840_blip
:goals: build
:compact:
Where used example board ``nrf52840_blip`` should be replaced with desired board.
In case when some more specific configuration is to be used for a given board,
for example ``nrf52840dk/nrf52840`` with MX25 device over QSPI, configuration
and DTS overlays need to be also selected. The command would look like this:
.. zephyr-app-commands::
:zephyr-app: samples/subsys/fs/fs_sample
:board: nrf52840dk/nrf52840
:gen-args: -DEXTRA_CONF_FILE=nrf52840dk_nrf52840_qspi.conf -DDTC_OVERLAY_FILE=nrf52840dk_nrf52840_qspi.overlay
:goals: build
:compact:
In case when board with SD card is used FAT microSD card should be present in the
microSD slot. If there are any files or directories present in the card, the
sample lists them out on the debug serial output.
.. warning::
In case when mount fails the device may get re-formatted to FAT FS.
To disable this behaviour disable :kconfig:option:`CONFIG_FS_FATFS_MOUNT_MKFS` .
Building and Running EXT2 samples
*********************************
Ext2 sample can be build for ``hifive_unmatched`` or ``bl5340_dvk/nrf5340/cpuapp``. Because
FAT is default file system for this sample, additional flags must be passed to build
the sample.
.. zephyr-app-commands::
:zephyr-app: samples/subsys/fs/fs_sample
:board: hifive_unmatched
:gen-args: -DCONF_FILE=prj_ext.conf
:goals: build
:compact:
A microSD card must be present in a microSD card slot of the board, for the sample to execute.
After starting the sample a contents of a root directory should be printed on the console.
Part 3
한국어 전문 번역
개요
File system API를 사용해 여러 file system과 storage device를 조작하는 sample application입니다. FAT 또는 Ext2 driver를 SDHC card, SoC flash, external flash chip과 함께 사용하며, device 접근에는 disk access API를 이용합니다.
SD card 지원 요구 사항
SD card 지원과 올바른 file system(FAT 또는 Ext2)으로 format된 microSD card가 필요합니다. Zephyr 구현 세부 사항은 disk access API 문서를 참조하십시오.
기본적으로 SD card를 storage로 사용하는 board는 arduino_mkrzero, esp_wrover_kit, mimxrt1050_evk, nrf52840_blip, olimexino_stm32입니다. 그 밖의 board도 zephyr,sdmmc-disk devicetree node가 enable되어 있으면 실행할 수 있어야 합니다.
SoC flash에 FAT FS를 구성하기 위한 요구 사항
Internal flash에서 FAT FS를 사용하려면 device가 4096 byte 이하 크기의 erase page를 지원해야 하며, FAT FS partition만을 위해 최소 64 KiB의 flash를 확보해야 합니다. 현재 지원 board는 nrf52840dk/nrf52840입니다.
External flash에 FAT FS를 구성하기 위한 요구 사항
이 구성에는 development kit에서 사용할 수 있는 external flash device가 필요합니다. 현재 nrf52840dk/nrf52840의 nrf52840dk_nrf52840_qspi configuration이 지원됩니다.
FAT sample 빌드 및 실행
기본 configuration을 쓰는 arduino_mkrzero 같은 board나 internal flash를 사용하는 nrf52840dk/nrf52840은 다음 형식으로 build합니다. 예제의 nrf52840_blip은 원하는 대상 board로 바꿉니다.
west build -b nrf52840_blip samples/subsys/fs/fs_sample
nrf52840dk/nrf52840에서 QSPI의 MX25 device처럼 특별한 구성을 사용한다면 configuration file과 DTS overlay를 함께 지정해야 합니다.
west build -b nrf52840dk/nrf52840 samples/subsys/fs/fs_sample -- -DEXTRA_CONF_FILE=nrf52840dk_nrf52840_qspi.conf -DDTC_OVERLAY_FILE=nrf52840dk_nrf52840_qspi.overlay
SD card가 있는 board에서는 FAT로 format한 microSD card를 slot에 넣어야 합니다. Card에 file이나 directory가 있으면 sample이 debug serial output에 그 목록을 표시합니다.
EXT2 sample 빌드 및 실행
Ext2 sample은 hifive_unmatched 또는 bl5340_dvk/nrf5340/cpuapp용으로 build할 수 있습니다. 이 sample의 기본 file system은 FAT이므로 prj_ext.conf를 선택하는 추가 flag가 필요합니다.
west build -b hifive_unmatched samples/subsys/fs/fs_sample -- -DCONF_FILE=prj_ext.conf
Sample을 실행하려면 board의 microSD slot에 card가 있어야 합니다. 시작 뒤 root directory 내용이 console에 출력되어야 합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.