From cdd4956fd8fac4085c4c6bf25e8ad30fdfdc61e5 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Sun, 6 Apr 2025 21:45:44 +0100 Subject: [PATCH 1/7] Update fatfs to R0.15a FatFs fails to load the FsInfo in FAT32 volumes and the f_getfree function will always be forced a full FAT scan which takes a long time. --- .devcontainer/All/Dockerfile.All.SRC | 2 +- .devcontainer/All/scripts/git-pull-repos.sh | 2 +- .devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC | 2 +- .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC | 2 +- .devcontainer/ESP32/Dockerfile.ESP32.SRC | 2 +- .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC | 2 +- targets/ChibiOS/CMakeLists.txt | 2 +- targets/ChibiOS/_FatFs/fatfs_syscall.c | 2 +- targets/FreeRTOS/NXP/CMakeLists.txt | 2 +- targets/FreeRTOS/NXP/_FatFs/ffsystem.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.devcontainer/All/Dockerfile.All.SRC b/.devcontainer/All/Dockerfile.All.SRC index a4107b04ca..9963cacdd2 100644 --- a/.devcontainer/All/Dockerfile.All.SRC +++ b/.devcontainer/All/Dockerfile.All.SRC @@ -78,7 +78,7 @@ RUN git clone --branch v6.4.0_rel --recursive https://github.com/eclipse-threadx && git clone --branch v6.3.0_rel --recursive https://github.com/eclipse-threadx/netxduo.git --depth 1 ./sources/NetxDuo # Clone dependent repos (mbedtls, fatfs and littlefs) -RUN git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ +RUN git clone --branch R0.15a https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ && git clone --branch v2.9.3 https://github.com/littlefs-project/littlefs --depth 1 ./sources/littlefs \ && git clone --branch mbedtls-3.6.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ && cd ./sources/mbedtls \ diff --git a/.devcontainer/All/scripts/git-pull-repos.sh b/.devcontainer/All/scripts/git-pull-repos.sh index c001de827b..5d704e04e4 100644 --- a/.devcontainer/All/scripts/git-pull-repos.sh +++ b/.devcontainer/All/scripts/git-pull-repos.sh @@ -18,7 +18,7 @@ cd /sources/mbedtls git pull origin mbedtls-3.6.0 git submodule update --init cd /sources/fatfs -git pull origin R0.15 +git pull origin R0.15a cd /sources/FreeRTOS git pull origin V10.4.1-kernel-only cd /sources/CMSIS_5 diff --git a/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC b/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC index 7ae37f9d97..118e4f10ad 100644 --- a/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC +++ b/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC @@ -67,7 +67,7 @@ RUN git clone --branch v6.4.0_rel --recursive https://github.com/eclipse-threadx && git clone --branch v6.4.0_rel --recursive https://github.com/eclipse-threadx/netxduo.git --depth 1 ./sources/NetxDuo # Clone dependent repos (mbedtls, fatfs and littlefs) -RUN git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ +RUN git clone --branch R0.15a https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ && git clone --branch v2.9.3 https://github.com/littlefs-project/littlefs --depth 1 ./sources/littlefs \ && git clone --branch mbedtls-3.6.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ && cd ./sources/mbedtls \ diff --git a/.devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC b/.devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC index 25d0827422..892f124cf8 100644 --- a/.devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC +++ b/.devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC @@ -65,7 +65,7 @@ RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git && git clone --branch chibios-21.11.x https://github.com/ChibiOS/ChibiOS-Contrib.git --depth 1 ./sources/ChibiOs-Contrib # Clone dependent repos (mbedtls, fatfs and littlefs etc.) -RUN git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ +RUN git clone --branch R0.15a https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ && git clone --branch v2.9.3 https://github.com/littlefs-project/littlefs --depth 1 ./sources/littlefs \ && git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip \ && git clone --branch mbedtls-3.6.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ diff --git a/.devcontainer/ESP32/Dockerfile.ESP32.SRC b/.devcontainer/ESP32/Dockerfile.ESP32.SRC index 6b45f70a80..d5e3db3bf4 100644 --- a/.devcontainer/ESP32/Dockerfile.ESP32.SRC +++ b/.devcontainer/ESP32/Dockerfile.ESP32.SRC @@ -45,7 +45,7 @@ RUN apt-get update \ RUN mkdir -p /usr/local/bin/gcc # Clone fatfs -RUN git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs +RUN git clone --branch R0.15a https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs # Clone ESP-IDF RUN git clone --branch v5.2.3 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf diff --git a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC index 77755782c8..95fb827d21 100644 --- a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC +++ b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC @@ -55,7 +55,7 @@ RUN apt-get update \ RUN mkdir -p /usr/local/bin/gcc # Clone libs mbedtls and fatfs etc. -RUN git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ +RUN git clone --branch R0.15a https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ && git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip \ && git clone --branch mbedtls-3.6.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ && cd ./sources/mbedtls \ diff --git a/targets/ChibiOS/CMakeLists.txt b/targets/ChibiOS/CMakeLists.txt index dff6aae770..e857a102ef 100644 --- a/targets/ChibiOS/CMakeLists.txt +++ b/targets/ChibiOS/CMakeLists.txt @@ -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.15") + set(FATFS_VERSION_TAG "R0.15a") else() # set version set(FATFS_VERSION_TAG ${FATFS_VERSION}) diff --git a/targets/ChibiOS/_FatFs/fatfs_syscall.c b/targets/ChibiOS/_FatFs/fatfs_syscall.c index 7d5bdde6d0..b74b5651c2 100644 --- a/targets/ChibiOS/_FatFs/fatfs_syscall.c +++ b/targets/ChibiOS/_FatFs/fatfs_syscall.c @@ -3,7 +3,7 @@ // ChibiOs version can be found at: // https://github.com/ArduPilot/ChibiOS.svn/blob/master/os/various/fatfs_bindings/fatfs_syscall.c // but currently locked to R0.14b. -// This file aligns with compatibility with R0.15+ +// This file aligns with compatibility with R0.15a+ // And also allows use of nF specific capabilities. /*------------------------------------------------------------------------*/ diff --git a/targets/FreeRTOS/NXP/CMakeLists.txt b/targets/FreeRTOS/NXP/CMakeLists.txt index 3ece9c0928..c1a0477726 100644 --- a/targets/FreeRTOS/NXP/CMakeLists.txt +++ b/targets/FreeRTOS/NXP/CMakeLists.txt @@ -28,7 +28,7 @@ endif() # check if build was requested with a specifc FatFS version if(FATFS_VERSION_EMPTY) # no FatFS version actualy specified, must be empty which is fine, we'll default to a known good version - set(FATFS_VERSION_TAG "R0.15") + set(FATFS_VERSION_TAG "R0.15a") else() # set version set(FATFS_VERSION_TAG "${FATFS_VERSION}") diff --git a/targets/FreeRTOS/NXP/_FatFs/ffsystem.c b/targets/FreeRTOS/NXP/_FatFs/ffsystem.c index 5c918214a4..1a14c3e177 100644 --- a/targets/FreeRTOS/NXP/_FatFs/ffsystem.c +++ b/targets/FreeRTOS/NXP/_FatFs/ffsystem.c @@ -1,6 +1,6 @@ // clang-format off -// This file aligns with compatibility with R0.15+ +// This file aligns with compatibility with R0.15a+ // It currently includes commented out code which would allow a fully // platform independent solution. From e4a4c639c9801dd0c60b6a825ea05cac9b669aad Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 10 Apr 2025 18:26:00 +0100 Subject: [PATCH 2/7] Update #define FFCONF_DEF to align with R0.15a --- targets/AzureRTOS/ST/ORGPAL_PALTHREE/ffconf.h | 2 +- targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h | 2 +- targets/ChibiOS/ORGPAL_PALX/ffconf.h | 2 +- targets/ChibiOS/ST_STM32F769I_DISCOVERY/ffconf.h | 2 +- targets/FreeRTOS/NXP/_FatFs/ffconf.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/targets/AzureRTOS/ST/ORGPAL_PALTHREE/ffconf.h b/targets/AzureRTOS/ST/ORGPAL_PALTHREE/ffconf.h index 6c2658e3fd..fe43522093 100644 --- a/targets/AzureRTOS/ST/ORGPAL_PALTHREE/ffconf.h +++ b/targets/AzureRTOS/ST/ORGPAL_PALTHREE/ffconf.h @@ -8,7 +8,7 @@ / Configurations of FatFs Module /---------------------------------------------------------------------------*/ -#define FFCONF_DEF 80286 /* Revision ID */ +#define FFCONF_DEF 5380 /* Revision ID */ /*---------------------------------------------------------------------------/ / Function Configurations diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h b/targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h index f6294fd54f..4e727f7e4d 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h +++ b/targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h @@ -9,7 +9,7 @@ / Configurations of FatFs Module /---------------------------------------------------------------------------*/ -#define FFCONF_DEF 80286 /* Revision ID */ +#define FFCONF_DEF 5380 /* Revision ID */ /*---------------------------------------------------------------------------/ / Function Configurations diff --git a/targets/ChibiOS/ORGPAL_PALX/ffconf.h b/targets/ChibiOS/ORGPAL_PALX/ffconf.h index f6294fd54f..4e727f7e4d 100644 --- a/targets/ChibiOS/ORGPAL_PALX/ffconf.h +++ b/targets/ChibiOS/ORGPAL_PALX/ffconf.h @@ -9,7 +9,7 @@ / Configurations of FatFs Module /---------------------------------------------------------------------------*/ -#define FFCONF_DEF 80286 /* Revision ID */ +#define FFCONF_DEF 5380 /* Revision ID */ /*---------------------------------------------------------------------------/ / Function Configurations diff --git a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/ffconf.h b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/ffconf.h index b6ab6a2012..c3c50d71a9 100644 --- a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/ffconf.h +++ b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/ffconf.h @@ -9,7 +9,7 @@ / Configurations of FatFs Module /---------------------------------------------------------------------------*/ -#define FFCONF_DEF 80286 /* Revision ID */ +#define FFCONF_DEF 5380 /* Revision ID */ /*---------------------------------------------------------------------------/ / Function Configurations diff --git a/targets/FreeRTOS/NXP/_FatFs/ffconf.h b/targets/FreeRTOS/NXP/_FatFs/ffconf.h index f93ed0259d..51c3b4be9b 100644 --- a/targets/FreeRTOS/NXP/_FatFs/ffconf.h +++ b/targets/FreeRTOS/NXP/_FatFs/ffconf.h @@ -5,7 +5,7 @@ / Configurations of FatFs Module /---------------------------------------------------------------------------*/ -#define FFCONF_DEF 80286 /* Revision ID */ +#define FFCONF_DEF 5380 /* Revision ID */ #define SD_DISK_ENABLE From 066a0d3bf60e1ea3f59bf7051661216e039da28b Mon Sep 17 00:00:00 2001 From: "nfbot[bot]" Date: Thu, 10 Apr 2025 18:35:23 +0100 Subject: [PATCH 3/7] Code style fixes for nanoframework/nf-interpreter PR#3146 (#3149) --- targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h | 8 ++++---- targets/ChibiOS/ORGPAL_PALX/ffconf.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h b/targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h index 4e727f7e4d..c3c50d71a9 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h +++ b/targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h @@ -182,13 +182,13 @@ / const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",... */ #if (HAL_USE_SDC == TRUE) && (HAL_USBH_USE_MSD == TRUE) -#define FF_VOLUME_STRS "D", "E" +#define FF_VOLUME_STRS "D", "E" #elif (HAL_USE_SDC == FALSE) && (HAL_USBH_USE_MSD == TRUE) -#define FF_VOLUME_STRS "E" +#define FF_VOLUME_STRS "E" #elif (HAL_USE_SDC == TRUE) && (HAL_USBH_USE_MSD == FALSE) -#define FF_VOLUME_STRS "D" +#define FF_VOLUME_STRS "D" #else -#define FF_VOLUME_STRS "" +#define FF_VOLUME_STRS "" #endif #define FF_MULTI_PARTITION 0 diff --git a/targets/ChibiOS/ORGPAL_PALX/ffconf.h b/targets/ChibiOS/ORGPAL_PALX/ffconf.h index 4e727f7e4d..c3c50d71a9 100644 --- a/targets/ChibiOS/ORGPAL_PALX/ffconf.h +++ b/targets/ChibiOS/ORGPAL_PALX/ffconf.h @@ -182,13 +182,13 @@ / const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",... */ #if (HAL_USE_SDC == TRUE) && (HAL_USBH_USE_MSD == TRUE) -#define FF_VOLUME_STRS "D", "E" +#define FF_VOLUME_STRS "D", "E" #elif (HAL_USE_SDC == FALSE) && (HAL_USBH_USE_MSD == TRUE) -#define FF_VOLUME_STRS "E" +#define FF_VOLUME_STRS "E" #elif (HAL_USE_SDC == TRUE) && (HAL_USBH_USE_MSD == FALSE) -#define FF_VOLUME_STRS "D" +#define FF_VOLUME_STRS "D" #else -#define FF_VOLUME_STRS "" +#define FF_VOLUME_STRS "" #endif #define FF_MULTI_PARTITION 0 From cff054fa0fa990659b611fcbb386d433983bf2a2 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 10 Apr 2025 18:54:16 +0100 Subject: [PATCH 4/7] Remove surplus commenting --- targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp | 30 +++++++++++----------- targets/ESP32/_FatFs/fatfs_FS_Driver.cpp | 30 +++++++++++----------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp b/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp index 225826f935..a04406f40a 100644 --- a/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp +++ b/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp @@ -178,21 +178,21 @@ HRESULT FATFS_FS_Driver::GetSizeInfo(const VOLUME_ID *volume, int64_t *totalSize f_chdrive(currentVolume->m_rootName); - // // this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now - // // // get free clusters - // // f_getfree(buffer, &freeClusters, &fsPtr); - - // // // Get total sectors and free sectors - // // totalSectors = (fs.n_fatent - 2) * fs.csize; - // // freeSectors = freeClusters * fs.csize; - - // // #if FF_MAX_SS != FF_MIN_SS - // // *totalSize = (int64_t)totalSectors * fs.ssize; - // // *totalFreeSpace = (int64_t)freeSectors * fs.ssize; - // // #else - // // *totalSize = (int64_t)totalSectors * FF_MAX_SS; - // // *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; - // // #endif + // this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now + // // get free clusters + // f_getfree(buffer, &freeClusters, &fsPtr); + + // // Get total sectors and free sectors + // totalSectors = (fs.n_fatent - 2) * fs.csize; + // freeSectors = freeClusters * fs.csize; + + // #if FF_MAX_SS != FF_MIN_SS + // *totalSize = (int64_t)totalSectors * fs.ssize; + // *totalFreeSpace = (int64_t)freeSectors * fs.ssize; + // #else + // *totalSize = (int64_t)totalSectors * FF_MAX_SS; + // *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; + // #endif *totalSize = -1; *totalFreeSpace = -1; diff --git a/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp b/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp index 9fd650503f..07b1465e77 100644 --- a/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp +++ b/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp @@ -93,21 +93,21 @@ HRESULT FATFS_FS_Driver::GetSizeInfo(const VOLUME_ID *volume, int64_t *totalSize f_chdrive(currentVolume->m_rootName); - // // this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now - // // // get free clusters - // // f_getfree(buffer, &freeClusters, &fsPtr); - - // // // Get total sectors and free sectors - // // totalSectors = (fs.n_fatent - 2) * fs.csize; - // // freeSectors = freeClusters * fs.csize; - - // // #if FF_MAX_SS != FF_MIN_SS - // // *totalSize = (int64_t)totalSectors * fs.ssize; - // // *totalFreeSpace = (int64_t)freeSectors * fs.ssize; - // // #else - // // *totalSize = (int64_t)totalSectors * FF_MAX_SS; - // // *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; - // // #endif + // this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now + // // get free clusters + // f_getfree(buffer, &freeClusters, &fsPtr); + + // // Get total sectors and free sectors + // totalSectors = (fs.n_fatent - 2) * fs.csize; + // freeSectors = freeClusters * fs.csize; + + // #if FF_MAX_SS != FF_MIN_SS + // *totalSize = (int64_t)totalSectors * fs.ssize; + // *totalFreeSpace = (int64_t)freeSectors * fs.ssize; + // #else + // *totalSize = (int64_t)totalSectors * FF_MAX_SS; + // *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; + // #endif *totalSize = -1; *totalFreeSpace = -1; From efcb9a0a1e3ba8c82110b6f48e8e583ee1751e6e Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 10 Apr 2025 20:48:38 +0100 Subject: [PATCH 5/7] Un-comment f_getfree In fatfs drivers for various targets. --- targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp | 36 ++++++++++------------ targets/ESP32/_FatFs/fatfs_FS_Driver.cpp | 36 ++++++++++------------ 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp b/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp index a04406f40a..6a42dbe896 100644 --- a/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp +++ b/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp @@ -168,34 +168,30 @@ HRESULT FATFS_FS_Driver::GetSizeInfo(const VOLUME_ID *volume, int64_t *totalSize { (void)totalSize; - // FATFS *fsPtr = &fs; - // char buffer[3]; - // DWORD freeClusters, freeSectors, totalSectors; + FATFS *fsPtr = &fs; + char buffer[3]; + DWORD freeClusters, freeSectors, totalSectors; - // FATFS *fs = GetFatFsByVolumeId(volume, false); + FATFS *fs = GetFatFsByVolumeId(volume, false); FileSystemVolume *currentVolume = FileSystemVolumeList::FindVolume(volume->volumeId); f_chdrive(currentVolume->m_rootName); - // this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now - // // get free clusters - // f_getfree(buffer, &freeClusters, &fsPtr); + // get free clusters + f_getfree(buffer, &freeClusters, &fsPtr); - // // Get total sectors and free sectors - // totalSectors = (fs.n_fatent - 2) * fs.csize; - // freeSectors = freeClusters * fs.csize; + // Get total sectors and free sectors + totalSectors = (fs.n_fatent - 2) * fs.csize; + freeSectors = freeClusters * fs.csize; - // #if FF_MAX_SS != FF_MIN_SS - // *totalSize = (int64_t)totalSectors * fs.ssize; - // *totalFreeSpace = (int64_t)freeSectors * fs.ssize; - // #else - // *totalSize = (int64_t)totalSectors * FF_MAX_SS; - // *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; - // #endif - - *totalSize = -1; - *totalFreeSpace = -1; + #if FF_MAX_SS != FF_MIN_SS + *totalSize = (int64_t)totalSectors * fs.ssize; + *totalFreeSpace = (int64_t)freeSectors * fs.ssize; + #else + *totalSize = (int64_t)totalSectors * FF_MAX_SS; + *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; + #endif return S_OK; } diff --git a/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp b/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp index 07b1465e77..5c05021586 100644 --- a/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp +++ b/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp @@ -83,34 +83,30 @@ HRESULT FATFS_FS_Driver::GetSizeInfo(const VOLUME_ID *volume, int64_t *totalSize { (void)totalSize; - // FATFS *fsPtr = &fs; - // char buffer[3]; - // DWORD freeClusters, freeSectors, totalSectors; + FATFS *fsPtr = &fs; + char buffer[3]; + DWORD freeClusters, freeSectors, totalSectors; - // FATFS *fs = GetFatFsByVolumeId(volume, false); + FATFS *fs = GetFatFsByVolumeId(volume, false); FileSystemVolume *currentVolume = FileSystemVolumeList::FindVolume(volume->volumeId); f_chdrive(currentVolume->m_rootName); - // this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now - // // get free clusters - // f_getfree(buffer, &freeClusters, &fsPtr); + // get free clusters + f_getfree(buffer, &freeClusters, &fsPtr); - // // Get total sectors and free sectors - // totalSectors = (fs.n_fatent - 2) * fs.csize; - // freeSectors = freeClusters * fs.csize; + // Get total sectors and free sectors + totalSectors = (fs.n_fatent - 2) * fs.csize; + freeSectors = freeClusters * fs.csize; - // #if FF_MAX_SS != FF_MIN_SS - // *totalSize = (int64_t)totalSectors * fs.ssize; - // *totalFreeSpace = (int64_t)freeSectors * fs.ssize; - // #else - // *totalSize = (int64_t)totalSectors * FF_MAX_SS; - // *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; - // #endif - - *totalSize = -1; - *totalFreeSpace = -1; + #if FF_MAX_SS != FF_MIN_SS + *totalSize = (int64_t)totalSectors * fs.ssize; + *totalFreeSpace = (int64_t)freeSectors * fs.ssize; + #else + *totalSize = (int64_t)totalSectors * FF_MAX_SS; + *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; + #endif return S_OK; } From 4472b99453d0e39ba9113e0b0dd874f53ecad2ab Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 10 Apr 2025 20:58:43 +0100 Subject: [PATCH 6/7] Revert changes It is a little more complicated and should happen in a seperate PR. --- targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp | 36 ++++++++++++---------- targets/ESP32/_FatFs/fatfs_FS_Driver.cpp | 36 ++++++++++++---------- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp b/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp index 6a42dbe896..a04406f40a 100644 --- a/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp +++ b/targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp @@ -168,30 +168,34 @@ HRESULT FATFS_FS_Driver::GetSizeInfo(const VOLUME_ID *volume, int64_t *totalSize { (void)totalSize; - FATFS *fsPtr = &fs; - char buffer[3]; - DWORD freeClusters, freeSectors, totalSectors; + // FATFS *fsPtr = &fs; + // char buffer[3]; + // DWORD freeClusters, freeSectors, totalSectors; - FATFS *fs = GetFatFsByVolumeId(volume, false); + // FATFS *fs = GetFatFsByVolumeId(volume, false); FileSystemVolume *currentVolume = FileSystemVolumeList::FindVolume(volume->volumeId); f_chdrive(currentVolume->m_rootName); - // get free clusters - f_getfree(buffer, &freeClusters, &fsPtr); + // this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now + // // get free clusters + // f_getfree(buffer, &freeClusters, &fsPtr); - // Get total sectors and free sectors - totalSectors = (fs.n_fatent - 2) * fs.csize; - freeSectors = freeClusters * fs.csize; + // // Get total sectors and free sectors + // totalSectors = (fs.n_fatent - 2) * fs.csize; + // freeSectors = freeClusters * fs.csize; - #if FF_MAX_SS != FF_MIN_SS - *totalSize = (int64_t)totalSectors * fs.ssize; - *totalFreeSpace = (int64_t)freeSectors * fs.ssize; - #else - *totalSize = (int64_t)totalSectors * FF_MAX_SS; - *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; - #endif + // #if FF_MAX_SS != FF_MIN_SS + // *totalSize = (int64_t)totalSectors * fs.ssize; + // *totalFreeSpace = (int64_t)freeSectors * fs.ssize; + // #else + // *totalSize = (int64_t)totalSectors * FF_MAX_SS; + // *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; + // #endif + + *totalSize = -1; + *totalFreeSpace = -1; return S_OK; } diff --git a/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp b/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp index 5c05021586..07b1465e77 100644 --- a/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp +++ b/targets/ESP32/_FatFs/fatfs_FS_Driver.cpp @@ -83,30 +83,34 @@ HRESULT FATFS_FS_Driver::GetSizeInfo(const VOLUME_ID *volume, int64_t *totalSize { (void)totalSize; - FATFS *fsPtr = &fs; - char buffer[3]; - DWORD freeClusters, freeSectors, totalSectors; + // FATFS *fsPtr = &fs; + // char buffer[3]; + // DWORD freeClusters, freeSectors, totalSectors; - FATFS *fs = GetFatFsByVolumeId(volume, false); + // FATFS *fs = GetFatFsByVolumeId(volume, false); FileSystemVolume *currentVolume = FileSystemVolumeList::FindVolume(volume->volumeId); f_chdrive(currentVolume->m_rootName); - // get free clusters - f_getfree(buffer, &freeClusters, &fsPtr); + // this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now + // // get free clusters + // f_getfree(buffer, &freeClusters, &fsPtr); - // Get total sectors and free sectors - totalSectors = (fs.n_fatent - 2) * fs.csize; - freeSectors = freeClusters * fs.csize; + // // Get total sectors and free sectors + // totalSectors = (fs.n_fatent - 2) * fs.csize; + // freeSectors = freeClusters * fs.csize; - #if FF_MAX_SS != FF_MIN_SS - *totalSize = (int64_t)totalSectors * fs.ssize; - *totalFreeSpace = (int64_t)freeSectors * fs.ssize; - #else - *totalSize = (int64_t)totalSectors * FF_MAX_SS; - *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; - #endif + // #if FF_MAX_SS != FF_MIN_SS + // *totalSize = (int64_t)totalSectors * fs.ssize; + // *totalFreeSpace = (int64_t)freeSectors * fs.ssize; + // #else + // *totalSize = (int64_t)totalSectors * FF_MAX_SS; + // *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS; + // #endif + + *totalSize = -1; + *totalFreeSpace = -1; return S_OK; } From ea31b1b5178055ba20fa756467623cfa56a3f4b0 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 10 Apr 2025 21:01:38 +0100 Subject: [PATCH 7/7] Update dev container versions --- .devcontainer/All/Dockerfile.All | 2 +- .devcontainer/AzureRTOS/Dockerfile.AzureRTOS | 2 +- .devcontainer/ChibiOS/Dockerfile.ChibiOS | 2 +- .devcontainer/ESP32/Dockerfile.ESP32 | 2 +- .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.devcontainer/All/Dockerfile.All b/.devcontainer/All/Dockerfile.All index e42e4a2748..eb5a866b62 100644 --- a/.devcontainer/All/Dockerfile.All +++ b/.devcontainer/All/Dockerfile.All @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-all:v2.56 +FROM ghcr.io/nanoframework/dev-container-all:v2.57 diff --git a/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS b/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS index 7b34de6e73..f35fb4349d 100644 --- a/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS +++ b/.devcontainer/AzureRTOS/Dockerfile.AzureRTOS @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-azure-rtos:v1.33 +FROM ghcr.io/nanoframework/dev-container-azure-rtos:v1.34 diff --git a/.devcontainer/ChibiOS/Dockerfile.ChibiOS b/.devcontainer/ChibiOS/Dockerfile.ChibiOS index 3b6b503b83..f635962e5d 100644 --- a/.devcontainer/ChibiOS/Dockerfile.ChibiOS +++ b/.devcontainer/ChibiOS/Dockerfile.ChibiOS @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-chibios:v1.34 +FROM ghcr.io/nanoframework/dev-container-chibios:v1.35 diff --git a/.devcontainer/ESP32/Dockerfile.ESP32 b/.devcontainer/ESP32/Dockerfile.ESP32 index 4cdc5ea9fd..c9bc9d668b 100644 --- a/.devcontainer/ESP32/Dockerfile.ESP32 +++ b/.devcontainer/ESP32/Dockerfile.ESP32 @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-esp32:v2.36 +FROM ghcr.io/nanoframework/dev-container-esp32:v2.37 diff --git a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP index 4ba5bcd4f7..151e8af502 100644 --- a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP +++ b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.06 +FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.07