From ec0b6c589a42cfb620760188c04c95f1cb611692 Mon Sep 17 00:00:00 2001 From: Adithya65 Date: Tue, 29 Jul 2025 20:07:08 +0530 Subject: [PATCH 1/2] fat:fix structure packing --- include/ff_ioman.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/ff_ioman.h b/include/ff_ioman.h index b324d87..ac20874 100644 --- a/include/ff_ioman.h +++ b/include/ff_ioman.h @@ -32,6 +32,12 @@ #ifndef _FF_IOMAN_H_ #define _FF_IOMAN_H_ +#if defined( __GNUC__ ) + #define FF_PACKED __attribute__( ( packed ) ) +#else + #define FF_PACKED +#endif + #ifdef __cplusplus extern "C" { #endif @@ -379,7 +385,7 @@ ucActive : 8, /* FF_FAT_PTBL_ACTIVE */ ucPartitionID : 8, /* FF_FAT_PTBL_ID */ bIsExtended : 1; - } FF_Part_t; + } FF_Part_t FF_PACKED; typedef struct _SPartFound { From 1b77a8a76a493797c488aa2109a7cdf9281dc2e5 Mon Sep 17 00:00:00 2001 From: Adithya65 Date: Fri, 1 Aug 2025 18:05:52 +0530 Subject: [PATCH 2/2] Fix:replace bitfields with uint8_t type --- include/ff_ioman.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/include/ff_ioman.h b/include/ff_ioman.h index ac20874..5a5b6a6 100644 --- a/include/ff_ioman.h +++ b/include/ff_ioman.h @@ -32,12 +32,6 @@ #ifndef _FF_IOMAN_H_ #define _FF_IOMAN_H_ -#if defined( __GNUC__ ) - #define FF_PACKED __attribute__( ( packed ) ) -#else - #define FF_PACKED -#endif - #ifdef __cplusplus extern "C" { #endif @@ -381,11 +375,11 @@ { uint32_t ulStartLBA; /* FF_FAT_PTBL_LBA */ uint32_t ulSectorCount; /* FF_FAT_PTBL_SECT_COUNT */ - uint32_t - ucActive : 8, /* FF_FAT_PTBL_ACTIVE */ - ucPartitionID : 8, /* FF_FAT_PTBL_ID */ - bIsExtended : 1; - } FF_Part_t FF_PACKED; + uint8_t ucActive; /* FF_FAT_PTBL_ACTIVE */ + uint8_t ucPartitionID; /* FF_FAT_PTBL_ID */ + uint8_t bIsExtended; + uint8_t bIsUnused; /*Byte added to make the length a multiple of 32 byte.*/ + } FF_Part_t; typedef struct _SPartFound {