File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 100100 #define OTA_STORAGE_SSU (0)
101101#endif
102102
103+ #if defined(ARDUINO_PORTENTA_H7_M7 )
104+ #define OTA_STORAGE_PORTENTA_QSPI (1)
105+ #define OTA_STORAGE_PORTENTA (1)
106+ #else
107+ #define OTA_STORAGE_PORTENTA_QSPI (0)
108+ #endif
109+
103110#if (OTA_STORAGE_SFU || OTA_STORAGE_SSU || OTA_STORAGE_SNU ) && !defined(ARDUINO_AVR_UNO_WIFI_REV2 )
104111 #define OTA_ENABLED (1)
105112#else
Original file line number Diff line number Diff line change @@ -475,6 +475,30 @@ void ArduinoIoTCloudTCP::onOTARequest()
475475 ota_download_success = true ;
476476#endif /* OTA_STORAGE_SNU */
477477
478+ #if OTA_STORAGE_PORTENTA_QSPI
479+ /* Just to be safe delete any remains from previous updates. */
480+ remove (" /fs/UPDATE.BIN.LZSS" );
481+
482+ OTAPortenta.begin (QSPI_FLASH_FATFS_MBR, 2048 );
483+
484+ if (OTAPortenta.download (_ota_url.c_str ()))
485+ {
486+ DBG_ERROR (F (" ArduinoIoTCloudTCP::%s error download to nina: %d" ), __FUNCTION__, nina_ota_err_code);
487+ _ota_error = static_cast <int >(OTAError::DownloadFailed);
488+ return ;
489+ }
490+
491+ auto update_file_size = OTAPortenta.decompress ();
492+ OTAPortenta.setUpdateLen (update_file_size);
493+
494+ /* The download was a success. */
495+ ota_download_success = true ;
496+
497+ while (1 ) {
498+ OTAPortenta.update ();
499+ }
500+ #endif /* OTA_STORAGE_PORTENTA_QSPI */
501+
478502#ifndef __AVR__
479503 /* Perform the reset to reboot to SxU. */
480504 if (ota_download_success)
You can’t perform that action at this time.
0 commit comments