Skip to content

Commit e9dc617

Browse files
authored
Merge pull request arduino#568 from facchinm/qspi_fix_double
SecureQSPIFBlockDevice: deinit after reading info
2 parents 0ef9d27 + 65b6929 commit e9dc617

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

variants/PORTENTA_H7_M7/variant.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,18 +254,20 @@ class SecureQSPIFBlockDevice: public QSPIFBlockDevice {
254254
static uint8_t *_boardInfo = (uint8_t*)(0x801F000);
255255
static bool has_otp_info = false;
256256

257+
static SecureQSPIFBlockDevice secure_root;
258+
257259
// 8Kbit secure OTP area (on MX25L12833F)
258260
bool getSecureFlashData() {
259-
static SecureQSPIFBlockDevice root;
260261
static PortentaBoardInfo* info = new PortentaBoardInfo();
261-
root.init();
262-
auto ret = root.readSecure(info, 0, sizeof(PortentaBoardInfo));
262+
secure_root.init();
263+
auto ret = secure_root.readSecure(info, 0, sizeof(PortentaBoardInfo));
263264
if (info->magic == OTP_QSPI_MAGIC) {
264265
_boardInfo = (uint8_t*)info;
265266
has_otp_info = true;
266267
} else {
267268
delete info;
268269
}
270+
secure_root.deinit();
269271
return ret == 0;
270272
}
271273

0 commit comments

Comments
 (0)