2023-05-05 10:09:15 +02:00
|
|
|
include ../Makefile.pkg_common
|
2017-05-12 17:46:09 +02:00
|
|
|
|
|
|
|
USEMODULE += fatfs_vfs
|
2017-07-05 14:54:42 +02:00
|
|
|
FEATURES_OPTIONAL += periph_rtc
|
2022-01-06 10:22:12 +01:00
|
|
|
FEATURES_REQUIRED += periph_spi
|
2017-05-12 17:46:09 +02:00
|
|
|
|
2020-07-02 19:11:32 +02:00
|
|
|
# remove this if you don't want to format your SD card
|
|
|
|
USEMODULE += fatfs_vfs_format
|
2022-03-25 17:23:37 +01:00
|
|
|
CFLAGS += -DCONFIG_FATFS_FORMAT_ALLOC_STATIC=1
|
2020-07-02 19:11:32 +02:00
|
|
|
|
2017-07-05 14:54:42 +02:00
|
|
|
FATFS_IMAGE_FILE_SIZE_MIB ?= 128
|
|
|
|
|
|
|
|
ifeq ($(BOARD),native)
|
|
|
|
USEMODULE += mtd_native
|
|
|
|
|
|
|
|
#overwrite default mtd_native-config to use fat image as flash device
|
|
|
|
MTD_NATIVE_FILENAME ?= \"./bin/riot_fatfs_disk.img\"
|
2018-02-22 08:25:25 +01:00
|
|
|
MTD_SECTOR_NUM ?= \(\(\(FATFS_IMAGE_FILE_SIZE_MIB\)*1024*1024\)/MTD_SECTOR_SIZE\)
|
2017-07-05 14:54:42 +02:00
|
|
|
CFLAGS += -DMTD_NATIVE_FILENAME=$(MTD_NATIVE_FILENAME)
|
|
|
|
CFLAGS += -DFATFS_IMAGE_FILE_SIZE_MIB=$(FATFS_IMAGE_FILE_SIZE_MIB)
|
2018-02-22 08:25:25 +01:00
|
|
|
CFLAGS += -DMTD_SECTOR_NUM=$(MTD_SECTOR_NUM)
|
2017-07-05 14:54:42 +02:00
|
|
|
else
|
|
|
|
USEMODULE += mtd_sdcard
|
|
|
|
endif
|
|
|
|
|
2018-07-12 23:19:51 +02:00
|
|
|
TEST_DEPS += image
|
|
|
|
|
2017-05-12 17:46:09 +02:00
|
|
|
include $(RIOTBASE)/Makefile.include
|
|
|
|
|
2017-07-05 14:54:42 +02:00
|
|
|
image:
|
|
|
|
@tar -xjf riot_fatfs_disk.tar.gz -C ./bin/
|
|
|
|
|
2017-05-12 17:46:09 +02:00
|
|
|
#this generates a compressed fat image file that can be used by the fat driver on native
|
2017-07-05 14:54:42 +02:00
|
|
|
compressed-image:
|
|
|
|
@./create_fat_image_file.sh $(FATFS_IMAGE_FILE_SIZE_MIB)
|