Merge branch 'ota_base_extract' into ota_base_extract_bk

This commit is contained in:
J. Nick Koston
2025-07-01 16:33:42 -05:00

View File

@@ -17,16 +17,8 @@ static const char *const TAG = "ota.arduino_rp2040";
std::unique_ptr<ota::OTABackend> make_ota_backend() { return make_unique<ota::ArduinoRP2040OTABackend>(); }
OTAResponseTypes ArduinoRP2040OTABackend::begin(size_t image_size) {
// Handle UPDATE_SIZE_UNKNOWN (0) by calculating available space
if (image_size == 0) {
// Similar to ESP8266, calculate available space from flash layout
extern "C" uint8_t _FS_start;
extern "C" uint8_t _FS_end;
// Calculate the size of the filesystem area which will be used for OTA
size_t fs_size = &_FS_end - &_FS_start;
// Reserve some space for filesystem overhead
image_size = (fs_size - 0x1000) & 0xFFFFF000;
}
// OTA size of 0 is not currently handled, but
// web_server is not supported for RP2040, so this is not an issue.
bool ret = Update.begin(image_size, U_FLASH);
if (ret) {
rp2040::preferences_prevent_write(true);