diff options
Diffstat (limited to 'src/Linux/LinuxInterface.cpp')
-rw-r--r-- | src/Linux/LinuxInterface.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Linux/LinuxInterface.cpp b/src/Linux/LinuxInterface.cpp index fb11db57..cd9a2343 100644 --- a/src/Linux/LinuxInterface.cpp +++ b/src/Linux/LinuxInterface.cpp @@ -212,8 +212,12 @@ void LinuxInterface::Spin() // Write another chunk of the IAP binary to the designated Flash area case LinuxRequest::WriteIap: +#if IAP_IN_RAM + memcpy(reinterpret_cast<char *>(iapWritePointer), transfer->ReadData(packet->length), packet->length); + iapWritePointer += packet->length; + break; +#else { -#if !IAP_IN_RAM if (iapWritePointer == IAP_IMAGE_START) { // The EWP command is not supported for non-8KByte sectors in the SAM4 and SAME70 series. @@ -221,13 +225,7 @@ void LinuxInterface::Spin() flash_unlock(IAP_IMAGE_START, IAP_IMAGE_END, nullptr, nullptr); flash_erase_sector(IAP_IMAGE_START); } -#endif const char *dataToWrite = transfer->ReadData(packet->length); - -#if IAP_IN_RAM - memcpy(reinterpret_cast<char *>(iapWritePointer), dataToWrite, packet->length); - iapWritePointer += packet->length; -#else size_t bytesWritten = 0; do { @@ -264,9 +262,9 @@ void LinuxInterface::Spin() dataToWrite += bytesToWrite; iapWritePointer += bytesToWrite; } while (bytesWritten != packet->length); -#endif break; } +#endif // Launch the IAP binary case LinuxRequest::StartIap: |