diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-02-16 11:25:28 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-02-16 11:25:28 +0300 |
commit | 22960e269c0a2a5c3b24bf300f9979d538d729a5 (patch) | |
tree | d1510393ad2957675baf1292be1291fa8d0bef55 /src/RepRap.cpp | |
parent | a23b70316e6f158aba38348ca6e56f0816231a20 (diff) |
Fixed builds with SBC interface following M997 changes
Diffstat (limited to 'src/RepRap.cpp')
-rw-r--r-- | src/RepRap.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/RepRap.cpp b/src/RepRap.cpp index 78139b61..2b27f7e7 100644 --- a/src/RepRap.cpp +++ b/src/RepRap.cpp @@ -2739,7 +2739,7 @@ void RepRap::UpdateFirmware(const StringRef& filenameRef) noexcept // Use RAM-based IAP iapFile->Read(reinterpret_cast<char *>(IAP_IMAGE_START), iapFile->Length()); iapFile->Close(); - StartIap(filenameRef); + StartIap(filenameRef.c_str()); #endif } @@ -2795,7 +2795,7 @@ void RepRap::PrepareToLoadIap() noexcept #endif } -void RepRap::StartIap(const StringRef& filenameRef) noexcept +void RepRap::StartIap(const char *filename) noexcept { // Disable all interrupts, then reallocate the vector table and program entry point to the new IAP binary // This does essentially what the Atmel AT02333 paper suggests (see 3.2.2 ff) @@ -2823,11 +2823,13 @@ void RepRap::StartIap(const StringRef& filenameRef) noexcept #endif #if HAS_MASS_STORAGE - // Newer versions of IAP reserve space above the stack for us to pass the firmware filename - String<MaxFilenameLength> firmwareFileLocation; - MassStorage::CombineName(firmwareFileLocation.GetRef(), FIRMWARE_DIRECTORY, filenameRef.IsEmpty() ? IAP_FIRMWARE_FILE : filenameRef.c_str()); - const uint32_t topOfStack = *reinterpret_cast<uint32_t *>(IAP_IMAGE_START); - if (topOfStack + firmwareFileLocation.strlen() + 1 <= + if (filename != nullptr) + { + // Newer versions of IAP reserve space above the stack for us to pass the firmware filename + String<MaxFilenameLength> firmwareFileLocation; + MassStorage::CombineName(firmwareFileLocation.GetRef(), FIRMWARE_DIRECTORY, filename[0] == 0 ? IAP_FIRMWARE_FILE : filename); + const uint32_t topOfStack = *reinterpret_cast<uint32_t *>(IAP_IMAGE_START); + if (topOfStack + firmwareFileLocation.strlen() + 1 <= # if SAME5x HSRAM_ADDR + HSRAM_SIZE # elif SAM3XA @@ -2835,9 +2837,10 @@ void RepRap::StartIap(const StringRef& filenameRef) noexcept # else IRAM_ADDR + IRAM_SIZE # endif - ) - { - strcpy(reinterpret_cast<char*>(topOfStack), firmwareFileLocation.c_str()); + ) + { + strcpy(reinterpret_cast<char*>(topOfStack), firmwareFileLocation.c_str()); + } } #endif |