Skip to content

Commit ceeeab4

Browse files
committed
STM32H747_System: only use OTP info on supported boards
1 parent 6054064 commit ceeeab4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

libraries/STM32H747_System/examples/STM32H747_getBootloaderInfo/STM32H747_getBootloaderInfo.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
uint8_t* bootloader_data = (uint8_t*)(0x801F000);
22
uint8_t* bootloader_identification = (uint8_t*)(0x80002F0);
33

4+
#if __has_include("portenta_info.h")
45
#include "portenta_info.h"
6+
#define GET_OTP_BOARD_INFO
57
uint8_t* boardInfo();
8+
#endif
69

710
void setup() {
811
Serial.begin(115200);
@@ -27,6 +30,7 @@ void setup() {
2730
Serial.println("Has Video output: " + String(bootloader_data[8] == 1 ? "Yes" : "No"));
2831
Serial.println("Has Crypto chip: " + String(bootloader_data[9] == 1 ? "Yes" : "No"));
2932

33+
#ifdef GET_OTP_BOARD_INFO
3034
auto info = *((PortentaBoardInfo*)boardInfo());
3135
if (info.magic == 0xB5) {
3236
Serial.println("Secure info version: " + String(info.version));
@@ -38,6 +42,7 @@ void setup() {
3842
String(info.mac_address[2], HEX) + ":" + String(info.mac_address[3], HEX) + ":" +
3943
String(info.mac_address[4], HEX) + ":" + String(info.mac_address[5], HEX));
4044
}
45+
#endif
4146
}
4247

4348
String getUSBSpeed(uint8_t flag) {

libraries/STM32H747_System/examples/STM32H747_manageBootloader/STM32H747_manageBootloader.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "mcuboot_bootloader.h"
1212
#include "ecdsa-p256-encrypt-key.h"
1313
#include "ecdsa-p256-signing-key.h"
14+
#define GET_OTP_BOARD_INFO
1415
#elif defined(ARDUINO_NICLA_VISION)
1516
#include "nicla_vision_bootloader.h"
1617
#endif
@@ -68,6 +69,7 @@ void setup() {
6869
Serial.println("Has Video output: " + String(bootloader_data[8] == 1 ? "Yes" : "No"));
6970
Serial.println("Has Crypto chip: " + String(bootloader_data[9] == 1 ? "Yes" : "No"));
7071

72+
#ifdef GET_OTP_BOARD_INFO
7173
auto info = *((PortentaBoardInfo*)boardInfo());
7274
if (info.magic == 0xB5) {
7375
Serial.println("Secure info version: " + String(info.version));
@@ -79,6 +81,7 @@ void setup() {
7981
String(info.mac_address[2], HEX) + ":" + String(info.mac_address[3], HEX) + ":" +
8082
String(info.mac_address[4], HEX) + ":" + String(info.mac_address[5], HEX));
8183
}
84+
#endif
8285

8386
video_available = bootloader_data[8];
8487
wifi_available = bootloader_data[5];

0 commit comments

Comments
 (0)