Skip to content

Commit f6e784a

Browse files
committed
OTA: STM32H7 add partition constexpr
1 parent 0012e26 commit f6e784a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ota/implementation/OTASTM32H7.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ OTACloudProcessInterface::State STM32H7OTACloudProcess::flashOTA() {
8585
// this sets the registries in RTC to load the firmware from the storage selected at the next reboot
8686
STM32H747::writeBackupRegister(RTCBackup::DR0, 0x07AA);
8787
STM32H747::writeBackupRegister(RTCBackup::DR1, STM32H747OTA::STORAGE_TYPE);
88-
STM32H747::writeBackupRegister(RTCBackup::DR2, data_offset);
88+
STM32H747::writeBackupRegister(RTCBackup::DR2, STM32H747OTA::PARTITION);
8989
STM32H747::writeBackupRegister(RTCBackup::DR3, _program_length);
9090

9191
return Reboot;
@@ -153,7 +153,7 @@ bool STM32H7OTACloudProcess::storageInit() {
153153
}
154154
}
155155

156-
_bd = new mbed::MBRBlockDevice(_bd_raw_qspi, data_offset);
156+
_bd = new mbed::MBRBlockDevice(_bd_raw_qspi, STM32H747OTA::PARTITION);
157157
_fs = new mbed::FATFileSystem("fs");
158158
err_mount = _fs->mount(_bd);
159159

src/ota/implementation/OTASTM32H7.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
namespace STM32H747OTA {
2525
/* External QSPI flash + MBR + FatFs */
2626
static const uint32_t constexpr STORAGE_TYPE = ((1 << 2) | (1 << 5) | (1 << 7));
27+
/* Default OTA partition */
28+
static const uint32_t constexpr PARTITION = 2;
2729
}
2830

2931
class STM32H7OTACloudProcess: public OTADefaultCloudProcessInterface {
@@ -67,7 +69,5 @@ class STM32H7OTACloudProcess: public OTADefaultCloudProcessInterface {
6769
mbed::BlockDevice* _bd;
6870
mbed::FATFileSystem* _fs;
6971

70-
const uint32_t data_offset=2;
71-
7272
static const char UPDATE_FILE_NAME[];
7373
};

0 commit comments

Comments
 (0)