@@ -45,6 +45,31 @@ extern "C" {
4545
4646/* Exported types ------------------------------------------------------------*/
4747/* Exported constants --------------------------------------------------------*/
48+ #if defined(STM32MP1xx )
49+ /* Note for STM32MP1xx devices:
50+ * Those devices do not have non-volatile memory. The emulation is done
51+ * in RETRAM. Therefore data will be preserved *only* when VBAT is supplied
52+ * (e.g. A coin battery is connected to CN3 on STM32MP157A_DK1) and
53+ * the coprocessor is waken up from STANBY mode.
54+ * The data won't be preserved from cold boot, even if VBAT is connected.
55+ * See: https://community.st.com/s/question/0D50X0000B44pHUSQY/doesnt-the-mcu-coprocessor-have-nonvolatile-memory
56+ */
57+ #define EEPROM_RETRAM_MODE
58+ /* 4kB is the same size as EEPROM size of ATMega2560. */
59+ #ifndef EEPROM_RETRAM_MODE_SIZE
60+ #define EEPROM_RETRAM_MODE_SIZE ((uint32_t)(4*1024))
61+ #endif
62+ /* RETRAM start address is 0x00000000 (retset entry) and end address is
63+ * 0x00020000 (64kB in total). The by default, ldscript.ld for STM32MP1xx
64+ * does not define address between 0x00000298 (end of ISR Vector) and 0x00020000.
65+ * So it is okay to use in this address range. Make sure ldscript.ld does not
66+ * overrap the following address range.
67+ */
68+ #ifndef EEPROM_RETRAM_START_ADDRESS
69+ #define EEPROM_RETRAM_START_ADDRESS (0x00000400UL)
70+ #endif
71+ #define E2END (EEPROM_RETRAM_MODE_SIZE - 1)
72+ #else
4873#ifndef FLASH_PAGE_SIZE
4974/*
5075 * FLASH_PAGE_SIZE is not defined for STM32F2xx, STM32F4xx and STM32F7xx
@@ -56,6 +81,7 @@ extern "C" {
5681#define FLASH_PAGE_SIZE ((uint32_t)(16*1024)) /* 16kB page */
5782#endif
5883#define E2END (FLASH_PAGE_SIZE - 1)
84+ #endif
5985
6086/* Exported macro ------------------------------------------------------------*/
6187/* Exported functions ------------------------------------------------------- */
0 commit comments