Skip to content

Commit 048a01e

Browse files
authored
Merge pull request #76 from eclipse-threadx/dev
Merge changes ahead of the v6.4.2.202503 release.
2 parents 9023227 + 584c5ff commit 048a01e

File tree

5 files changed

+89
-23
lines changed

5 files changed

+89
-23
lines changed

common/inc/fx_api.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ extern "C" {
138138
#define AZURE_RTOS_FILEX
139139
#define FILEX_MAJOR_VERSION 6
140140
#define FILEX_MINOR_VERSION 4
141-
#define FILEX_PATCH_VERSION 1
141+
#define FILEX_PATCH_VERSION 2
142+
#define FILEX_BUILD_VERSION 202503
143+
#define FILEX_HOTFIX_VERSION ''
142144

143145
/* Define the following symbols for backward compatibility */
144146
#define EL_PRODUCT_FILEX

common/src/fx_media_format.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -443,17 +443,24 @@ UINT sectors_per_fat, f, s;
443443
_fx_utility_memory_set(&byte_ptr[j + i], ' ', (11 - i));
444444
#endif /* FX_DISABLE_FORCE_MEMORY_OPERATION */
445445

446-
446+
/* Set bootrecord signature. */
447447
#ifdef FX_FORCE_512_BYTE_BOOT_SECTOR
448-
449-
/* Set bootrecord signature. */
450-
byte_ptr[510] = 0x55;
451-
byte_ptr[511] = 0xAA;
448+
/* Put the boot signature in the standard position. */
449+
byte_ptr[FX_SIG_OFFSET] = FX_SIG_BYTE_1;
450+
byte_ptr[FX_SIG_OFFSET + 1] = FX_SIG_BYTE_2;
452451
#else
453-
454-
/* Set bootrecord signature. */
455-
byte_ptr[bytes_per_sector - 2] = 0x55;
456-
byte_ptr[bytes_per_sector - 1] = 0xAA;
452+
if (bytes_per_sector < 512)
453+
{
454+
/* Put the boot signature at the end of the sector. */
455+
byte_ptr[bytes_per_sector - 2] = FX_SIG_BYTE_1;
456+
byte_ptr[bytes_per_sector - 1] = FX_SIG_BYTE_2;
457+
}
458+
else
459+
{
460+
/* Put the boot signature in the standard position. */
461+
byte_ptr[FX_SIG_OFFSET] = FX_SIG_BYTE_1;
462+
byte_ptr[FX_SIG_OFFSET + 1] = FX_SIG_BYTE_2;
463+
}
457464
#endif
458465

459466
/* Select the boot record write command. */
@@ -510,8 +517,8 @@ UINT sectors_per_fat, f, s;
510517
byte_ptr[487] = 0x61;
511518

512519
/* Build the final signature word, this too is used to help verify that this is a FSINFO sector. */
513-
byte_ptr[508] = 0x55;
514-
byte_ptr[509] = 0xAA;
520+
byte_ptr[FX_SIG_OFFSET] = FX_SIG_BYTE_1;
521+
byte_ptr[FX_SIG_OFFSET + 1] = FX_SIG_BYTE_2;
515522

516523
/* Setup the total available clusters on the media. We need to subtract 1 for the FAT32 root directory. */
517524
_fx_utility_32_unsigned_write(&byte_ptr[488], (total_clusters - 1));
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
target_sources(${PROJECT_NAME} PRIVATE
2+
# {{BEGIN_TARGET_SOURCES}}
3+
4+
# {{END_TARGET_SOURCES}}
5+
)
6+
7+
target_include_directories(${PROJECT_NAME} PUBLIC
8+
${CMAKE_CURRENT_LIST_DIR}/inc
9+
)

ports/cortex_m33/gnu/inc/fx_port.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/***************************************************************************
2+
* Copyright (c) 2024 Microsoft Corporation
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the MIT License which is available at
6+
* https://opensource.org/licenses/MIT.
7+
*
8+
* SPDX-License-Identifier: MIT
9+
**************************************************************************/
10+
11+
12+
/**************************************************************************/
13+
/**************************************************************************/
14+
/** */
15+
/** FileX Component */
16+
/** */
17+
/** Port Specific */
18+
/** */
19+
/**************************************************************************/
20+
/**************************************************************************/
21+
22+
/* Include the generic version of fx_port.h. */
23+
#include "../../../generic/inc/fx_port.h"

samples/demo_filex.c

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/***************************************************************************
2+
* Copyright (c) 2024 Microsoft Corporation
3+
* Copyright (c) 2025 Eclipse ThreadX contributors
4+
*
5+
* This program and the accompanying materials are made available under the
6+
* terms of the MIT License which is available at
7+
* https://opensource.org/licenses/MIT.
8+
*
9+
* SPDX-License-Identifier: MIT
10+
**************************************************************************/
11+
12+
113
/* This is a small demo of the high-performance FileX FAT file system. It includes setup for
214
a small 34KB RAM disk and a loop that writes and reads a small file. */
315
#include "fx_api.h"
@@ -29,14 +41,16 @@ void thread_0_entry(ULONG thread_input);
2941

3042

3143
/* Define FileX global data structures. */
32-
44+
#define TOTAL_SECTORS 256
45+
#define SECTOR_SIZE 512
3346
FX_MEDIA ram_disk;
3447
FX_FILE my_file;
3548

49+
3650
#ifndef FX_STANDALONE_ENABLE
3751
CHAR *ram_disk_memory;
3852
#else
39-
unsigned char ram_disk_memory[256*512];
53+
unsigned char ram_disk_memory[TOTAL_SECTORS*SECTOR_SIZE];
4054
#endif
4155

4256
/* Define ThreadX global data structures. */
@@ -102,8 +116,12 @@ CHAR local_buffer[30];
102116

103117

104118
/* Format the RAM disk - the memory for the RAM disk was setup in
105-
tx_application_define above. */
106-
fx_media_format(&ram_disk,
119+
tx_application_define above.
120+
121+
Important Note: The user must ensure there is enough RAM for the format
122+
specified. Otherwise, memory corruption can occur.
123+
*/
124+
status = fx_media_format(&ram_disk,
107125
_fx_ram_driver, // Driver entry
108126
ram_disk_memory, // RAM disk memory pointer
109127
media_memory, // Media buffer pointer
@@ -112,27 +130,34 @@ CHAR local_buffer[30];
112130
1, // Number of FATs
113131
32, // Directory Entries
114132
0, // Hidden sectors
115-
256, // Total sectors
116-
512, // Sector size
133+
TOTAL_SECTORS, // Total sectors
134+
SECTOR_SIZE, // Sector size
117135
8, // Sectors per cluster
118136
1, // Heads
119137
1); // Sectors per track
120138

139+
/* Determine if the RAM disk format was successful. */
140+
if (status != FX_SUCCESS)
141+
{
142+
/* Error formatting the RAM disk. */
143+
printf("HTTPS RAM disk format failed, error: %x\n", status);
144+
return;
145+
}
121146

122147
/* Loop to repeat the demo over and over! */
123148
do
124149
{
125-
126150
/* Open the RAM disk. */
127151
status = fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, media_memory, sizeof(media_memory));
128152

129-
/* Check the media open status. */
153+
/* Determine if the RAM disk open was successful. */
130154
if (status != FX_SUCCESS)
131155
{
132-
133-
/* Error, break the loop! */
134-
break;
156+
/* Error opening the RAM disk. */
157+
printf("RAM disk open failed, error: %x\n", status);
158+
return;
135159
}
160+
136161

137162
#ifdef FX_ENABLE_FAULT_TOLERANT
138163
status = fx_fault_tolerant_enable(&ram_disk, fault_tolerant_memory, sizeof(fault_tolerant_memory));

0 commit comments

Comments
 (0)