Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions boards/esp32-wrover-kit/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ ifneq (,$(filter vfs_default,$(USEMODULE)))
endif

ifneq (,$(filter mtd,$(USEMODULE)))
ifeq (,$(filter sdcard_spi,$(USEMODULE)))
# use mtd_sdmmc_default if sdcard_spi isn't explicitly enabled
ifneq (,$(filter sdcard_spi,$(USEMODULE)))
# use SD Card in SPI mode if sdcard_spi is explicitly enabled
USEMODULE += mtd_sdcard_default
else
# use SDMMC host for the SD Card otherwise
USEMODULE += mtd_sdmmc_default
endif
endif
Expand Down
13 changes: 5 additions & 8 deletions tests/pkg/fatfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ USEPKG += fatfs
FATFS_IMAGE_FILE_SIZE_MIB ?= 128

ifneq (,$(filter native native32 native64,$(BOARD)))
#overwrite default mtd_native-config to use fat image as flash device
CFLAGS += -DMTD_NATIVE_FILENAME=\"./bin/riot_fatfs_disk.img\"
CFLAGS += -DFATFS_IMAGE_FILE_SIZE_MIB=$(FATFS_IMAGE_FILE_SIZE_MIB)
CFLAGS += -DMTD_SECTOR_NUM=\(\(\(FATFS_IMAGE_FILE_SIZE_MIB\)*1024*1024\)/MTD_SECTOR_SIZE\)
else
# for actual hardware use mtd_sdcard as storage device
USEMODULE += mtd_sdcard
# overwrite default mtd_native-config to use fat image as flash device
CFLAGS += -DMTD_NATIVE_FILENAME=\"./bin/riot_fatfs_disk.img\"
CFLAGS += -DFATFS_IMAGE_FILE_SIZE_MIB=$(FATFS_IMAGE_FILE_SIZE_MIB)
CFLAGS += -DMTD_SECTOR_NUM=\(\(\(FATFS_IMAGE_FILE_SIZE_MIB\)*1024*1024\)/MTD_SECTOR_SIZE\)
endif

image:
${Q}mkdir -p bin
${Q}tar -xjf riot_fatfs_disk.tar.bz2 -C ./bin/

#this generates a compressed fat image file that can be used by the fat driver on native
# this generates a compressed fat image file that can be used by the fat driver on native
compressed-image:
${Q}./create_fat_image_file.sh $(FATFS_IMAGE_FILE_SIZE_MIB)

Expand Down
13 changes: 13 additions & 0 deletions tests/pkg/fatfs/Makefile.board.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# The dependency resolution is called multiple times, but not all the
# dependencies are resolved in the first round, such as the board deps.
# To make sure that the board deps are resolved before running, we
# create a temporary variable that stores the rounds and adds a `+` to
# the string (make does not support integer incrementation).
TEST_FATFS_DEP_ROUND := $(TEST_FATFS_DEP_ROUND)+

ifeq (++,$(TEST_FATFS_DEP_ROUND))
ifeq (,$(filter mtd_sdcard mtd_sdmmc,$(USEMODULE)))
# if no SD interface is specified, use mtd_sdcard by default
USEMODULE += mtd_sdcard
endif
endif
7 changes: 5 additions & 2 deletions tests/pkg/fatfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ or your FS will probably get damaged.

# Real Hardware

Currently the test defaults to sdcard_spi on real hardware. But generally any
device that supports the mtd-interface can be used with FatFs.
On real hardware, an SD card is used by default either via an SD/MMC controller
in SD mode or via an SPI interface in SPI mode using the driver module
`sdcard_spi`. Whether the SD card is used with an SD/MMC controller in
SD mode is determined by the board by enabling the `mtd_sdmmc_default` module.
Generally any device that supports the mtd-interface can be used with FatFS.
4 changes: 1 addition & 3 deletions tests/pkg/fatfs_vfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ FATFS_IMAGE_FILE_SIZE_MIB ?= 128
ifneq (,$(filter native native32 native64,$(BOARD)))
USEMODULE += mtd_native

#overwrite default mtd_native-config to use fat image as flash device
# overwrite default mtd_native-config to use fat image as flash device
MTD_NATIVE_FILENAME ?= \"./bin/riot_fatfs_disk.img\"
MTD_SECTOR_NUM ?= \(\(\(FATFS_IMAGE_FILE_SIZE_MIB\)*1024*1024\)/MTD_SECTOR_SIZE\)
CFLAGS += -DMTD_NATIVE_FILENAME=$(MTD_NATIVE_FILENAME)
CFLAGS += -DFATFS_IMAGE_FILE_SIZE_MIB=$(FATFS_IMAGE_FILE_SIZE_MIB)
CFLAGS += -DMTD_SECTOR_NUM=$(MTD_SECTOR_NUM)
else
USEMODULE += mtd_sdcard
endif

TEST_DEPS += image
Expand Down
13 changes: 13 additions & 0 deletions tests/pkg/fatfs_vfs/Makefile.board.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# The dependency resolution is called multiple times, but not all the
# dependencies are resolved in the first round, such as the board deps.
# To make sure that the board deps are resolved before running, we
# create a temporary variable that stores the rounds and adds a `+` to
# the string (make does not support integer incrementation).
TEST_FATFS_DEP_ROUND := $(TEST_FATFS_DEP_ROUND)+

ifeq (++,$(TEST_FATFS_DEP_ROUND))
ifeq (,$(filter mtd_sdcard mtd_sdmmc,$(USEMODULE)))
# if no SD interface is specified, use mtd_sdcard by default
USEMODULE += mtd_sdcard
endif
endif
19 changes: 13 additions & 6 deletions tests/pkg/fatfs_vfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ or your FS will probably get damaged.

# Real Hardware

Currently the test defaults to sdcard_spi on real hardware. But generally any
device that supports the mtd-interface can be used with FatFs. To use the
automated test in pkg_fatfs_vfs you need to copy the generated image to your
storage device (e.g. your SD-card). To copy the image onto the card you can use
something like `make image && dd if=bin/riot_fatfs_disk.img
of=/dev/<your_sdcard>`. After that you can connect the card to your RIOT device
On real hardware, an SD card is used by default either via an SD/MMC controller
in SD mode or via an SPI interface in SPI mode using the driver module
`sdcard_spi`. Whether the SD card is used with an SD/MMC controller in
SD mode is determined by the board by enabling the `mtd_sdmmc_default` module.
Generally any device that supports the mtd-interface can be used with FatFS.

To use the automated test in pkg_fatfs_vfs you need to copy the generated image
to your storage device (e.g. your SD-card). To copy the image onto the card you
can use something like

make image && dd if=bin/riot_fatfs_disk.img of=/dev/<your_sdcard>

After that you can connect the card to your RIOT device
and check the test output via terminal.

make flash test-with-config
Loading