Skip to content

Commit 743969f

Browse files
committed
Size of structure made latform independent.
1 parent 560753c commit 743969f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

components/wear_levelling/private_include/WL_Config.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
* @brief This class is used as a structure to configure wear levelling module
2121
*
2222
*/
23+
#ifndef wl_config_t_size
24+
#define wl_config_t_size (int)((48 - (2*sizeof(size_t) + 7*sizeof(uint32_t)) + sizeof(uint32_t) - 1)/sizeof(uint32_t))
25+
#endif // wl_config_t_size
2326
typedef struct WL_Config_s {
2427
size_t start_addr; /*!< start address in the flash*/
2528
uint32_t full_mem_size; /*!< Amount of memory used to store data in bytes*/
@@ -29,12 +32,12 @@ typedef struct WL_Config_s {
2932
uint32_t wr_size; /*!< Minimum amount of bytes per one block at write operation: 1...*/
3033
uint32_t version; /*!< A version of current implementatioon. To erase and reallocate complete memory this ID must be different from id before.*/
3134
size_t temp_buff_size; /*!< Size of temporary allocated buffer to copy from one flash area to another. The best way, if this value will be equal to sector size.*/
32-
uint32_t reserved[3]; /*!< dummy array to make wl_config_t size compatible with flash encryption (divided by 16)*/
35+
uint32_t reserved[wl_config_t_size]; /*!< dummy array to make wl_config_t size compatible with flash encryption (divided by 16)*/
3336
uint32_t crc; /*!< CRC for this config*/
3437
public:
3538
WL_Config_s()
3639
{
37-
for (int i=0 ; i< 3 ; i++) this->reserved[i] = 0;
40+
for (int i=0 ; i< wl_config_t_size ; i++) this->reserved[i] = 0;
3841
}
3942
} wl_config_t;
4043

0 commit comments

Comments
 (0)