Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern "C" {
#define EEPROM_ERASE (0xff)
#define SLOT_ADDRESS(sector, slot) (((uint8_t *)SECTOR_START(sector)) + slot * EEPROM_SIZE)

static uint8_t ram_eeprom[EEPROM_SIZE];
static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0};
static bool eeprom_dirty = false;
static int current_slot = 0;

Expand Down Expand Up @@ -92,15 +92,13 @@ bool PersistentStore::access_finish() {
if (--current_slot < 0) {
// all slots have been used, erase everything and start again
__disable_irq();
PrepareSector(EEPROM_SECTOR, EEPROM_SECTOR);
status = EraseSector(EEPROM_SECTOR, EEPROM_SECTOR);
__enable_irq();

current_slot = EEPROM_SLOTS - 1;
}

__disable_irq();
PrepareSector(EEPROM_SECTOR, EEPROM_SECTOR);
status = CopyRAM2Flash(SLOT_ADDRESS(EEPROM_SECTOR, current_slot), ram_eeprom, IAP_WRITE_4096);
__enable_irq();

Expand Down