Skip to content

Commit e52a319

Browse files
committed
Eliminating offset storage as a storage mechanism.
1 parent 4e4debf commit e52a319

File tree

4 files changed

+9
-50
lines changed

4 files changed

+9
-50
lines changed

src/Arduino_Portenta_OTA.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,12 @@
4848
******************************************************************************/
4949

5050
enum StorageTypePortenta {
51-
INTERNAL_FLASH_OFFSET = INTERNAL_FLASH_FLAG | RAW_FLAG,
5251
INTERNAL_FLASH_FATFS = INTERNAL_FLASH_FLAG | FATFS_FLAG,
5352
INTERNAL_FLASH_LITTLEFS = INTERNAL_FLASH_FLAG | LITTLEFS_FLAG,
54-
QSPI_FLASH_OFFSET = QSPI_FLASH_FLAG | RAW_FLAG,
5553
QSPI_FLASH_FATFS = QSPI_FLASH_FLAG | FATFS_FLAG,
5654
QSPI_FLASH_LITTLEFS = QSPI_FLASH_FLAG | LITTLEFS_FLAG,
5755
QSPI_FLASH_FATFS_MBR = QSPI_FLASH_FLAG | FATFS_FLAG | MBR_FLAG,
5856
QSPI_FLASH_LITTLEFS_MBR = QSPI_FLASH_FLAG | LITTLEFS_FLAG | MBR_FLAG,
59-
SD_OFFSET = SDCARD_FLAG | RAW_FLAG,
6057
SD_FATFS = SDCARD_FLAG | FATFS_FLAG,
6158
SD_LITTLEFS = SDCARD_FLAG | LITTLEFS_FLAG,
6259
SD_FATFS_MBR = SDCARD_FLAG | FATFS_FLAG | MBR_FLAG,

src/Arduino_Portenta_OTA_InternalFlash.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ Arduino_Portenta_OTA_InternalFlash::Arduino_Portenta_OTA_InternalFlash(StorageTy
4545
, _littlefs_fs_flash("little_fs")
4646
, _update_size_internal_flash{0}
4747
{
48-
assert(_storage_type == INTERNAL_FLASH_OFFSET ||
49-
_storage_type == INTERNAL_FLASH_FATFS ||
48+
assert(_storage_type == INTERNAL_FLASH_FATFS ||
5049
_storage_type == INTERNAL_FLASH_LITTLEFS);
5150
}
5251

@@ -70,9 +69,6 @@ bool Arduino_Portenta_OTA_InternalFlash::init()
7069
return true;
7170
}
7271

73-
if (_storage_type == INTERNAL_FLASH_OFFSET)
74-
return true;
75-
7672
if (_storage_type == INTERNAL_FLASH_LITTLEFS)
7773
{
7874
int const err = _littlefs_fs_flash.mount(&bd);
@@ -114,12 +110,6 @@ bool Arduino_Portenta_OTA_InternalFlash::open()
114110
return false;
115111
}
116112

117-
if (_storage_type == INTERNAL_FLASH_OFFSET)
118-
{
119-
_update_size_internal_flash = 2 * 1024 * 1024;
120-
return true;
121-
}
122-
123113
if (_storage_type == INTERNAL_FLASH_LITTLEFS)
124114
{
125115
if ((dir = opendir("/little_fs")) != NULL)

src/Arduino_Portenta_OTA_QSPI.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ Arduino_Portenta_OTA_QSPI::Arduino_Portenta_OTA_QSPI(StorageTypePortenta const s
4444
, _block_device_qspi(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000)
4545
, _update_size_qspi{0}
4646
{
47-
assert(_storage_type == QSPI_FLASH_OFFSET ||
48-
_storage_type == QSPI_FLASH_FATFS ||
47+
assert(_storage_type == QSPI_FLASH_FATFS ||
4948
_storage_type == QSPI_FLASH_LITTLEFS ||
5049
_storage_type == QSPI_FLASH_FATFS_MBR ||
5150
_storage_type == QSPI_FLASH_LITTLEFS_MBR);
@@ -57,8 +56,8 @@ Arduino_Portenta_OTA_QSPI::Arduino_Portenta_OTA_QSPI(StorageTypePortenta const s
5756

5857
bool Arduino_Portenta_OTA_QSPI::init()
5958
{
60-
if(_storage_type == QSPI_FLASH_OFFSET)
61-
return (_block_device_qspi.init() == QSPIF_BD_ERROR_OK);
59+
if (_block_device_qspi.init() != QSPIF_BD_ERROR_OK)
60+
return false;
6261

6362
if(_storage_type == QSPI_FLASH_FATFS)
6463
{
@@ -91,12 +90,6 @@ bool Arduino_Portenta_OTA_QSPI::init()
9190

9291
bool Arduino_Portenta_OTA_QSPI::open()
9392
{
94-
if (_storage_type == QSPI_FLASH_OFFSET)
95-
{
96-
_update_size_qspi = _program_length;
97-
return true;
98-
}
99-
10093
if(_storage_type == QSPI_FLASH_FATFS || _storage_type == QSPI_FLASH_FATFS_MBR)
10194
{
10295
DIR * dir = NULL;
@@ -125,8 +118,7 @@ bool Arduino_Portenta_OTA_QSPI::open()
125118

126119
bool Arduino_Portenta_OTA_QSPI::write()
127120
{
128-
if(_storage_type == QSPI_FLASH_OFFSET ||
129-
_storage_type == QSPI_FLASH_FATFS ||
121+
if(_storage_type == QSPI_FLASH_FATFS ||
130122
_storage_type == QSPI_FLASH_FATFS_MBR)
131123
{
132124
HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR0, 0x07AA);

src/Arduino_Portenta_OTA_SD.cpp

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ Arduino_Portenta_OTA_SD::Arduino_Portenta_OTA_SD(StorageTypePortenta const stora
5252
, _fs_sd{NULL}
5353
, _update_size_sd{0}
5454
{
55-
assert(_storage_type == SD_OFFSET ||
56-
_storage_type == SD_FATFS ||
55+
assert(_storage_type == SD_FATFS ||
5756
_storage_type == SD_LITTLEFS ||
5857
_storage_type == SD_FATFS_MBR ||
5958
_storage_type == SD_LITTLEFS_MBR);
@@ -65,17 +64,8 @@ Arduino_Portenta_OTA_SD::Arduino_Portenta_OTA_SD(StorageTypePortenta const stora
6564

6665
bool Arduino_Portenta_OTA_SD::init()
6766
{
68-
if (_storage_type == SD_OFFSET)
69-
{
70-
int const err = _block_device.init();
71-
if (err)
72-
{
73-
Serial1.print("Error while _block_device.init() : ");
74-
Serial1.println(err);
75-
return false;
76-
}
77-
return true;
78-
}
67+
if (_block_device.init())
68+
return false;
7969

8070
if(_storage_type == SD_FATFS)
8171
{
@@ -108,9 +98,6 @@ bool Arduino_Portenta_OTA_SD::init()
10898

10999
bool Arduino_Portenta_OTA_SD::open()
110100
{
111-
if (_storage_type == SD_OFFSET)
112-
return true;
113-
114101
if (_storage_type == SD_FATFS || _storage_type == SD_FATFS_MBR)
115102
{
116103
DIR * dir = NULL;
@@ -140,18 +127,11 @@ bool Arduino_Portenta_OTA_SD::open()
140127
bool Arduino_Portenta_OTA_SD::write()
141128
{
142129
if (_storage_type == SD_FATFS ||
143-
_storage_type == SD_OFFSET ||
144130
_storage_type == SD_FATFS_MBR)
145131
{
146132
HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR0, 0x07AA);
147133
HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR1, _storage_type);
148-
149-
if(_storage_type == SD_OFFSET || _storage_type == SD_FATFS_MBR)
150-
{
151-
HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR2, _data_offset);
152-
_update_size_sd = _program_length;
153-
}
154-
134+
HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR2, _data_offset);
155135
HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR3, _update_size_sd);
156136
return true;
157137
}

0 commit comments

Comments
 (0)