diff --git a/inc/fdb_cfg_template.h b/inc/fdb_cfg_template.h index f8bde78..ee96d92 100644 --- a/inc/fdb_cfg_template.h +++ b/inc/fdb_cfg_template.h @@ -34,7 +34,7 @@ #ifdef FDB_USING_FAL_MODE /* the flash write granularity, unit: bit - * only support 1(nor flash)/ 8(stm32f2/f4)/ 32(stm32f1)/ 64(stm32f7)/ 128(stm32h5) */ + * only support 1(nor flash)/ 8(stm32f2/f4)/ 32(stm32f1)/ 64(stm32f7)/ 128(stm32h5)/ 256(stm32h7) */ #define FDB_WRITE_GRAN /* @note you must define it for a value */ #endif diff --git a/src/fdb_kvdb.c b/src/fdb_kvdb.c index 10c29d4..9438324 100644 --- a/src/fdb_kvdb.c +++ b/src/fdb_kvdb.c @@ -27,8 +27,8 @@ #error "Please configure flash write granularity (in fdb_cfg.h)" #endif -#if FDB_WRITE_GRAN != 1 && FDB_WRITE_GRAN != 8 && FDB_WRITE_GRAN != 32 && FDB_WRITE_GRAN != 64 && FDB_WRITE_GRAN != 128 -#error "the write gran can be only setting as 1, 8, 32, 64 and 128" +#if FDB_WRITE_GRAN != 1 && FDB_WRITE_GRAN != 8 && FDB_WRITE_GRAN != 32 && FDB_WRITE_GRAN != 64 && FDB_WRITE_GRAN != 128 && FDB_WRITE_GRAN != 256 +#error "the write gran can be only setting as 1, 8, 32, 64, 128 and 256" #endif /* magic word(`F`, `D`, `B`, `1`) */ @@ -109,6 +109,8 @@ struct sector_hdr_data { uint32_t reserved; #if (FDB_WRITE_GRAN == 64) || (FDB_WRITE_GRAN == 128) uint8_t padding[4]; /**< align padding for 64bit and 128bit write granularity */ +#elif (FDB_WRITE_GRAN == 256) + uint8_t padding[20]; /**< align padding for 256bit write granularity */ #endif }; typedef struct sector_hdr_data *sector_hdr_data_t; @@ -122,9 +124,10 @@ struct kv_hdr_data { uint32_t value_len; /**< value length */ #if (FDB_WRITE_GRAN == 64) uint8_t padding[4]; /**< align padding for 64bit write granularity */ -#endif -#if (FDB_WRITE_GRAN == 128) - uint8_t padding[12]; /**< align padding for 128bit write granularity */ +#elif (FDB_WRITE_GRAN == 128) + uint8_t padding[12]; /**< align padding for 128bit write granularity */ +#elif (FDB_WRITE_GRAN == 256) + uint8_t padding[15]; /**< align padding for 256bit write granularity */ #endif }; typedef struct kv_hdr_data *kv_hdr_data_t; diff --git a/src/fdb_tsdb.c b/src/fdb_tsdb.c index bc53375..c023a00 100644 --- a/src/fdb_tsdb.c +++ b/src/fdb_tsdb.c @@ -25,8 +25,8 @@ #if defined(FDB_USING_TSDB) -#if (FDB_WRITE_GRAN == 64) || (FDB_WRITE_GRAN == 128) -#error "Flash 64 or 128 bits write granularity is not supported in TSDB yet!" +#if (FDB_WRITE_GRAN == 64) || (FDB_WRITE_GRAN == 128) || (FDB_WRITE_GRAN == 256) +#error "Flash 64 or 128 or 256 bits write granularity is not supported in TSDB yet!" #endif /* magic word(`T`, `S`, `L`, `0`) */