2022-11-29 03:58 AM
In X-CUBE-EEPROM, the calculation of PAGES_NUMBER from NB_OF_VARIABLES is defined as:
#define PAGES_NUMBER (((((NB_OF_VARIABLES + NB_MAX_ELEMENTS_BY_PAGE) / NB_MAX_ELEMENTS_BY_PAGE) * 2U) * CYCLES_NUMBER) + GUARD_PAGES_NUMBER)
With a 2K flash page and a 32-byte header, 252 8-byte variables will fit in one page, as stated in AN4894. However, setting NB_OF_VARIABLES to 252 allocates an extra page.
To get the correct number of pages it should be:
#define PAGES_NUMBER (((((NB_OF_VARIABLES + NB_MAX_ELEMENTS_BY_PAGE - 1U) / NB_MAX_ELEMENTS_BY_PAGE) * 2U) * CYCLES_NUMBER) + GUARD_PAGES_NUMBER)
Solved! Go to Solution.
2022-11-29 04:26 AM
Hello @Aimee ,
Welcome to the STM32 Community and thank you for having reported this issue.
I have submitted an internal ticket (ID 140029) for analysis and work with our development team.
(PS: ID 140029 is an internal tracking number and is not accessible outside of ST).
Thanks
Imen
2022-11-29 04:26 AM
Hello @Aimee ,
Welcome to the STM32 Community and thank you for having reported this issue.
I have submitted an internal ticket (ID 140029) for analysis and work with our development team.
(PS: ID 140029 is an internal tracking number and is not accessible outside of ST).
Thanks
Imen