Skip to content

Commit 3b81436

Browse files
committed
Create platform specific systemReset functions and remove system reset from onOTARequest()
1 parent c7945c6 commit 3b81436

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

src/utility/ota/OTA-nano-rp2040.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,15 @@ int rp2040_connect_onOTARequest(char const * ota_url)
241241
return static_cast<int>(OTAError::RP2040_ErrorUnmount);
242242
}
243243

244+
return static_cast<int>(OTAError::None);
245+
}
246+
247+
void rp2040_connect_systemReset()
248+
{
244249
/* Perform the reset to reboot to SFU. */
245250
mbed_watchdog_trigger_reset();
246251
/* If watchdog is enabled we should not reach this point */
247252
NVIC_SystemReset();
248-
249-
return static_cast<int>(OTAError::None);
250253
}
251254

252255
#endif /* ARDUINO_NANO_RP2040_CONNECT */

src/utility/ota/OTA-portenta-h7.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ int portenta_h7_onOTARequest(char const * ota_url)
8282
DEBUG_ERROR("Arduino_Portenta_OTA_QSPI::update() failed with %d", static_cast<int>(ota_portenta_err));
8383
return static_cast<int>(ota_portenta_err);
8484
}
85+
}
8586

87+
void portenta_h7_systemReset()
88+
{
8689
/* Perform the reset to reboot - then the bootloader performs the actual application update. */
8790
NVIC_SystemReset();
8891
}

src/utility/ota/OTA-samd.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ int samd_onOTARequest(char const * ota_url)
5555
return static_cast<int>(OTAError::DownloadFailed);
5656
}
5757

58+
#endif /* OTA_STORAGE_SNU */
59+
}
60+
61+
void samd_systemReset()
62+
{
5863
/* Perform the reset to reboot to SxU. */
5964
NVIC_SystemReset();
60-
#endif /* OTA_STORAGE_SNU */
6165
}
6266

6367
#endif /* ARDUINO_ARCH_SAMD */

src/utility/ota/OTA.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,17 @@ enum class OTAError : int
5656

5757
#ifdef ARDUINO_ARCH_SAMD
5858
int samd_onOTARequest(char const * ota_url);
59+
void samd_systemReset();
5960
#endif
6061

6162
#ifdef ARDUINO_NANO_RP2040_CONNECT
6263
int rp2040_connect_onOTARequest(char const * ota_url);
64+
void rp2040_connect_systemReset();
6365
#endif
6466

6567
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
6668
int portenta_h7_onOTARequest(char const * ota_url);
69+
void portenta_h7_systemReset();
6770
#endif
6871

6972
#endif /* ARDUINO_OTA_LOGIC_H_ */

0 commit comments

Comments
 (0)