From ee280d9d147150435da4ede04176f8a81a867c6d Mon Sep 17 00:00:00 2001 From: nflandin Date: Fri, 21 Jun 2024 10:50:48 -0700 Subject: [PATCH 1/7] Update fx_media_format.c Correction to boot record signature writing; attempted to bring in line with design intent of variable length boot record as used earlier in function. --- common/src/fx_media_format.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/common/src/fx_media_format.c b/common/src/fx_media_format.c index e5008ab..d82e78c 100644 --- a/common/src/fx_media_format.c +++ b/common/src/fx_media_format.c @@ -443,17 +443,24 @@ UINT sectors_per_fat, f, s; _fx_utility_memory_set(&byte_ptr[j + i], ' ', (11 - i)); #endif /* FX_DISABLE_FORCE_MEMORY_OPERATION */ - +/* Set bootrecord signature. */ #ifdef FX_FORCE_512_BYTE_BOOT_SECTOR - - /* Set bootrecord signature. */ - byte_ptr[510] = 0x55; - byte_ptr[511] = 0xAA; + /* Put the boot signature in the standard position. */ + byte_ptr[FX_SIG_OFFSET] = FX_SIG_BYTE_1; + byte_ptr[FX_SIG_OFFSET + 1] = FX_SIG_BYTE_2; #else - - /* Set bootrecord signature. */ - byte_ptr[bytes_per_sector - 2] = 0x55; - byte_ptr[bytes_per_sector - 1] = 0xAA; + if (bytes_per_sector < 512) + { + /* Put the boot signature at the end of the sector. */ + byte_ptr[bytes_per_sector - 2] = FX_SIG_BYTE_1; + byte_ptr[bytes_per_sector - 1] = FX_SIG_BYTE_2; + } + else + { + /* Put the boot signature in the standard position. */ + byte_ptr[FX_SIG_OFFSET] = FX_SIG_BYTE_1; + byte_ptr[FX_SIG_OFFSET + 1] = FX_SIG_BYTE_2; + } #endif /* Select the boot record write command. */ From 151b9158ee81195a0c068e9ff7b2bb86fef6cfc5 Mon Sep 17 00:00:00 2001 From: nflandin Date: Tue, 3 Sep 2024 15:05:19 -0700 Subject: [PATCH 2/7] re: issue 47 by coran21 Correction of FSINFO trail signature in format function --- common/src/fx_media_format.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/fx_media_format.c b/common/src/fx_media_format.c index d82e78c..ca1cb22 100644 --- a/common/src/fx_media_format.c +++ b/common/src/fx_media_format.c @@ -517,8 +517,8 @@ UINT sectors_per_fat, f, s; byte_ptr[487] = 0x61; /* Build the final signature word, this too is used to help verify that this is a FSINFO sector. */ - byte_ptr[508] = 0x55; - byte_ptr[509] = 0xAA; + byte_ptr[FX_SIG_OFFSET] = FX_SIG_BYTE_1; + byte_ptr[FX_SIG_OFFSET + 1] = FX_SIG_BYTE_2; /* Setup the total available clusters on the media. We need to subtract 1 for the FAT32 root directory. */ _fx_utility_32_unsigned_write(&byte_ptr[488], (total_clusters - 1)); From 8112cd45ccdc5a7d60154e8d22137cb47940750e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Desbiens?= Date: Mon, 21 Jul 2025 12:38:46 -0400 Subject: [PATCH 3/7] Added error handling to the sample. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Frédéric Desbiens --- samples/demo_filex.c | 45 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/samples/demo_filex.c b/samples/demo_filex.c index b7649ba..2429300 100644 --- a/samples/demo_filex.c +++ b/samples/demo_filex.c @@ -1,3 +1,15 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2025 Eclipse ThreadX contributors + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + + /* This is a small demo of the high-performance FileX FAT file system. It includes setup for a small 34KB RAM disk and a loop that writes and reads a small file. */ #include "fx_api.h" @@ -29,10 +41,12 @@ void thread_0_entry(ULONG thread_input); /* Define FileX global data structures. */ - +#define TOTAL_SECTORS 256 +#define SECTOR_SIZE 512 FX_MEDIA ram_disk; FX_FILE my_file; + #ifndef FX_STANDALONE_ENABLE CHAR *ram_disk_memory; #else @@ -102,8 +116,12 @@ CHAR local_buffer[30]; /* Format the RAM disk - the memory for the RAM disk was setup in - tx_application_define above. */ - fx_media_format(&ram_disk, + tx_application_define above. + + Important Note: The user must ensure there is enough RAM for the format + specified. Otherwise, memory corruption can occur. + */ + status = fx_media_format(&ram_disk, _fx_ram_driver, // Driver entry ram_disk_memory, // RAM disk memory pointer media_memory, // Media buffer pointer @@ -112,27 +130,34 @@ CHAR local_buffer[30]; 1, // Number of FATs 32, // Directory Entries 0, // Hidden sectors - 256, // Total sectors - 512, // Sector size + TOTAL_SECTORS, // Total sectors + SECTOR_SIZE, // Sector size 8, // Sectors per cluster 1, // Heads 1); // Sectors per track + /* Determine if the RAM disk format was successful. */ + if (status != FX_SUCCESS) + { + /* Error formatting the RAM disk. */ + printf("HTTPS RAM disk format failed, error: %x\n", status); + return; + } /* Loop to repeat the demo over and over! */ do { - /* Open the RAM disk. */ status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, media_memory, sizeof(media_memory)); - /* Check the media open status. */ + /* Determine if the RAM disk open was successful. */ if (status != FX_SUCCESS) { - - /* Error, break the loop! */ - break; + /* Error opening the RAM disk. */ + printf("RAM disk open failed, error: %x\n", status); + return; } + } #ifdef FX_ENABLE_FAULT_TOLERANT status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_memory, sizeof(fault_tolerant_memory)); From 42b4ee916e49a49e92901df8d42e2d4683859918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Desbiens?= Date: Mon, 28 Jul 2025 13:55:01 -0400 Subject: [PATCH 4/7] Ensure proper RAM Disk sizing in the FileX sample. --- samples/demo_filex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/demo_filex.c b/samples/demo_filex.c index 2429300..aee5416 100644 --- a/samples/demo_filex.c +++ b/samples/demo_filex.c @@ -50,7 +50,7 @@ FX_FILE my_file; #ifndef FX_STANDALONE_ENABLE CHAR *ram_disk_memory; #else -unsigned char ram_disk_memory[256*512]; +unsigned char ram_disk_memory[TOTAL_SECTORS*SECTOR_SIZE]; #endif /* Define ThreadX global data structures. */ From ecd70a28fe0ab3a04e3821748affc4ff78b5d7af Mon Sep 17 00:00:00 2001 From: David Streicher Date: Fri, 19 Sep 2025 09:57:44 +0200 Subject: [PATCH 5/7] Add CMake support for Cortex M33 Add convenience CMake files for Cortex M33 similar to other Cortex Mx targets --- ports/cortex_m33/gnu/CMakeLists.txt | 9 +++++++++ ports/cortex_m33/gnu/inc/fx_port.h | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 ports/cortex_m33/gnu/CMakeLists.txt create mode 100644 ports/cortex_m33/gnu/inc/fx_port.h diff --git a/ports/cortex_m33/gnu/CMakeLists.txt b/ports/cortex_m33/gnu/CMakeLists.txt new file mode 100644 index 0000000..62111b3 --- /dev/null +++ b/ports/cortex_m33/gnu/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${PROJECT_NAME} PRIVATE + # {{BEGIN_TARGET_SOURCES}} + + # {{END_TARGET_SOURCES}} +) + +target_include_directories(${PROJECT_NAME} PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/inc +) \ No newline at end of file diff --git a/ports/cortex_m33/gnu/inc/fx_port.h b/ports/cortex_m33/gnu/inc/fx_port.h new file mode 100644 index 0000000..32e7a0a --- /dev/null +++ b/ports/cortex_m33/gnu/inc/fx_port.h @@ -0,0 +1,23 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** FileX Component */ +/** */ +/** Port Specific */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/* Include the generic version of fx_port.h. */ +#include "../../../generic/inc/fx_port.h" From 047f822392655c2c43879df2ae6311200ef3aaf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Desbiens?= Date: Mon, 29 Sep 2025 11:55:12 +0100 Subject: [PATCH 6/7] Fix typo in sample code. --- samples/demo_filex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/demo_filex.c b/samples/demo_filex.c index aee5416..8046429 100644 --- a/samples/demo_filex.c +++ b/samples/demo_filex.c @@ -157,7 +157,7 @@ CHAR local_buffer[30]; printf("RAM disk open failed, error: %x\n", status); return; } - } + #ifdef FX_ENABLE_FAULT_TOLERANT status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_memory, sizeof(fault_tolerant_memory)); From 584c5fff0d37d6502ee29e954bc40b208ed2c957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Desbiens?= Date: Mon, 29 Sep 2025 11:57:21 +0100 Subject: [PATCH 7/7] Updated version number and added build number and hotfix. --- common/inc/fx_api.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/inc/fx_api.h b/common/inc/fx_api.h index f04ed74..8ad9f8d 100644 --- a/common/inc/fx_api.h +++ b/common/inc/fx_api.h @@ -138,7 +138,9 @@ extern "C" { #define AZURE_RTOS_FILEX #define FILEX_MAJOR_VERSION 6 #define FILEX_MINOR_VERSION 4 -#define FILEX_PATCH_VERSION 1 +#define FILEX_PATCH_VERSION 2 +#define FILEX_BUILD_VERSION 202503 +#define FILEX_HOTFIX_VERSION '' /* Define the following symbols for backward compatibility */ #define EL_PRODUCT_FILEX