Skip to content

Commit b00e31f

Browse files
facchinmaentinger
authored andcommitted
Force check on Portenta BL version
1 parent 6cc464a commit b00e31f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/AIoTC_Config.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@
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

src/ArduinoIoTCloudTCP.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)