- writebuffersize clarified (PR discussion)

- changed alignment from flashpagesize to 32bit
- added override modifier (PR discussion)
- changed comment regarding flash/eeprom functions for plattforms to override/implement (PR discussion)
This commit is contained in:
SirSydom 2022-02-21 11:18:24 +01:00
parent 4513e1de2a
commit 76654f3310
3 changed files with 8 additions and 6 deletions

View File

@ -92,7 +92,7 @@ void Memory::readMemory()
void Memory::writeMemory()
{
// first get the necessary size of the writeBuffer
size_t writeBufferSize = 16;
size_t writeBufferSize = _metadataSize;
for (int i = 0; i < _saveCount; i++)
writeBufferSize = MAX(writeBufferSize, _saveRestores[i]->saveSize());
@ -375,7 +375,7 @@ void Memory::addToFreeList(MemoryBlock* block)
uint16_t Memory::alignToPageSize(size_t size)
{
size_t pageSize = _platform.flashPageSize();
size_t pageSize = 4; //_platform.flashPageSize(); // align to 32bit for now, as aligning to flash-page-size causes side effects in programming
// pagesize should be a multiply of two
return (size + pageSize - 1) & (-1*pageSize);
}

View File

@ -57,11 +57,13 @@ class Platform
//Memory
// --- Legacy support only. Do not use for new plattforms ---
// --- can be remove if all plattforms have been changed to support the NonVolatileMemory functions
// --- Overwrite these methods in the device-plattform to use the EEPROM Emulation API for UserMemory ----
//
// --- changes to the UserMemory are written directly into the address space starting at getEepromBuffer
// --- commitToEeprom must save this to a non-volatile area if neccessary
virtual uint8_t* getEepromBuffer(uint16_t size);
virtual void commitToEeprom();
// -------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------
virtual uint8_t* getNonVolatileMemoryStart();
virtual size_t getNonVolatileMemorySize();

View File

@ -23,7 +23,7 @@ public:
void setupUart();
// unique serial number
uint32_t uniqueSerialNumber(); //override;
uint32_t uniqueSerialNumber() override;
void restart();