aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George2019-11-07 18:27:51 +1100
committerDamien George2019-11-11 11:37:38 +1100
commit799b6d1e0c5bfb2392b7978f549ab2c7d2e0cc29 (patch)
tree7f82f744f693e21b60e3486cd9c38f7ba66d3438
parent1266ba97545b66c93e33a2d4c4e665cdbd14228c (diff)
extmod: Consolidate FAT FS config to MICROPY_VFS_FAT across all ports.
This commit removes the Makefile-level MICROPY_FATFS config and moves the MICROPY_VFS_FAT config to the Makefile level to replace it. It also moves the include of the oofatfs source files in the build from each port to a central place in extmod/extmod.mk. For a port to enabled VFS FAT support it should now set MICROPY_VFS_FAT=1 at the level of the Makefile. This will include the relevant oofatfs files in the build and set MICROPY_VFS_FAT=1 at the C (preprocessor) level.
-rw-r--r--extmod/extmod.mk15
-rw-r--r--ports/esp32/Makefile8
-rw-r--r--ports/esp32/mpconfigport.h1
-rw-r--r--ports/esp8266/Makefile7
-rw-r--r--ports/esp8266/boards/GENERIC/mpconfigboard.h1
-rw-r--r--ports/esp8266/boards/GENERIC/mpconfigboard.mk1
-rw-r--r--ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk2
-rw-r--r--ports/nrf/Makefile5
-rw-r--r--ports/nrf/README.md6
-rw-r--r--ports/nrf/mpconfigport.h1
-rw-r--r--ports/stm32/Makefile5
-rw-r--r--ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.h1
-rw-r--r--ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.mk3
-rw-r--r--ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.h1
-rw-r--r--ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.mk3
-rw-r--r--ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h1
-rw-r--r--ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.mk3
-rw-r--r--ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h1
-rw-r--r--ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.mk3
-rw-r--r--ports/stm32/mpconfigport.h3
-rw-r--r--ports/stm32/mpconfigport.mk3
-rw-r--r--ports/unix/Makefile8
-rw-r--r--ports/unix/mpconfigport.h1
-rw-r--r--ports/unix/mpconfigport_coverage.h2
24 files changed, 39 insertions, 46 deletions
diff --git a/extmod/extmod.mk b/extmod/extmod.mk
index e714b6028..69d8cfad3 100644
--- a/extmod/extmod.mk
+++ b/extmod/extmod.mk
@@ -1,7 +1,20 @@
# This makefile fragment provides rules to build 3rd-party components for extmod modules
+################################################################################
+# VFS FAT FS
+
+OOFATFS_DIR = lib/oofatfs
+
# this sets the config file for FatFs
-CFLAGS_MOD += -DFFCONF_H=\"lib/oofatfs/ffconf.h\"
+CFLAGS_MOD += -DFFCONF_H=\"$(OOFATFS_DIR)/ffconf.h\"
+
+ifeq ($(MICROPY_VFS_FAT),1)
+CFLAGS_MOD += -DMICROPY_VFS_FAT=1
+SRC_MOD += $(addprefix $(OOFATFS_DIR)/,\
+ ff.c \
+ ffunicode.c \
+ )
+endif
################################################################################
# VFS littlefs
diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile
index 86e8cd3b2..e3b14495d 100644
--- a/ports/esp32/Makefile
+++ b/ports/esp32/Makefile
@@ -29,8 +29,8 @@ QSTR_GLOBAL_REQUIREMENTS = $(SDKCONFIG_H)
MICROPY_PY_USSL = 0
MICROPY_SSL_AXTLS = 0
-MICROPY_FATFS = 1
MICROPY_PY_BTREE = 1
+MICROPY_VFS_FAT = 1
MICROPY_VFS_LFS2 = 1
FROZEN_MANIFEST ?= boards/manifest.py
@@ -348,12 +348,6 @@ LIB_SRC_C = $(addprefix lib/,\
utils/sys_stdio_mphal.c \
)
-ifeq ($(MICROPY_FATFS), 1)
-LIB_SRC_C += \
- lib/oofatfs/ff.c \
- lib/oofatfs/ffunicode.c
-endif
-
DRIVERS_SRC_C = $(addprefix drivers/,\
bus/softspi.c \
dht/dht.c \
diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h
index 6cf86446b..da62beb4c 100644
--- a/ports/esp32/mpconfigport.h
+++ b/ports/esp32/mpconfigport.h
@@ -61,7 +61,6 @@ void *esp_native_code_commit(void*, size_t);
#define MICROPY_ENABLE_SCHEDULER (1)
#define MICROPY_SCHEDULER_DEPTH (8)
#define MICROPY_VFS (1)
-#define MICROPY_VFS_FAT (1)
// control over Python builtins
#define MICROPY_PY_FUNCTION_ATTRS (1)
diff --git a/ports/esp8266/Makefile b/ports/esp8266/Makefile
index f1b718c78..f534eb689 100644
--- a/ports/esp8266/Makefile
+++ b/ports/esp8266/Makefile
@@ -22,7 +22,6 @@ QSTR_GLOBAL_DEPENDENCIES = $(BOARD_DIR)/mpconfigboard.h
MICROPY_PY_USSL = 1
MICROPY_SSL_AXTLS = 1
AXTLS_DEFS_EXTRA = -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096
-MICROPY_FATFS ?= 1
MICROPY_PY_BTREE ?= 1
BTREE_DEFS_EXTRA = -DDEFPSIZE=1024 -DMINCACHE=3
@@ -147,12 +146,6 @@ LIB_SRC_C = $(addprefix lib/,\
utils/sys_stdio_mphal.c \
)
-ifeq ($(MICROPY_FATFS), 1)
-LIB_SRC_C += \
- lib/oofatfs/ff.c \
- lib/oofatfs/ffunicode.c
-endif
-
DRIVERS_SRC_C = $(addprefix drivers/,\
bus/softspi.c \
dht/dht.c \
diff --git a/ports/esp8266/boards/GENERIC/mpconfigboard.h b/ports/esp8266/boards/GENERIC/mpconfigboard.h
index a7cacb815..8f0505d07 100644
--- a/ports/esp8266/boards/GENERIC/mpconfigboard.h
+++ b/ports/esp8266/boards/GENERIC/mpconfigboard.h
@@ -10,7 +10,6 @@
#define MICROPY_READER_VFS (MICROPY_VFS)
#define MICROPY_VFS (1)
-#define MICROPY_VFS_FAT (1)
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
diff --git a/ports/esp8266/boards/GENERIC/mpconfigboard.mk b/ports/esp8266/boards/GENERIC/mpconfigboard.mk
new file mode 100644
index 000000000..86593ff60
--- /dev/null
+++ b/ports/esp8266/boards/GENERIC/mpconfigboard.mk
@@ -0,0 +1 @@
+MICROPY_VFS_FAT = 1
diff --git a/ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk b/ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk
index 90f3c1773..32fd4e007 100644
--- a/ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk
+++ b/ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk
@@ -1,3 +1,3 @@
-MICROPY_FATFS = 0
MICROPY_PY_BTREE = 0
+MICROPY_VFS_FAT = 0
LD_FILES = boards/esp8266_512k.ld
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index 62208525f..2ac654911 100644
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -43,8 +43,7 @@ include ../../py/py.mk
GIT_SUBMODULES = lib/nrfx lib/tinyusb
-MICROPY_FATFS ?= 0
-FATFS_DIR = lib/oofatfs
+MICROPY_VFS_FAT ?= 0
MPY_CROSS = ../../mpy-cross/mpy-cross
MPY_TOOL = ../../tools/mpy-tool.py
@@ -318,7 +317,7 @@ OBJ += $(addprefix $(BUILD)/, $(SYSTEM_C_SRC:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_LIB:.c=.o))
OBJ += $(BUILD)/pins_gen.o
-$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
+$(BUILD)/$(OOFATFS_DIR)/ff.o: COPT += -Os
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
.PHONY: all flash deploy sd binary hex
diff --git a/ports/nrf/README.md b/ports/nrf/README.md
index 3c177c705..b5f39267e 100644
--- a/ports/nrf/README.md
+++ b/ports/nrf/README.md
@@ -107,12 +107,12 @@ To use frozen modules, put them in a directory (e.g. `freeze/`) and supply
make BOARD=pca10040 FROZEN_MPY_DIR=freeze
-## Enable MICROPY_FATFS
-As the `oofatfs` module is not having header guards that can exclude the implementation compile time, this port provides a flag to enable it explicitly. The MICROPY_FATFS is by default set to 0 and has to be set to 1 if `oofatfs` files should be compiled. This will be in addition of setting `MICROPY_VFS` and `MICROPY_VFS_FAT` in mpconfigport.h.
+## Enable MICROPY_VFS_FAT
+As the `oofatfs` module is not having header guards that can exclude the implementation compile time, this port provides a flag to enable it explicitly. The MICROPY_VFS_FAT is by default set to 0 and has to be set to 1 if `oofatfs` files should be compiled. This will be in addition of setting `MICROPY_VFS` in mpconfigport.h.
For example:
- make BOARD=pca10040 MICROPY_FATFS=1
+ make BOARD=pca10040 MICROPY_VFS_FAT=1
## Target Boards and Make Flags
diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h
index 71f9f6804..e5fa1579c 100644
--- a/ports/nrf/mpconfigport.h
+++ b/ports/nrf/mpconfigport.h
@@ -33,7 +33,6 @@
#ifndef MICROPY_VFS
#define MICROPY_VFS (0)
#endif
-#define MICROPY_VFS_FAT (MICROPY_VFS)
#define MICROPY_ALLOC_PATH_MAX (512)
#define MICROPY_PERSISTENT_CODE_LOAD (0)
#define MICROPY_EMIT_THUMB (0)
diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile
index 99d2248fd..61ce06ca8 100644
--- a/ports/stm32/Makefile
+++ b/ports/stm32/Makefile
@@ -34,7 +34,6 @@ CMSIS_DIR=$(TOP)/lib/stm32lib/CMSIS/STM32$(MCU_SERIES_UPPER)xx/Include
HAL_DIR=lib/stm32lib/STM32$(MCU_SERIES_UPPER)xx_HAL_Driver
USBDEV_DIR=usbdev
#USBHOST_DIR=usbhost
-FATFS_DIR=lib/oofatfs
DFU=$(TOP)/tools/dfu.py
# may need to prefix dfu-util with sudo
USE_PYDFU ?= 1
@@ -128,8 +127,6 @@ MPY_CROSS_FLAGS += -march=armv7m
SRC_LIB = $(addprefix lib/,\
libc/string0.c \
- oofatfs/ff.c \
- oofatfs/ffunicode.c \
mp-readline/readline.c \
netutils/netutils.c \
netutils/trace.c \
@@ -480,7 +477,7 @@ $(BUILD)/lib/libc/string0.o: COPT += -O2
# If we compile these using -O0 then it won't fit. So if you really want these
# to be compiled with -O0, then edit boards/common.ld (in the .isr_vector section)
# and comment out the following lines.
-$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
+$(BUILD)/$(OOFATFS_DIR)/ff.o: COPT += -Os
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
$(PY_BUILD)/formatfloat.o: COPT += -Os
$(PY_BUILD)/parsenum.o: COPT += -Os
diff --git a/ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.h b/ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.h
index 7a80f2635..25cfcbde7 100644
--- a/ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.h
+++ b/ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.h
@@ -14,7 +14,6 @@
#define MICROPY_PY_NETWORK (0)
#define MICROPY_PY_STM (0)
#define MICROPY_PY_PYB_LEGACY (0)
-#define MICROPY_VFS_FAT (0)
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
#define MICROPY_HW_ENABLE_RTC (1)
diff --git a/ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.mk b/ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.mk
index e2ced6118..03561f90a 100644
--- a/ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.mk
+++ b/ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.mk
@@ -4,5 +4,8 @@ MICROPY_FLOAT_IMPL = none
AF_FILE = boards/stm32l072_af.csv
LD_FILES = boards/stm32l072xz.ld boards/common_basic.ld
+# MicroPython settings
+MICROPY_VFS_FAT = 0
+
# Don't include default frozen modules because MCU is tight on flash space
FROZEN_MANIFEST ?=
diff --git a/ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.h b/ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.h
index 366822d0d..fb8de6022 100644
--- a/ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.h
+++ b/ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.h
@@ -7,7 +7,6 @@
#define MICROPY_PY_NETWORK (0)
#define MICROPY_PY_STM (0)
#define MICROPY_PY_PYB_LEGACY (0)
-#define MICROPY_VFS_FAT (0)
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
#define MICROPY_HW_ENABLE_RTC (1)
diff --git a/ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.mk
index 5efa0d4a5..984fe2f90 100644
--- a/ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.mk
+++ b/ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.mk
@@ -3,5 +3,8 @@ CMSIS_MCU = STM32F091xC
AF_FILE = boards/stm32f091_af.csv
LD_FILES = boards/stm32f091xc.ld boards/common_basic.ld
+# MicroPython settings
+MICROPY_VFS_FAT = 0
+
# Don't include default frozen modules because MCU is tight on flash space
FROZEN_MANIFEST ?=
diff --git a/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h b/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h
index e20dff677..e9753958d 100644
--- a/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h
+++ b/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h
@@ -14,7 +14,6 @@
#define MICROPY_PY_NETWORK (0)
#define MICROPY_PY_STM (0)
#define MICROPY_PY_PYB_LEGACY (0)
-#define MICROPY_VFS_FAT (0)
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
#define MICROPY_HW_ENABLE_RTC (1)
diff --git a/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.mk
index 5afe134ba..f3673f006 100644
--- a/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.mk
+++ b/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.mk
@@ -3,5 +3,8 @@ CMSIS_MCU = STM32L073xx
AF_FILE = boards/stm32l072_af.csv
LD_FILES = boards/stm32l072xz.ld boards/common_basic.ld
+# MicroPython settings
+MICROPY_VFS_FAT = 0
+
# Don't include default frozen modules because MCU is tight on flash space
FROZEN_MANIFEST ?=
diff --git a/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h b/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h
index e7202efe0..945cccb50 100644
--- a/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h
+++ b/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h
@@ -8,7 +8,6 @@
#define MICROPY_PY_NETWORK (0)
#define MICROPY_PY_STM (0)
#define MICROPY_PY_PYB_LEGACY (0)
-#define MICROPY_VFS_FAT (0)
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
#define MICROPY_HW_ENABLE_RTC (1)
diff --git a/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.mk
index 7c7cd34f0..6e220a437 100644
--- a/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.mk
+++ b/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.mk
@@ -4,5 +4,8 @@ AF_FILE = boards/stm32l432_af.csv
LD_FILES = boards/stm32l432.ld boards/common_basic.ld
OPENOCD_CONFIG = boards/openocd_stm32l4.cfg
+# MicroPython settings
+MICROPY_VFS_FAT = 0
+
# Don't include default frozen modules because MCU is tight on flash space
FROZEN_MANIFEST ?=
diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h
index 11c237238..fc54026f6 100644
--- a/ports/stm32/mpconfigport.h
+++ b/ports/stm32/mpconfigport.h
@@ -84,9 +84,6 @@
#define MICROPY_ENABLE_SCHEDULER (1)
#define MICROPY_SCHEDULER_DEPTH (8)
#define MICROPY_VFS (1)
-#ifndef MICROPY_VFS_FAT
-#define MICROPY_VFS_FAT (1)
-#endif
// control over Python builtins
#define MICROPY_PY_FUNCTION_ATTRS (1)
diff --git a/ports/stm32/mpconfigport.mk b/ports/stm32/mpconfigport.mk
index e708de6c1..c6b3ddc74 100644
--- a/ports/stm32/mpconfigport.mk
+++ b/ports/stm32/mpconfigport.mk
@@ -8,3 +8,6 @@ MICROPY_PY_WIZNET5K ?= 0
# cc3k module for wifi support
MICROPY_PY_CC3K ?= 0
+
+# VFS FAT FS support
+MICROPY_VFS_FAT ?= 1
diff --git a/ports/unix/Makefile b/ports/unix/Makefile
index 9a4453261..2fa1373e7 100644
--- a/ports/unix/Makefile
+++ b/ports/unix/Makefile
@@ -163,12 +163,6 @@ LIB_SRC_C = $(addprefix lib/,\
timeutils/timeutils.c \
)
-# FatFS VFS support
-LIB_SRC_C += $(addprefix lib/,\
- oofatfs/ff.c \
- oofatfs/ffunicode.c \
- )
-
OBJ = $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
@@ -257,7 +251,7 @@ coverage:
-Wold-style-definition -Wpointer-arith -Wshadow -Wuninitialized -Wunused-parameter \
-DMICROPY_UNIX_COVERAGE' \
LDFLAGS_EXTRA='-fprofile-arcs -ftest-coverage' \
- MICROPY_VFS_LFS1=1 MICROPY_VFS_LFS2=1 \
+ MICROPY_VFS_FAT=1 MICROPY_VFS_LFS1=1 MICROPY_VFS_LFS2=1 \
FROZEN_MANIFEST=manifest_coverage.py \
BUILD=build-coverage PROG=micropython_coverage
diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h
index e42ad5e49..40cd1f570 100644
--- a/ports/unix/mpconfigport.h
+++ b/ports/unix/mpconfigport.h
@@ -152,7 +152,6 @@
#define MICROPY_FATFS_RPATH (2)
#define MICROPY_FATFS_MAX_SS (4096)
#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
-#define MICROPY_VFS_FAT (0)
// Define to MICROPY_ERROR_REPORTING_DETAILED to get function, etc.
// names in exception messages (may require more RAM).
diff --git a/ports/unix/mpconfigport_coverage.h b/ports/unix/mpconfigport_coverage.h
index afd364649..8a0bf3be4 100644
--- a/ports/unix/mpconfigport_coverage.h
+++ b/ports/unix/mpconfigport_coverage.h
@@ -55,8 +55,6 @@
#define MICROPY_PY_URE_MATCH_SPAN_START_END (1)
#define MICROPY_PY_URE_SUB (1)
#define MICROPY_VFS_POSIX (1)
-#undef MICROPY_VFS_FAT
-#define MICROPY_VFS_FAT (1)
#define MICROPY_PY_FRAMEBUF (1)
#define MICROPY_PY_COLLECTIONS_NAMEDTUPLE__ASDICT (1)
#define MICROPY_PY_UCRYPTOLIB (1)