mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[ion/external_flash] Take absolute address for WriteMemory
This commit is contained in:
@@ -471,6 +471,7 @@ void __attribute__((noinline)) WriteMemory(uint8_t * destination, const uint8_t
|
||||
if (Config::NumberOfSectors == 0) {
|
||||
return;
|
||||
}
|
||||
destination -= ExternalFlash::Config::StartAddress;
|
||||
unset_memory_mapped_mode();
|
||||
/* Each 256-byte page of the external flash memory (contained in a previously erased area)
|
||||
* may be programmed in burst mode with a single Page Program instruction.
|
||||
|
||||
@@ -371,7 +371,7 @@ void MassErase() {
|
||||
|
||||
void WriteMemory(uint8_t * destination, const uint8_t * source, size_t length) {
|
||||
asm("cpsid if");
|
||||
reinterpret_cast<void(*)(uint8_t*, const uint8_t*, size_t)>(Ion::Device::Trampoline::address(Ion::Device::Trampoline::ExternalFlashWriteMemory))(destination + ExternalFlash::Config::StartAddress, source, length);
|
||||
reinterpret_cast<void(*)(uint8_t*, const uint8_t*, size_t)>(Ion::Device::Trampoline::address(Ion::Device::Trampoline::ExternalFlashWriteMemory))(destination, source, length);
|
||||
asm("cpsie if");
|
||||
}
|
||||
|
||||
|
||||
@@ -471,6 +471,7 @@ void __attribute__((noinline)) WriteMemory(uint8_t * destination, const uint8_t
|
||||
if (Config::NumberOfSectors == 0) {
|
||||
return;
|
||||
}
|
||||
destination -= ExternalFlash::Config::StartAddress;
|
||||
unset_memory_mapped_mode();
|
||||
/* Each 256-byte page of the external flash memory (contained in a previously erased area)
|
||||
* may be programmed in burst mode with a single Page Program instruction.
|
||||
|
||||
@@ -46,7 +46,7 @@ void WriteMemory(uint8_t * destination, uint8_t * source, size_t length) {
|
||||
if (SectorAtAddress((uint32_t)destination) < InternalFlash::Config::NumberOfSectors) {
|
||||
InternalFlash::WriteMemory(destination, source, length);
|
||||
} else {
|
||||
ExternalFlash::WriteMemory(destination - ExternalFlash::Config::StartAddress, source, length);
|
||||
ExternalFlash::WriteMemory(destination, source, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user