Skip to content

Commit

Permalink
Fix some build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Jun 23, 2024
1 parent 3900c30 commit 06a07b5
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 133 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 7 additions & 0 deletions GenerateArduinoIDEFlagTxtFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ foreach(INCLUDE_DIR ${SCANNED_INCLUDE_DIRS})
# (so it starts with the first path component after mbed-os/)
cmake_path(RELATIVE_PATH INCLUDE_DIR BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os OUTPUT_VARIABLE REL_INCLUDE_DIR)

# There is a conflict between Mbed and Arduino both providing SPI.h
# Remove this specific include path so that you must #include <drivers/SPI.h> to get the Mbed version
# from the Arduino IDE.
if(REL_INCLUDE_DIR STREQUAL "drivers/./include/drivers")
continue()
endif()

string(APPEND INCLUDES_TXT_CONTENTS "-iwithprefixbefore/mbed/${REL_INCLUDE_DIR}\n")
endforeach()
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/includes.txt CONTENT ${INCLUDES_TXT_CONTENTS})
Expand Down
3 changes: 2 additions & 1 deletion libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ if("ARDUINO_NICLA_SENSE_ME" IN_LIST MBED_TARGET_LABELS)
endif()

if("STM32H747_ARDUINO" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(Portenta_SDRAM)
add_subdirectory(STM32H747_System)
endif()

if("ARDUINO_GIGA" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(MRI)
add_subdirectory(ea_malloc)
add_subdirectory(PDM)
add_subdirectory(WiFi)
add_subdirectory(Portenta_SDRAM)
endif()

# Libraries for all targets
Expand Down
14 changes: 11 additions & 3 deletions libraries/STM32H747_System/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
set(STM32H747_SYSTEM_SOURCES
src/STM32H747_System.cpp
src/wiced_filesystem.cpp)
src/STM32H747_System.cpp)

if(TARGET_ARDUINO_PORTENTA IN_LIST MBED_TARGET_LABELS)
list(APPEND STM32H747_SYSTEM_SOURCES
Expand All @@ -20,6 +19,15 @@ target_link_libraries(arduino-STM32H747_System PUBLIC
mbed-wifi)
target_include_directories(arduino-STM32H747_System PUBLIC src)

build_arduino_examples(STM32H747_System examples)
# STM32H747_manageBootloader does not support Arduino Giga
set(EXAMPLES_TO_SKIP "")
if("ARDUINO_GIGA" IN_LIST MBED_TARGET_LABELS)
list(APPEND EXAMPLES_TO_SKIP STM32H747_manageBootloader)
endif()

build_arduino_examples(STM32H747_System examples ${EXAMPLES_TO_SKIP})
if(TARGET STM32H747_System-example-STM32H747_manageBootloader)
target_link_libraries(STM32H747_System-example-STM32H747_manageBootloader mbed-storage-littlefs)
endif()

install(DIRECTORY . DESTINATION libraries/STM32H747_System)
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <Arduino.h>
#include <BlockDevice.h>

struct __attribute__((packed)) mbrEntry {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <Arduino.h>

uint8_t* bootloader_data = (uint8_t*)(0x801F000);
uint8_t* bootloader_identification = (uint8_t*)(0x80002F0);

Expand All @@ -15,6 +17,12 @@ OptaBoardInfo *info;
OptaBoardInfo* boardInfo();
#endif

// Forward declarations
void printBootloaderInfo();
String getUSBSpeed(uint8_t flag);
String getClockSource(uint8_t flag);
String getRAMSize(uint8_t flag);

void setup() {
Serial.begin(115200);
while (!Serial) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#include "STM32H747_System.h"

void setup() {
Serial.begin(115200);
while (!Serial) {}

reset_reason_t resetReason = STM32H747::getResetReason();
Serial.println(getString(resetReason));
}

String getString(reset_reason_t val) {
switch (val){
case RESET_REASON_POWER_ON:
Expand Down Expand Up @@ -39,6 +31,15 @@ String getString(reset_reason_t val) {
}
}

void setup() {
Serial.begin(115200);
while (!Serial) {}

reset_reason_t resetReason = STM32H747::getResetReason();
Serial.println(getString(resetReason));
}


void loop() {
delay(1000);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <Arduino.h>

#include "FlashIAP.h"
#include "QSPIFBlockDevice.h"
#include "MBRBlockDevice.h"
Expand Down Expand Up @@ -38,6 +40,14 @@ uint8_t* bootloader_data = (uint8_t*)(BOOTLOADER_ADDR + bootloader_data_offset);
const unsigned char* bootloader_ptr = &bootloader_bin[0];
long bootloader_len = bootloader_bin_len;

// Forward declarations
void printBootloaderInfo();
String getUSBSpeed(uint8_t flag);
String getClockSource(uint8_t flag);
String getRAMSize(uint8_t flag);
bool waitResponse();
void applyUpdate(uint32_t address);

uint8_t* boardInfo();

void setup() {
Expand Down

0 comments on commit 06a07b5

Please sign in to comment.