EEPROM emulation for Nucleo F746ZG

Dependencies:   mbed

Revision:
2:c6895dd2d958
Parent:
0:1756c3542c95
Child:
3:1002a12961c5
--- a/eeprom/eeprom.h	Tue Sep 27 20:36:44 2016 +0000
+++ b/eeprom/eeprom.h	Mon Nov 26 11:42:11 2018 +0000
@@ -41,7 +41,14 @@
 #define __EEPROM_H
 
 /* Includes ------------------------------------------------------------------*/
+#if defined (TARGET_NUCLEO_F401RE)
 #include "stm32f4xx_hal.h"
+#endif
+
+#if defined (TARGET_NUCLEO_F746ZG)
+#include "stm32f7xx_hal.h"
+#endif
+
 
 /* Exported constants --------------------------------------------------------*/
 /* EEPROM emulation firmware error codes */
@@ -51,23 +58,46 @@
 #define EE_TIMEOUT (uint32_t)HAL_TIMEOUT
 
 /* Define the size of the sectors to be used */
+#if defined (TARGET_NUCLEO_F401RE)
 #define PAGE_SIZE               (uint32_t)0x4000  /* Page size = 16KByte */
+#endif
+
+#if defined (TARGET_NUCLEO_F746ZG)
+#define PAGE_SIZE               (uint32_t)0x8000  /* Page size = 32KByte */
+#endif
+
 
 /* Device voltage range supposed to be [2.7V to 3.6V], the operation will 
    be done by word  */
 #define VOLTAGE_RANGE           (uint8_t)VOLTAGE_RANGE_3
 
 /* EEPROM start address in Flash */
+#if defined (TARGET_NUCLEO_F401RE)
 #define EEPROM_START_ADDRESS  ((uint32_t)0x08008000) /* EEPROM emulation start address:
                                                   from sector2 : after 16KByte of used 
                                                   Flash memory */
+#endif
+
+#if defined (TARGET_NUCLEO_F746ZG)
+#define EEPROM_START_ADDRESS  ((uint32_t)0x08010000) /* EEPROM emulation start address:
+                                                  from sector2 : after 32KByte of used 
+                                                  Flash memory */
+#endif
+
 
 /* Pages 0 and 1 base and end addresses */
 #define PAGE0_BASE_ADDRESS    ((uint32_t)(EEPROM_START_ADDRESS + 0x0000))
 #define PAGE0_END_ADDRESS     ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1)))
 #define PAGE0_ID               FLASH_SECTOR_2
 
+#if defined (TARGET_NUCLEO_F401RE)
 #define PAGE1_BASE_ADDRESS    ((uint32_t)(EEPROM_START_ADDRESS + 0x4000))
+#endif
+
+#if defined (TARGET_NUCLEO_F746ZG)
+#define PAGE1_BASE_ADDRESS    ((uint32_t)(EEPROM_START_ADDRESS + 0x8000))
+#endif
+
 #define PAGE1_END_ADDRESS     ((uint32_t)(EEPROM_START_ADDRESS + (2 * PAGE_SIZE - 1)))
 #define PAGE1_ID               FLASH_SECTOR_3