2019-04-01 04:52 AM
Hello,
I currently work with an STM32L496ZG chip and the EEPROM emulation driver (download on https://www.st.com/en/embedded-software/x-cube-eeprom.html).
In the "eeprom_emul.h" file, we have the next macro :
#define PAGE_ADDRESS(__PAGE__) (uint32_t)(FLASH_BASE + (__PAGE__) * PAGE_SIZE + ((START_PAGE_ADDRESS - FLASH_BASE) / BANK_SIZE) * BANK_SIZE) /*!< Get page address from page index */
#define PAGE(__ADDRESS__) (uint32_t)((((__ADDRESS__) - FLASH_BASE) % BANK_SIZE) / FLASH_PAGE_SIZE) /*!< Get page index from page address */
#define PREVIOUS_PAGE(__PAGE__) (uint32_t)((((__PAGE__) - START_PAGE - 1U + PAGES_NUMBER) % PAGES_NUMBER) + START_PAGE) /*!< Get page index of previous page, among circular page list */
#define FOLLOWING_PAGE(__PAGE__) (uint32_t)((((__PAGE__) - START_PAGE + 1U) % PAGES_NUMBER) + START_PAGE) /*!< Get page index of following page, among circular page list */
It is use by "eprom_emul.c" for these functions (Init, CleanUP, Read...).
I need to change the address of the EEPROM emulation in my flash :
start page pass to 0x08070300 (end of bank one of the flash) instead of 0x08080000. However, when I change this address, the macros PAGE_ADDRESS(__PAGE__) and PAGE(__ADDRESS)__ return wrong answer (look like the start address stay to 0x08080000).
Do you now what is wrong ? How can I change the EEPROM emulation location in my flash ? Do I need to change these macros ?
Thank you in advance,
Sincerly,
Adrian
2019-04-01 06:16 AM
It's in the documentation
Section 4.1.3 - User defines
2019-04-01 07:27 AM
Thanks. Finally the problem was a misunderstanding of the parameters of these macros.