Skip to content

Commit

Permalink
remove stm32L0x and stm32L1x EEPROM buffered functions
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
FRASTM committed Aug 24, 2020
1 parent 9a5672f commit d85772f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cores/arduino/stm32/stm32_eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ extern "C" {
uint8_t eeprom_read_byte(const uint32_t pos);
void eeprom_write_byte(uint32_t pos, uint8_t value);

#if !defined(DATA_EEPROM_BASE)
void eeprom_buffer_fill();
void eeprom_buffer_flush();
uint8_t eeprom_buffered_read_byte(const uint32_t pos);
void eeprom_buffered_write_byte(uint32_t pos, uint8_t value);
#endif /* ! DATA_EEPROM_BASE */

#ifdef __cplusplus
}
Expand Down
10 changes: 6 additions & 4 deletions libraries/SrcWrapper/src/stm32/stm32_eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ static inline uint32_t get_flash_end(void)
#endif
#endif /* FLASH_BASE_ADDRESS */

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

/**
* @brief Function reads a byte from emulated eeprom (flash)
Expand All @@ -156,8 +158,6 @@ uint8_t eeprom_read_byte(const uint32_t pos)
if (pos <= (DATA_EEPROM_END - DATA_EEPROM_BASE)) {
/* with actual EEPROM, pos is a relative address */
data = *(__IO uint8_t *)(DATA_EEPROM_BASE + pos);
/* align content of the buffered eeprom */
eeprom_buffer[pos] = (uint8_t)data;
}
return (uint8_t)data;
#else
Expand All @@ -182,14 +182,14 @@ void eeprom_write_byte(uint32_t pos, uint8_t value)
HAL_FLASHEx_DATAEEPROM_Lock();
}
}
/* align content of the buffered eeprom */
eeprom_buffer[pos] = (uint8_t)value;
#else
eeprom_buffered_write_byte(pos, value);
eeprom_buffer_flush();
#endif /* _EEPROM_BASE */
}

#if !defined(DATA_EEPROM_BASE)

/**
* @brief Function reads a byte from the eeprom buffer
* @param pos : address to read
Expand Down Expand Up @@ -331,6 +331,8 @@ void eeprom_buffer_flush(void)

#endif /* defined(EEPROM_RETRAM_MODE) */

#endif /* ! DATA_EEPROM_BASE */

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit d85772f

Please sign in to comment.