Skip to content

Commit 2e7aa0d

Browse files
committed
'isOtaCapable' interrogates the bootloader to determine whether or not the bootloader version is sufficient to perform OTA.
1 parent ebe44b2 commit 2e7aa0d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Arduino_Portenta_OTA.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ Arduino_Portenta_OTA::~Arduino_Portenta_OTA()
5050
* PUBLIC MEMBER FUNCTIONS
5151
******************************************************************************/
5252

53+
bool Arduino_Portenta_OTA::isOtaCapable()
54+
{
55+
#define BOOTLOADER_ADDR (0x8000000)
56+
uint32_t bootloader_data_offset = 0x1F000;
57+
uint8_t* bootloader_data = (uint8_t*)(BOOTLOADER_ADDR + bootloader_data_offset);
58+
uint8_t currentBootloaderVersion = bootloader_data[1];
59+
if (currentBootloaderVersion < 22)
60+
return false;
61+
else
62+
return true;
63+
}
64+
5365
Arduino_Portenta_OTA::Error Arduino_Portenta_OTA::begin()
5466
{
5567
Serial1.begin(115200);

src/Arduino_Portenta_OTA.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class Arduino_Portenta_OTA
7979
virtual ~Arduino_Portenta_OTA();
8080

8181

82+
bool isOtaCapable();
8283
Error begin();
8384
Error update();
8485
void reset();

0 commit comments

Comments
 (0)