Skip to content

Commit 97156be

Browse files
facchinmpennam
authored andcommitted
PortentaH7: fix SecureQSPIFBlockDevice initialization
1 parent 0272fa7 commit 97156be

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

variants/PORTENTA_H7_M7/variant.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,15 @@ class SecureQSPIFBlockDevice: public QSPIFBlockDevice {
258258
static uint8_t *_boardInfo = (uint8_t*)(0x801F000);
259259
static bool has_otp_info = false;
260260

261-
static SecureQSPIFBlockDevice secure_root;
262-
263261
// 8Kbit secure OTP area (on MX25L12833F)
264262
bool getSecureFlashData() {
265-
static PortentaBoardInfo* info = new PortentaBoardInfo();
263+
static PortentaBoardInfo info;
264+
static SecureQSPIFBlockDevice secure_root;
266265
secure_root.init();
267-
auto ret = secure_root.readSecure(info, 0, sizeof(PortentaBoardInfo));
268-
if (info->magic == OTP_QSPI_MAGIC) {
269-
_boardInfo = (uint8_t*)info;
266+
auto ret = secure_root.readSecure(&info, 0, sizeof(PortentaBoardInfo));
267+
if (info.magic == OTP_QSPI_MAGIC) {
268+
_boardInfo = (uint8_t*)&info;
270269
has_otp_info = true;
271-
} else {
272-
delete info;
273270
}
274271
secure_root.deinit();
275272
return ret == 0;
@@ -411,4 +408,4 @@ void bootM4() {
411408
#endif
412409
}
413410

414-
#endif
411+
#endif

0 commit comments

Comments
 (0)