Skip to content

Commit

Permalink
Update FatFs to R0.15 (#2724)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
networkfusion committed Nov 6, 2023
1 parent 250dab4 commit 8064708
Show file tree
Hide file tree
Showing 14 changed files with 345 additions and 181 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/scripts/git-pull-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ git pull origin nanoframework
cd /sources/mbedtls
git pull origin mbedtls-2.28.5
cd /sources/fatfs
git pull origin R0.14b
git pull origin R0.15
cd /sources/FreeRTOS
git pull origin V10.4.1-kernel-only
cd /sources/CMSIS_5
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/sources/Dockerfile.All
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git
&& git clone --branch v6.2.0_rel --recursive https://github.com/azure-rtos/threadx.git --depth 1 ./sources/AzureRTOS \
&& git clone --branch v6.2.0_rel --recursive https://github.com/azure-rtos/netxduo.git --depth 1 ./sources/NetxDuo \
&& git clone --branch nanoframework https://github.com/nanoframework/ChibiOS-Contrib.git --depth 1 ./sources/ChibiOs-Contrib

# Clone mbedtls and fatfs
RUN git clone --branch mbedtls-2.28.5 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \
&& git clone --branch R0.14b https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs
&& git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs

# Clone FreeRTOS and what is needed for ESP32
RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git --depth 1 ./sources/FreeRTOS \
&& git clone --branch 5.5.1 https://github.com/ARM-software/CMSIS_5.git --depth 1 ./sources/CMSIS_5 \
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/sources/Dockerfile.AzureRTOS
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ RUN git svn clone http://svn.code.sf.net/p/chibios/code/branches/stable_21.11.x

# Clone mbedtls and fatfs
RUN git clone --branch mbedtls-2.28.5 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \
&& git clone --branch R0.14b https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \
&& git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \
&& git clone --branch nf-build https://github.com/nanoframework/spiffs.git --depth 1 ./sources/spiffs

# set gcc location
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/sources/Dockerfile.ChibiOS
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git
&& git clone --branch nf-build https://github.com/nanoframework/STM32CubeH7.git --depth 1 ./sources/STM32CubeH7 \
&& git clone --branch nanoframework https://github.com/nanoframework/ChibiOS-Contrib.git --depth 1 ./sources/ChibiOs-Contrib
# Clone mbedtls and fatfs
RUN git clone --branch mbedtls-2.28.5 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \
&& git clone --branch R0.14b https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \
RUN git clone --branch mbedtls-2.28.2 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \
&& git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \
&& git clone --branch nf-build https://github.com/nanoframework/spiffs.git --depth 1 ./sources/spiffs

# set gcc location
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/sources/Dockerfile.ESP32
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RUN apt-get install -y software-properties-common \
RUN mkdir -p /usr/local/bin/gcc

# Clone fatfs
RUN git clone --branch R0.14b https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs
RUN git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs

# Clone ESP-IDF
RUN git clone --branch v4.4.6 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf
Expand Down
2 changes: 1 addition & 1 deletion CMake/Modules/FindCHIBIOS_FATFS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ foreach(SRC_FILE ${FATFS_SRCS})

find_file(FATFS_SRC_FILE ${SRC_FILE}
PATHS
${chibios_SOURCE_DIR}/os/various/fatfs_bindings
${CMAKE_SOURCE_DIR}/targets/ChibiOS/_FatFS/
${fatfs_SOURCE_DIR}/source

CMAKE_FIND_ROOT_PATH_BOTH
Expand Down
38 changes: 19 additions & 19 deletions targets/AzureRTOS/ST/ORGPAL_PALTHREE/ffconf.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#ifndef FFCONF_H
#define FFCONF_H

/* CHIBIOS FIX */
#include "ch.h"

/*---------------------------------------------------------------------------/
/ FatFs Functional Configurations
/ Configurations of FatFs Module
/---------------------------------------------------------------------------*/

#define FFCONF_DEF 86631 /* Revision ID */
#define FFCONF_DEF 80286 /* Revision ID */

/*---------------------------------------------------------------------------/
/ Function Configurations
Expand Down Expand Up @@ -62,7 +65,7 @@
/ 2: Enable with LF-CRLF conversion.
/
/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
makes f_printf() support floating point argument. These features want C99 or later.
/ makes f_printf() support floating point argument. These features want C99 or later.
/ When FF_LFN_UNICODE >= 1 with LFN enabled, string functions convert the character
/ encoding in it. FF_STRF_ENCODE selects assumption of character encoding ON THE FILE
/ to be read/written via those functions.
Expand Down Expand Up @@ -165,7 +168,7 @@
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
/ not defined, a user defined volume string table needs to be defined as:
/ not defined, a user defined volume string table is needed as:
/
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
*/
Expand All @@ -176,7 +179,7 @@
/ number and only an FAT volume found on the physical drive will be mounted.
/ When this function is enabled (1), each logical drive number can be bound to
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
/ funciton will be available. */
/ function will be available. */

#define FF_MIN_SS 512
#define FF_MAX_SS 512
Expand Down Expand Up @@ -219,9 +222,9 @@
#define FF_NORTC_MON 8
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2018
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
/* The option FF_FS_NORTC switches timestamp feature. If the system does not have
/ an RTC or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable the
/ timestamp feature. Every object modified by FatFs will have a fixed timestamp
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
Expand All @@ -230,7 +233,7 @@

#define FF_FS_NOFSINFO 0
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() function at first time after volume mount will force
/ option, and f_getfree() function at the first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
/
/ bit0=0: Use free cluster count in the FSINFO if available.
Expand All @@ -252,22 +255,19 @@

#define FF_FS_REENTRANT 1
#define FF_FS_TIMEOUT TIME_MS2I(1000)
#define FF_SYNC_t semaphore_t *
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
/ to the same volume is under control of this function.
/ to the same volume is under control of this feature.
/
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
/ 0: Disable re-entrancy. FF_FS_TIMEOUT have no effect.
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
/ function, must be added to the project. Samples are available in
/ option/syscall.c.
/ ff_mutex_create(), ff_mutex_delete(), ff_mutex_take() and ff_mutex_give()
/ function, must be added to the project. Samples are available in ffsystem.c.
/
/ The FF_FS_TIMEOUT defines timeout period in unit of time tick.
/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */
/ The FF_FS_TIMEOUT defines timeout period in unit of O/S time tick. */

/*--- End of configuration options ---*/

#endif /* FFCONF_H */
2 changes: 1 addition & 1 deletion targets/ChibiOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ if(NF_FEATURE_HAS_SDCARD OR NF_FEATURE_HAS_USB_MSD)
if(FATFS_VERSION_EMPTY)
# no FatFS version actualy specified, must be empty which is fine, we'll default to a known good version
# WHEN CHANGING THIS MAKE SURE TO UPDATE THE DEV CONTAINERS
set(FATFS_VERSION_TAG "R0.14b")
set(FATFS_VERSION_TAG "R0.15")
else()
# set version
set(FATFS_VERSION_TAG ${FATFS_VERSION})
Expand Down
38 changes: 19 additions & 19 deletions targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#ifndef FFCONF_H
#define FFCONF_H

/* CHIBIOS FIX */
#include "ch.h"

/*---------------------------------------------------------------------------/
/ FatFs Functional Configurations
/ Configurations of FatFs Module
/---------------------------------------------------------------------------*/

#define FFCONF_DEF 86631 /* Revision ID */
#define FFCONF_DEF 80286 /* Revision ID */

/*---------------------------------------------------------------------------/
/ Function Configurations
Expand Down Expand Up @@ -62,7 +65,7 @@
/ 2: Enable with LF-CRLF conversion.
/
/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
makes f_printf() support floating point argument. These features want C99 or later.
/ makes f_printf() support floating point argument. These features want C99 or later.
/ When FF_LFN_UNICODE >= 1 with LFN enabled, string functions convert the character
/ encoding in it. FF_STRF_ENCODE selects assumption of character encoding ON THE FILE
/ to be read/written via those functions.
Expand Down Expand Up @@ -165,7 +168,7 @@
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
/ not defined, a user defined volume string table needs to be defined as:
/ not defined, a user defined volume string table is needed as:
/
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
*/
Expand All @@ -176,7 +179,7 @@
/ number and only an FAT volume found on the physical drive will be mounted.
/ When this function is enabled (1), each logical drive number can be bound to
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
/ funciton will be available. */
/ function will be available. */

#define FF_MIN_SS 512
#define FF_MAX_SS 512
Expand Down Expand Up @@ -219,9 +222,9 @@
#define FF_NORTC_MON 8
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2018
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
/* The option FF_FS_NORTC switches timestamp feature. If the system does not have
/ an RTC or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable the
/ timestamp feature. Every object modified by FatFs will have a fixed timestamp
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
Expand All @@ -230,7 +233,7 @@

#define FF_FS_NOFSINFO 0
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() function at first time after volume mount will force
/ option, and f_getfree() function at the first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
/
/ bit0=0: Use free cluster count in the FSINFO if available.
Expand All @@ -252,22 +255,19 @@

#define FF_FS_REENTRANT 1
#define FF_FS_TIMEOUT TIME_MS2I(1000)
#define FF_SYNC_t semaphore_t *
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
/ to the same volume is under control of this function.
/ to the same volume is under control of this feature.
/
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
/ 0: Disable re-entrancy. FF_FS_TIMEOUT have no effect.
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
/ function, must be added to the project. Samples are available in
/ option/syscall.c.
/ ff_mutex_create(), ff_mutex_delete(), ff_mutex_take() and ff_mutex_give()
/ function, must be added to the project. Samples are available in ffsystem.c.
/
/ The FF_FS_TIMEOUT defines timeout period in unit of time tick.
/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */
/ The FF_FS_TIMEOUT defines timeout period in unit of O/S time tick. */

/*--- End of configuration options ---*/

#endif /* FFCONF_H */
42 changes: 21 additions & 21 deletions targets/ChibiOS/ST_STM32F769I_DISCOVERY/ffconf.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#ifndef FFCONF_H
#define FFCONF_H

/* CHIBIOS FIX */
#include "ch.h"

/*---------------------------------------------------------------------------/
/ FatFs Functional Configurations
/ Configurations of FatFs Module
/---------------------------------------------------------------------------*/

#define FFCONF_DEF 86631 /* Revision ID */
#define FFCONF_DEF 80286 /* Revision ID */

/*---------------------------------------------------------------------------/
/ Function Configurations
Expand Down Expand Up @@ -62,7 +65,7 @@
/ 2: Enable with LF-CRLF conversion.
/
/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
makes f_printf() support floating point argument. These features want C99 or later.
/ makes f_printf() support floating point argument. These features want C99 or later.
/ When FF_LFN_UNICODE >= 1 with LFN enabled, string functions convert the character
/ encoding in it. FF_STRF_ENCODE selects assumption of character encoding ON THE FILE
/ to be read/written via those functions.
Expand Down Expand Up @@ -165,7 +168,7 @@
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
/ not defined, a user defined volume string table needs to be defined as:
/ not defined, a user defined volume string table is needed as:
/
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
*/
Expand All @@ -176,7 +179,7 @@
/ number and only an FAT volume found on the physical drive will be mounted.
/ When this function is enabled (1), each logical drive number can be bound to
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
/ funciton will be available. */
/ function will be available. */

#define FF_MIN_SS 512
#define FF_MAX_SS 512
Expand Down Expand Up @@ -216,12 +219,12 @@
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */

#define FF_FS_NORTC 1
#define FF_NORTC_MON 1
#define FF_NORTC_MON 8
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2020
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
#define FF_NORTC_YEAR 2018
/* The option FF_FS_NORTC switches timestamp feature. If the system does not have
/ an RTC or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable the
/ timestamp feature. Every object modified by FatFs will have a fixed timestamp
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
Expand All @@ -230,7 +233,7 @@

#define FF_FS_NOFSINFO 0
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() function at first time after volume mount will force
/ option, and f_getfree() function at the first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
/
/ bit0=0: Use free cluster count in the FSINFO if available.
Expand All @@ -252,22 +255,19 @@

#define FF_FS_REENTRANT 1
#define FF_FS_TIMEOUT TIME_MS2I(1000)
#define FF_SYNC_t semaphore_t *
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
/ to the same volume is under control of this function.
/ to the same volume is under control of this feature.
/
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
/ 0: Disable re-entrancy. FF_FS_TIMEOUT have no effect.
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
/ function, must be added to the project. Samples are available in
/ option/syscall.c.
/ ff_mutex_create(), ff_mutex_delete(), ff_mutex_take() and ff_mutex_give()
/ function, must be added to the project. Samples are available in ffsystem.c.
/
/ The FF_FS_TIMEOUT defines timeout period in unit of time tick.
/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */
/ The FF_FS_TIMEOUT defines timeout period in unit of O/S time tick. */

/*--- End of configuration options ---*/

#endif /* FFCONF_H */
Loading

0 comments on commit 8064708

Please sign in to comment.