Skip to content

Commit 02f5ab6

Browse files
added stub implementation of OTA HAL classes
1 parent 3549e1b commit 02f5ab6

15 files changed

+156
-818
lines changed

src/ota/implementation/OTAEsp32.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#if defined(ARDUINO_ARCH_ESP32) && OTA_ENABLED
2+
3+
#endif // defined(ARDUINO_ARCH_ESP32) && OTA_ENABLED

src/ota/implementation/OTAEsp32.h

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
3+
#include "src/ota/interface/OTAInterface.h"
4+
5+
class ESP32OTACloudProcess: public OTACloudProcessInterface {
6+
public:
7+
STM32H7OTACloudProcess();
8+
protected:
9+
// we start the download and decompress process
10+
virtual State fetch(Message* msg=nullptr);
11+
12+
// when the download is completed we verify for integrity and correctness of the downloaded binary
13+
// virtual State verifyOTA(Message* msg=nullptr); // TODO this may be performed inside download
14+
15+
// whene the download is correctly finished we set the mcu to use the newly downloaded binary
16+
virtual State flashOTA(Message* msg=nullptr);
17+
18+
// we reboot the device
19+
virtual State reboot(Message* msg=nullptr);
20+
};
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#if defined(ARDUINO_NANO_RP2040_CONNECT) && OTA_ENABLED
2+
#include "OTANanoRP2040.h"
3+
4+
#endif // defined(ARDUINO_NANO_RP2040_CONNECT) && OTA_ENABLED
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
3+
#include "src/ota/interface/OTAInterface.h"
4+
5+
#include "FATFileSystem.h"
6+
#include "FlashIAPBlockDevice.h"
7+
8+
class NANO_RP2040OTACloudProcess: public OTACloudProcessInterface {
9+
public:
10+
STM32H7OTACloudProcess();
11+
protected:
12+
// we start the download and decompress process
13+
virtual State fetch(Message* msg=nullptr);
14+
15+
// when the download is completed we verify for integrity and correctness of the downloaded binary
16+
// virtual State verifyOTA(Message* msg=nullptr); // TODO this may be performed inside download
17+
18+
// whene the download is correctly finished we set the mcu to use the newly downloaded binary
19+
virtual State flashOTA(Message* msg=nullptr);
20+
21+
// we reboot the device
22+
virtual State reboot(Message* msg=nullptr);
23+
};

src/ota/implementation/OTASTM32H7.h

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
3+
#include "src/ota/interface/OTAInterface.h"
4+
5+
class STM32H7OTACloudProcess: public OTACloudProcessInterface {
6+
public:
7+
STM32H7OTACloudProcess();
8+
void update();
9+
10+
// retrocompatibility functions used in old ota prtotocol based on properties
11+
int otaRequest(char const * ota_url, NetworkAdapter iface);
12+
String getOTAImageSHA256();
13+
bool isOTACapable();
14+
protected:
15+
// we start the download and decompress process
16+
virtual State fetch(Message* msg=nullptr);
17+
18+
// whene the download is correctly finished we set the mcu to use the newly downloaded binary
19+
virtual State flashOTA(Message* msg=nullptr);
20+
21+
// we reboot the device
22+
virtual State reboot(Message* msg=nullptr);
23+
};

src/ota/implementation/OTASTM32H7.ipp

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#if defined(BOARD_STM32H7) && OTA_ENABLED
2+
#include "OTAPortentaH7.h"
3+
4+
STM32H7OTACloudProcess::STM32H7OTACloudProcess() {}
5+
6+
void STM32H7OTACloudProcess::update() {
7+
OTACloudProcessInterface::update();
8+
watchdog_reset();
9+
}
10+
11+
State STM32H7OTACloudProcess::fetch(Message *msg) {
12+
13+
}
14+
15+
State STM32H7OTACloudProcess::flashOTA(Message *msg) {
16+
/* Schedule the firmware update. */
17+
if((ota_portenta_err = ota_portenta_qspi.update()) != Arduino_Portenta_OTA::Error::None) {
18+
DEBUG_ERROR("Arduino_Portenta_OTA_QSPI::update() failed with %d", static_cast<int>(ota_portenta_err));
19+
return static_cast<int>(ota_portenta_err);
20+
}
21+
}
22+
23+
State STM32H7OTACloudProcess::reboot(Message *msg) {
24+
// TODO save information about the progress reached in the ota
25+
26+
// This command reboots the mcu
27+
NVIC_SystemReset();
28+
29+
return Resume; // This won't ever be reached
30+
}
31+
32+
#endif // defined(BOARD_STM32H7) && OTA_ENABLED

src/ota/implementation/OTASamd.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#if defined(ARDUINO_ARCH_SAMD) && OTA_ENABLED
2+
#include "OTASamd.h"
3+
4+
#endif // defined(ARDUINO_ARCH_SAMD) && OTA_ENABLED

src/ota/implementation/OTASamd.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#pragma once
2+
3+
#include "src/ota/interface/OTAInterface.h"
4+
#include <Arduino_DebugUtils.h>
5+
6+
class SAMDOTACloudProcess: public OTACloudProcessInterface {
7+
public:
8+
STM32H7OTACloudProcess();
9+
protected:
10+
// we start the download and decompress process
11+
virtual State fetch(Message* msg=nullptr);
12+
13+
// when the download is completed we verify for integrity and correctness of the downloaded binary
14+
// virtual State verifyOTA(Message* msg=nullptr); // TODO this may be performed inside download
15+
16+
// whene the download is correctly finished we set the mcu to use the newly downloaded binary
17+
virtual State flashOTA(Message* msg=nullptr);
18+
19+
// we reboot the device
20+
virtual State reboot(Message* msg=nullptr);
21+
};

src/ota/implementation/OTAUnoR4.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#if defined(ARDUINO_UNOR4_WIFI) && OTA_ENABLED
2+
#include "OTAUnoR4.h"
3+
4+
#endif // defined(ARDUINO_UNOR4_WIFI) && OTA_ENABLED

src/ota/implementation/OTAUnoR4.h

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
3+
#include "src/ota/interface/OTAInterface.h"
4+
#include "OTAUpdate.h"
5+
#include "r_flash_lp.h"
6+
7+
class UNOR4OTACloudProcess: public OTACloudProcessInterface {
8+
public:
9+
STM32H7OTACloudProcess();
10+
protected:
11+
// we start the download and decompress process
12+
virtual State fetch(Message* msg=nullptr);
13+
14+
// when the download is completed we verify for integrity and correctness of the downloaded binary
15+
// virtual State verifyOTA(Message* msg=nullptr); // TODO this may be performed inside download
16+
17+
// whene the download is correctly finished we set the mcu to use the newly downloaded binary
18+
virtual State flashOTA(Message* msg=nullptr);
19+
20+
// we reboot the device
21+
virtual State reboot(Message* msg=nullptr);
22+
};

src/utility/ota/OTAEsp32.cpp

-128
This file was deleted.

0 commit comments

Comments
 (0)