Skip to content

Commit d85772f

Browse files
committed
remove stm32L0x and stm32L1x EEPROM buffered functions
Removing the buffered access to EEPROM as it is not well-suited for stm32L0x and stm32L1x which have actual EEPROM area Signed-off-by: Francois Ramu <francois.ramu@st.com>
1 parent 9a5672f commit d85772f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cores/arduino/stm32/stm32_eeprom.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,12 @@ extern "C" {
107107
uint8_t eeprom_read_byte(const uint32_t pos);
108108
void eeprom_write_byte(uint32_t pos, uint8_t value);
109109

110+
#if !defined(DATA_EEPROM_BASE)
110111
void eeprom_buffer_fill();
111112
void eeprom_buffer_flush();
112113
uint8_t eeprom_buffered_read_byte(const uint32_t pos);
113114
void eeprom_buffered_write_byte(uint32_t pos, uint8_t value);
115+
#endif /* ! DATA_EEPROM_BASE */
114116

115117
#ifdef __cplusplus
116118
}

libraries/SrcWrapper/src/stm32/stm32_eeprom.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ static inline uint32_t get_flash_end(void)
142142
#endif
143143
#endif /* FLASH_BASE_ADDRESS */
144144

145+
#if !defined(DATA_EEPROM_BASE)
145146
static uint8_t eeprom_buffer[E2END + 1] __attribute__((aligned(8))) = {0};
147+
#endif
146148

147149
/**
148150
* @brief Function reads a byte from emulated eeprom (flash)
@@ -156,8 +158,6 @@ uint8_t eeprom_read_byte(const uint32_t pos)
156158
if (pos <= (DATA_EEPROM_END - DATA_EEPROM_BASE)) {
157159
/* with actual EEPROM, pos is a relative address */
158160
data = *(__IO uint8_t *)(DATA_EEPROM_BASE + pos);
159-
/* align content of the buffered eeprom */
160-
eeprom_buffer[pos] = (uint8_t)data;
161161
}
162162
return (uint8_t)data;
163163
#else
@@ -182,14 +182,14 @@ void eeprom_write_byte(uint32_t pos, uint8_t value)
182182
HAL_FLASHEx_DATAEEPROM_Lock();
183183
}
184184
}
185-
/* align content of the buffered eeprom */
186-
eeprom_buffer[pos] = (uint8_t)value;
187185
#else
188186
eeprom_buffered_write_byte(pos, value);
189187
eeprom_buffer_flush();
190188
#endif /* _EEPROM_BASE */
191189
}
192190

191+
#if !defined(DATA_EEPROM_BASE)
192+
193193
/**
194194
* @brief Function reads a byte from the eeprom buffer
195195
* @param pos : address to read
@@ -331,6 +331,8 @@ void eeprom_buffer_flush(void)
331331

332332
#endif /* defined(EEPROM_RETRAM_MODE) */
333333

334+
#endif /* ! DATA_EEPROM_BASE */
335+
334336
#ifdef __cplusplus
335337
}
336338
#endif

0 commit comments

Comments
 (0)