Skip to content

Commit 1e9b236

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 633ced2 commit 1e9b236

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
}
@@ -183,14 +183,14 @@ void eeprom_write_byte(uint32_t pos, uint8_t value)
183183
HAL_FLASHEx_DATAEEPROM_Lock();
184184
}
185185
}
186-
/* align content of the buffered eeprom */
187-
eeprom_buffer[pos] = (uint8_t)value;
188186
#else
189187
eeprom_buffered_write_byte(pos, value);
190188
eeprom_buffer_flush();
191189
#endif /* _EEPROM_BASE */
192190
}
193191

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

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

335+
#endif /* ! DATA_EEPROM_BASE */
336+
335337
#ifdef __cplusplus
336338
}
337339
#endif

0 commit comments

Comments
 (0)