From 43a4358c94aee3e3a3e8be158641570473dab1dc Mon Sep 17 00:00:00 2001 From: Foniks Date: Thu, 22 Jan 2026 13:51:43 +0100 Subject: [PATCH 1/8] feat(MPU): Remove MPUManager from Runes and add tests for MPU --- Core/Src/Examples/ExampleMPU.cpp | 377 +++++++++++++++++++++++++++++++ Core/Src/Runes/Runes.cpp | 6 - Core/Src/main.cpp | 10 + 3 files changed, 387 insertions(+), 6 deletions(-) create mode 100644 Core/Src/Examples/ExampleMPU.cpp diff --git a/Core/Src/Examples/ExampleMPU.cpp b/Core/Src/Examples/ExampleMPU.cpp new file mode 100644 index 00000000..fdeb7a62 --- /dev/null +++ b/Core/Src/Examples/ExampleMPU.cpp @@ -0,0 +1,377 @@ +#ifdef EXAMPLE_MPU + +#include "main.h" +#include "ST-LIB.hpp" + + +#ifdef TEST_0 +// No Buffers requested +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board<>; + myBoard::init(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_1 +// Basic test with a buffer in D2 +constexpr auto my_uint32_t = MPUDomain::Buffer(); + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_2 +// Basic test with a buffer in D1 +constexpr auto my_uint32_t = MPUDomain::Buffer(MPUDomain::MemoryType::NonCached, MPUDomain::MemoryDomain::D1); + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + + [[maybe_unused]] auto my_buffer = MPUDomain::as(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_3 +// Basic test with a buffer in D3 +constexpr auto my_buff = MPUDomain::Buffer(MPUDomain::MemoryType::NonCached, MPUDomain::MemoryDomain::D3); + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_4 +// Fail test (too much memory requested) +constexpr auto my_buff = MPUDomain::Buffer(MPUDomain::MemoryType::NonCached, MPUDomain::MemoryDomain::D3); + +int main(void) { + using myBoard = ST_LIB::Board; + myBoard::init(); + + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + + STLIB::start(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_5 +// Cannot request any type of buffer other than the one defined +constexpr auto my_buff = MPUDomain::Buffer(); + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_6 +// Ask for non-cached and cached memory on the same domain +constexpr auto my_buff = MPUDomain::Buffer(); +constexpr auto my_buff2 = MPUDomain::Buffer(MPUDomain::MemoryType::Cached); + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + [[maybe_unused]] auto my_buffer2 = myBoard::instance_of().template as(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_7 +// Ask for different alignment buffers +constexpr auto my_buff = MPUDomain::Buffer(); +constexpr auto my_buff2 = MPUDomain::Buffer(); + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + [[maybe_unused]] auto my_buffer2 = myBoard::instance_of().template as(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_8 +// Request a non-POD type fails +constexpr auto my_buff = MPUDomain::Buffer>(); + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_9 +// Request too many buffers fails (you can overwrite this value with a define) +constexpr auto my_buff = MPUDomain::Buffer(); constexpr auto my_buff2 = MPUDomain::Buffer(); constexpr auto my_buff3 = MPUDomain::Buffer(); constexpr auto my_buff4 = MPUDomain::Buffer(); constexpr auto my_buff5 = MPUDomain::Buffer(); +constexpr auto my_buff6 = MPUDomain::Buffer(); constexpr auto my_buff7 = MPUDomain::Buffer(); constexpr auto my_buff8 = MPUDomain::Buffer(); constexpr auto my_buff9 = MPUDomain::Buffer(); constexpr auto my_buff10 = MPUDomain::Buffer(); +constexpr auto my_buff11 = MPUDomain::Buffer(); constexpr auto my_buff12 = MPUDomain::Buffer(); constexpr auto my_buff13 = MPUDomain::Buffer(); constexpr auto my_buff14 = MPUDomain::Buffer(); constexpr auto my_buff15 = MPUDomain::Buffer(); +constexpr auto my_buff16 = MPUDomain::Buffer(); constexpr auto my_buff17 = MPUDomain::Buffer(); constexpr auto my_buff18 = MPUDomain::Buffer(); constexpr auto my_buff19 = MPUDomain::Buffer(); constexpr auto my_buff20 = MPUDomain::Buffer(); +constexpr auto my_buff21 = MPUDomain::Buffer(); constexpr auto my_buff22 = MPUDomain::Buffer(); constexpr auto my_buff23 = MPUDomain::Buffer(); constexpr auto my_buff24 = MPUDomain::Buffer(); constexpr auto my_buff25 = MPUDomain::Buffer(); +constexpr auto my_buff26 = MPUDomain::Buffer(); constexpr auto my_buff27 = MPUDomain::Buffer(); constexpr auto my_buff28 = MPUDomain::Buffer(); constexpr auto my_buff29 = MPUDomain::Buffer(); constexpr auto my_buff30 = MPUDomain::Buffer(); +constexpr auto my_buff31 = MPUDomain::Buffer(); constexpr auto my_buff32 = MPUDomain::Buffer(); constexpr auto my_buff33 = MPUDomain::Buffer(); constexpr auto my_buff34 = MPUDomain::Buffer(); constexpr auto my_buff35 = MPUDomain::Buffer(); +constexpr auto my_buff36 = MPUDomain::Buffer(); constexpr auto my_buff37 = MPUDomain::Buffer(); constexpr auto my_buff38 = MPUDomain::Buffer(); constexpr auto my_buff39 = MPUDomain::Buffer(); constexpr auto my_buff40 = MPUDomain::Buffer(); +constexpr auto my_buff41 = MPUDomain::Buffer(); constexpr auto my_buff42 = MPUDomain::Buffer(); constexpr auto my_buff43 = MPUDomain::Buffer(); constexpr auto my_buff44 = MPUDomain::Buffer(); constexpr auto my_buff45 = MPUDomain::Buffer(); +constexpr auto my_buff46 = MPUDomain::Buffer(); constexpr auto my_buff47 = MPUDomain::Buffer(); constexpr auto my_buff48 = MPUDomain::Buffer(); constexpr auto my_buff49 = MPUDomain::Buffer(); constexpr auto my_buff50 = MPUDomain::Buffer(); +constexpr auto my_buff51 = MPUDomain::Buffer(); constexpr auto my_buff52 = MPUDomain::Buffer(); constexpr auto my_buff53 = MPUDomain::Buffer(); constexpr auto my_buff54 = MPUDomain::Buffer(); constexpr auto my_buff55 = MPUDomain::Buffer(); +constexpr auto my_buff56 = MPUDomain::Buffer(); constexpr auto my_buff57 = MPUDomain::Buffer(); constexpr auto my_buff58 = MPUDomain::Buffer(); constexpr auto my_buff59 = MPUDomain::Buffer(); constexpr auto my_buff60 = MPUDomain::Buffer(); +constexpr auto my_buff61 = MPUDomain::Buffer(); constexpr auto my_buff62 = MPUDomain::Buffer(); constexpr auto my_buff63 = MPUDomain::Buffer(); constexpr auto my_buff64 = MPUDomain::Buffer(); constexpr auto my_buff65 = MPUDomain::Buffer(); +constexpr auto my_buff66 = MPUDomain::Buffer(); constexpr auto my_buff67 = MPUDomain::Buffer(); constexpr auto my_buff68 = MPUDomain::Buffer(); constexpr auto my_buff69 = MPUDomain::Buffer(); constexpr auto my_buff70 = MPUDomain::Buffer(); +constexpr auto my_buff71 = MPUDomain::Buffer(); constexpr auto my_buff72 = MPUDomain::Buffer(); constexpr auto my_buff73 = MPUDomain::Buffer(); constexpr auto my_buff74 = MPUDomain::Buffer(); constexpr auto my_buff75 = MPUDomain::Buffer(); +constexpr auto my_buff76 = MPUDomain::Buffer(); constexpr auto my_buff77 = MPUDomain::Buffer(); constexpr auto my_buff78 = MPUDomain::Buffer(); constexpr auto my_buff79 = MPUDomain::Buffer(); constexpr auto my_buff80 = MPUDomain::Buffer(); +constexpr auto my_buff81 = MPUDomain::Buffer(); constexpr auto my_buff82 = MPUDomain::Buffer(); constexpr auto my_buff83 = MPUDomain::Buffer(); constexpr auto my_buff84 = MPUDomain::Buffer(); constexpr auto my_buff85 = MPUDomain::Buffer(); +constexpr auto my_buff86 = MPUDomain::Buffer(); constexpr auto my_buff87 = MPUDomain::Buffer(); constexpr auto my_buff88 = MPUDomain::Buffer(); constexpr auto my_buff89 = MPUDomain::Buffer(); constexpr auto my_buff90 = MPUDomain::Buffer(); +constexpr auto my_buff91 = MPUDomain::Buffer(); constexpr auto my_buff92 = MPUDomain::Buffer(); constexpr auto my_buff93 = MPUDomain::Buffer(); constexpr auto my_buff94 = MPUDomain::Buffer(); constexpr auto my_buff95 = MPUDomain::Buffer(); +constexpr auto my_buff96 = MPUDomain::Buffer(); constexpr auto my_buff97 = MPUDomain::Buffer(); constexpr auto my_buff98 = MPUDomain::Buffer(); constexpr auto my_buff99 = MPUDomain::Buffer(); constexpr auto my_buff100 = MPUDomain::Buffer(); +constexpr auto my_buff101 = MPUDomain::Buffer(); +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_10 +// Request a struct type (also works with objects and such, as long as they are POD) +struct MyStruct { + uint8_t a; + float b; + char c[10]; +}; +constexpr auto my_buff = MPUDomain::Buffer(); + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_11 +// Mix types of different alignments and sizes (stress test) +constexpr auto my_buff = MPUDomain::Buffer(); +constexpr auto my_buff2 = MPUDomain::Buffer(); +constexpr auto my_buff3 = MPUDomain::Buffer(); +constexpr auto my_buff4 = MPUDomain::Buffer(); +constexpr auto my_buff5 = MPUDomain::Buffer(MPUDomain::MemoryType::Cached); +constexpr auto my_buff6 = MPUDomain::Buffer(MPUDomain::MemoryType::Cached); +constexpr auto my_buff7 = MPUDomain::Buffer(MPUDomain::MemoryType::Cached); +constexpr auto my_buff8 = MPUDomain::Buffer(MPUDomain::MemoryType::Cached, MPUDomain::MemoryDomain::D1, true); +D1_NC uint32_t my_global_var; +D2_C uint32_t my_global_var2; +D3_NC uint32_t my_global_var3; +D3_NC uint8_t my_global_array[50]; + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template as(); + [[maybe_unused]] auto my_buffer2 = myBoard::instance_of().template as(); + [[maybe_unused]] auto my_buffer3 = myBoard::instance_of().template as(); + [[maybe_unused]] auto my_buffer4 = myBoard::instance_of().template as(); + [[maybe_unused]] auto my_buffer5 = myBoard::instance_of().template as(); + [[maybe_unused]] auto my_buffer6 = myBoard::instance_of().template as(); + [[maybe_unused]] auto my_buffer7 = myBoard::instance_of().template as(); + [[maybe_unused]] auto my_buffer8 = myBoard::instance_of().template as(); + [[maybe_unused]] auto* global_var1 = &my_global_var; + [[maybe_unused]] auto* global_var2 = &my_global_var2; + [[maybe_unused]] auto* global_var3 = &my_global_var3; + [[maybe_unused]] auto* global_array = &my_global_array; + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_12 +// Dereference a pointer to a non-accessible memory region (should compile fine, runtime error) +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board<>; + myBoard::init(); + + volatile uint32_t* invalid_ptr = reinterpret_cast(0x80000000); // Address outside of MPU regions + + [[maybe_unused]] uint32_t value = *invalid_ptr; // Dereference + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_13 +// Try construct method +struct MyStruct { + uint8_t a; + float b; + char c[10]; + MyStruct(uint8_t aa, float bb) : a(aa), b(bb) { for (int i = 0; i < 10; ++i) c[i] = 'A' + i; } +}; +constexpr auto my_buff = MPUDomain::Buffer(); + +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board; + myBoard::init(); + [[maybe_unused]] auto my_buffer = myBoard::instance_of().template construct(42, 3.14f); + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_14 +// Test legacy MPUManager compatibility +D3_NC uint8_t my_legacy_buffer[256]; +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board<>; + myBoard::init(); + + [[maybe_unused]] auto my_buff = MPUManager::allocate_non_cached_memory(256); + [[maybe_unused]] auto legacy_buffer_ptr = my_legacy_buffer; + + while (1) { + STLIB::update(); + } +} +#endif + +#ifdef TEST_15 +// Dereference a nullptr for read/write (should compile fine, runtime error) +int main(void) { + STLIB::start(); + + using myBoard = ST_LIB::Board<>; + myBoard::init(); + volatile uint32_t* invalid_ptr = nullptr; // Null pointer + + [[maybe_unused]] uint32_t value = *invalid_ptr; // Dereference + + while (1) { + STLIB::update(); + } +} +#endif + +void Error_Handler(void) { + ErrorHandler("HAL error handler triggered"); + while (1) { + } +} + +extern "C" { +void assert_failed(uint8_t *file, uint32_t line) { + while (1) { + } +} +} + +#endif \ No newline at end of file diff --git a/Core/Src/Runes/Runes.cpp b/Core/Src/Runes/Runes.cpp index 511a2cba..16a735b0 100644 --- a/Core/Src/Runes/Runes.cpp +++ b/Core/Src/Runes/Runes.cpp @@ -37,12 +37,6 @@ SPI_HandleTypeDef hspi3; FDCAN_HandleTypeDef hfdcan1; FMAC_HandleTypeDef hfmac; -/************************************************ - * MPU - ***********************************************/ - -MPUManager::config MPUManager::MPUConfig = {}; - /************************************************ * Communication-FDCAN ***********************************************/ diff --git a/Core/Src/main.cpp b/Core/Src/main.cpp index e52a3e17..db7c62af 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -1,3 +1,11 @@ +#define EXAMPLE_BASE +#define TEST_0 // Test to be run + +// Include all examples, run the one defined above +#include "Examples/ExampleBase.hpp" + +#ifdef EXAMPLE_BASE + #include "main.h" #include "ST-LIB.hpp" @@ -22,3 +30,5 @@ void Error_Handler(void) { while (1) { } } + +#endif From a1e0373f758383e693662047fac730ca182a4219 Mon Sep 17 00:00:00 2001 From: Foniks Date: Thu, 22 Jan 2026 13:56:42 +0100 Subject: [PATCH 2/8] fix(MPU): Bad include --- Core/Src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Src/main.cpp b/Core/Src/main.cpp index db7c62af..4e83b7e5 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -2,7 +2,7 @@ #define TEST_0 // Test to be run // Include all examples, run the one defined above -#include "Examples/ExampleBase.hpp" +#include "Examples/ExampleMPU.hpp" #ifdef EXAMPLE_BASE From 7682edef4368f2c9058547f7a2add916c42fecf9 Mon Sep 17 00:00:00 2001 From: Foniks Date: Thu, 22 Jan 2026 14:01:27 +0100 Subject: [PATCH 3/8] fix(MPU): Bad include --- Core/Src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Src/main.cpp b/Core/Src/main.cpp index 4e83b7e5..e20dab78 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -2,7 +2,7 @@ #define TEST_0 // Test to be run // Include all examples, run the one defined above -#include "Examples/ExampleMPU.hpp" +#include "Examples/ExampleMPU.cpp" #ifdef EXAMPLE_BASE From 10cfa710902699bb9f2f1cbfdc6e129b06e0f2c4 Mon Sep 17 00:00:00 2001 From: Foniks Date: Thu, 22 Jan 2026 14:06:18 +0100 Subject: [PATCH 4/8] feat(MPU): Update ST-LIB to latest version --- deps/ST-LIB | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/ST-LIB b/deps/ST-LIB index f486b94f..bd05e1b0 160000 --- a/deps/ST-LIB +++ b/deps/ST-LIB @@ -1 +1 @@ -Subproject commit f486b94f18b331c3c91d6bae74dac7decbb2d0ff +Subproject commit bd05e1b07c1d2376486a757633137a0d7f3f4f1e From 2f3b68662f276f8cfdca7f4e80abb751d9b5255f Mon Sep 17 00:00:00 2001 From: Foniks Date: Thu, 22 Jan 2026 16:22:51 +0100 Subject: [PATCH 5/8] feat(MPU): Delete obsolete linker scripts --- STM32H723ZGTX_FLASH.ld | 209 ----------------------------------------- STM32H723ZGTX_RAM.ld | 173 ---------------------------------- 2 files changed, 382 deletions(-) delete mode 100644 STM32H723ZGTX_FLASH.ld delete mode 100644 STM32H723ZGTX_RAM.ld diff --git a/STM32H723ZGTX_FLASH.ld b/STM32H723ZGTX_FLASH.ld deleted file mode 100644 index 12b8d779..00000000 --- a/STM32H723ZGTX_FLASH.ld +++ /dev/null @@ -1,209 +0,0 @@ -/* -****************************************************************************** -** -** File : LinkerScript.ld -** -** Author : STM32CubeIDE -** -** Abstract : Linker script for STM32H7 series -** 1024Kbytes FLASH and 560Kbytes RAM -** -** Set heap size, stack size and stack location according -** to application requirements. -** -** Set memory bank area and size if external memory is used. -** -** Target : STMicroelectronics STM32 -** -** Distribution: The file is distributed as is, without any warranty -** of any kind. -** -***************************************************************************** -** @attention -** -** Copyright (c) 2022 STMicroelectronics. -** All rights reserved. -** -** This software is licensed under terms that can be found in the LICENSE file -** in the root directory of this software component. -** If no LICENSE file comes with this software, it is provided AS-IS. -** -**************************************************************************** -*/ - -/* Entry Point */ -ENTRY(Reset_Handler) - -/* Highest address of the user mode stack */ -_estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of RAM */ -/* Generate a link error if heap and stack don't fit into RAM */ -_Min_Heap_Size = 0x200; /* required amount of heap */ -_Min_Stack_Size = 0x400; /* required amount of stack */ - -/* Specify the memory areas */ -MEMORY -{ - ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K - DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K - FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K-128K - RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K - RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K - RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K -} - -/* Define output sections */ -SECTIONS -{ - /* The startup code goes first into FLASH */ - .isr_vector : - { - . = ALIGN(4); - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(4); - } >FLASH - - /* The program code and other data goes into FLASH */ - .text : - { - . = ALIGN(4); - *(.text) /* .text sections (code) */ - *(.text*) /* .text* sections (code) */ - *(.glue_7) /* glue arm to thumb code */ - *(.glue_7t) /* glue thumb to arm code */ - *(.eh_frame) - - KEEP (*(.init)) - KEEP (*(.fini)) - - . = ALIGN(4); - _etext = .; /* define a global symbols at end of code */ - } >FLASH - - /* Constant data goes into FLASH */ - .rodata : - { - . = ALIGN(4); - *(.rodata) /* .rodata sections (constants, strings, etc.) */ - *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ - . = ALIGN(4); - } >FLASH - - .ARM.extab (READONLY): { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH - .ARM (READONLY): { - __exidx_start = .; - *(.ARM.exidx*) - __exidx_end = .; - } >FLASH - - .preinit_array (READONLY): - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array*)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } >FLASH - - .init_array (READONLY): - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - } >FLASH - - .fini_array (READONLY): - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array*)) - PROVIDE_HIDDEN (__fini_array_end = .); - } >FLASH - - /* used by the startup to initialize data */ - _sidata = LOADADDR(.data); - - /* Initialized data sections goes into RAM, load LMA copy after code */ - .data : - { - . = ALIGN(4); - _sdata = .; /* create a global symbol at data start */ - *(.data) /* .data sections */ - *(.data*) /* .data* sections */ - *(.RamFunc) /* .RamFunc sections */ - *(.RamFunc*) /* .RamFunc* sections */ - - . = ALIGN(4); - _edata = .; /* define a global symbol at data end */ - } >RAM_D1 AT> FLASH - /* - this needs to be the last thing in FLASH - because the preceeding sections are appended after the one preceeding them - this is, if this were the first thing in FLASH - the sections below it would try to be placed afterwards - thus overflowing the FLASH - */ - .metadata_pool : - { - . = ABSOLUTE(0x080DFD00); - . = ALIGN(4); - metadata = .; - KEEP(*(.metadata_pool)) - . += 0x100; - } >FLASH - /* Uninitialized data section */ - . = ALIGN(4); - .bss (NOLOAD) : - { - /* This is used by the startup in order to initialize the .bss section */ - _sbss = .; /* define a global symbol at bss start */ - __bss_start__ = _sbss; - *(.bss) - *(.bss*) - *(COMMON) - - /* ETH_CODE: add placement of RX buffer. STM32H72x/H73x has small D2 RAM, so we need to put it there. - * (NOLOAD) attribute used for .bss section to avoid linker warning (.bss initialized by startup code) - */ - . = ALIGN(32); - *(.Rx_PoolSection) - . = ALIGN(4); - _ebss = .; /* define a global symbol at bss end */ - __bss_end__ = _ebss; - } >RAM_D1 - - /* User_heap_stack section, used to check that there is enough RAM left */ - ._user_heap_stack : - { - . = ALIGN(8); - PROVIDE ( end = . ); - PROVIDE ( _end = . ); - . = . + _Min_Heap_Size; - . = . + _Min_Stack_Size; - . = ALIGN(8); - } >RAM_D1 - - /* ETH_CODE: add placement of DMA descriptors, rest is used by RX_POOL */ - .lwip_sec (NOLOAD) : - { - . = ABSOLUTE(0x30000000); - *(.RxDecripSection) - - . = ABSOLUTE(0x30000100); - *(.TxDecripSection) - - } >RAM_D2 - .stlib_no_cache_ram_pool : - { - . = ABSOLUTE(0x38000000); - _no_cached_ram_start = .; - - } >RAM_D3 - /* Remove information from the standard libraries */ - /DISCARD/ : - { - libc.a ( * ) - libm.a ( * ) - libgcc.a ( * ) - } - - .ARM.attributes 0 : { *(.ARM.attributes) } -} diff --git a/STM32H723ZGTX_RAM.ld b/STM32H723ZGTX_RAM.ld deleted file mode 100644 index 4d2e09c4..00000000 --- a/STM32H723ZGTX_RAM.ld +++ /dev/null @@ -1,173 +0,0 @@ -/* -****************************************************************************** -** -** File : LinkerScript.ld (debug in RAM dedicated) -** -** Author : STM32CubeIDE -** -** Abstract : Linker script for STM32H7 series -** 320Kbytes RAM_EXEC and 240Kbytes RAM -** -** Set heap size, stack size and stack location according -** to application requirements. -** -** Set memory bank area and size if external memory is used. -** -** Target : STMicroelectronics STM32 -** -** Distribution: The file is distributed as is, without any warranty -** of any kind. -** -***************************************************************************** -** @attention -** -** Copyright (c) 2022 STMicroelectronics. -** All rights reserved. -** -** This software is licensed under terms that can be found in the LICENSE file -** in the root directory of this software component. -** If no LICENSE file comes with this software, it is provided AS-IS. -** -**************************************************************************** -*/ - -/* Entry Point */ -ENTRY(Reset_Handler) - -/* Highest address of the user mode stack */ -_estack = ORIGIN(DTCMRAM) + LENGTH(DTCMRAM); /* end of RAM */ -/* Generate a link error if heap and stack don't fit into RAM */ -_Min_Heap_Size = 0x200 ; /* required amount of heap */ -_Min_Stack_Size = 0x400 ; /* required amount of stack */ - -/* Specify the memory areas */ -MEMORY -{ - RAM_EXEC (xrw) : ORIGIN = 0x24000000, LENGTH = 320K - DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K - ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K - RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K - RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K -} - -/* Define output sections */ -SECTIONS -{ - /* The startup code goes first into RAM_EXEC */ - .isr_vector : - { - . = ALIGN(4); - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(4); - } >RAM_EXEC - - /* The program code and other data goes into RAM_EXEC */ - .text : - { - . = ALIGN(4); - *(.text) /* .text sections (code) */ - *(.text*) /* .text* sections (code) */ - *(.glue_7) /* glue arm to thumb code */ - *(.glue_7t) /* glue thumb to arm code */ - *(.eh_frame) - *(.RamFunc) /* .RamFunc sections */ - *(.RamFunc*) /* .RamFunc* sections */ - - KEEP (*(.init)) - KEEP (*(.fini)) - - . = ALIGN(4); - _etext = .; /* define a global symbols at end of code */ - } >RAM_EXEC - - /* Constant data goes into RAM_EXEC */ - .rodata : - { - . = ALIGN(4); - *(.rodata) /* .rodata sections (constants, strings, etc.) */ - *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ - . = ALIGN(4); - } >RAM_EXEC - - .ARM.extab (READONLY): { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM_EXEC - .ARM (READONLY): { - __exidx_start = .; - *(.ARM.exidx*) - __exidx_end = .; - } >RAM_EXEC - - .preinit_array (READONLY): - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array*)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } >RAM_EXEC - - .init_array (READONLY): - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - } >RAM_EXEC - - .fini_array (READONLY): - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array*)) - PROVIDE_HIDDEN (__fini_array_end = .); - } >RAM_EXEC - - /* used by the startup to initialize data */ - _sidata = LOADADDR(.data); - - /* Initialized data sections goes into RAM, load LMA copy after code */ - .data : - { - . = ALIGN(4); - _sdata = .; /* create a global symbol at data start */ - *(.data) /* .data sections */ - *(.data*) /* .data* sections */ - - . = ALIGN(4); - _edata = .; /* define a global symbol at data end */ - } >DTCMRAM AT> RAM_EXEC - - /* Uninitialized data section */ - . = ALIGN(4); - .bss : - { - /* This is used by the startup in order to initialize the .bss section */ - _sbss = .; /* define a global symbol at bss start */ - __bss_start__ = _sbss; - *(.bss) - *(.bss*) - *(COMMON) - - . = ALIGN(4); - _ebss = .; /* define a global symbol at bss end */ - __bss_end__ = _ebss; - } >DTCMRAM - - /* User_heap_stack section, used to check that there is enough RAM left */ - ._user_heap_stack : - { - . = ALIGN(8); - PROVIDE ( end = . ); - PROVIDE ( _end = . ); - . = . + _Min_Heap_Size; - . = . + _Min_Stack_Size; - . = ALIGN(8); - } >DTCMRAM - - /* Remove information from the standard libraries */ - /DISCARD/ : - { - libc.a ( * ) - libm.a ( * ) - libgcc.a ( * ) - } - - .ARM.attributes 0 : { *(.ARM.attributes) } -} From 66cd294500fe24377df825bf144b784cac3a93cd Mon Sep 17 00:00:00 2001 From: Boris Mladenov Beslimov Date: Thu, 22 Jan 2026 19:18:28 +0100 Subject: [PATCH 6/8] fix(MPU): Delete startup code and use both linker scripts and startup code from the library --- CMakeLists.txt | 4 +- Core/Startup/startup_stm32h723zgtx.s | 756 --------------------------- 2 files changed, 2 insertions(+), 758 deletions(-) delete mode 100644 Core/Startup/startup_stm32h723zgtx.s diff --git a/CMakeLists.txt b/CMakeLists.txt index d07ece62..dc90ed69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(template-project LANGUAGES ASM C CXX) set(EXECUTABLE ${PROJECT_NAME}.elf) set(STLIB_DIR ${CMAKE_CURRENT_LIST_DIR}/deps/ST-LIB) -set(LD_SCRIPT ${CMAKE_SOURCE_DIR}/STM32H723ZGTX_FLASH.ld) +set(LD_SCRIPT ${STLIB_DIR}/STM32H723ZGTX_FLASH.ld) if(CMAKE_HOST_WIN32 ) set(VENV_PYTHON ${CMAKE_SOURCE_DIR}/virtual/Scripts/python) else() @@ -31,7 +31,7 @@ add_executable(${EXECUTABLE} ${SOURCE_H} ${SOURCE_HPP} - $<$:${CMAKE_SOURCE_DIR}/Core/Startup/startup_stm32h723zgtx.s> + $<$:${STLIB_DIR}/startup_stm32h723zgtx.s> ) target_link_libraries(${EXECUTABLE} PRIVATE diff --git a/Core/Startup/startup_stm32h723zgtx.s b/Core/Startup/startup_stm32h723zgtx.s deleted file mode 100644 index 73d8bd29..00000000 --- a/Core/Startup/startup_stm32h723zgtx.s +++ /dev/null @@ -1,756 +0,0 @@ -/** - ****************************************************************************** - * @file startup_stm32h723xx.s - * @author MCD Application Team - * @brief STM32H723xx Devices vector table for GCC based toolchain. - * This module performs: - * - Set the initial SP - * - Set the initial PC == Reset_Handler, - * - Set the vector table entries with the exceptions ISR address - * - Branches to main in the C library (which eventually - * calls main()). - * After Reset the Cortex-M processor is in Thread mode, - * priority is Privileged, and the Stack is set to Main. - ****************************************************************************** - * @attention - * - * Copyright (c) 2019 STMicroelectronics. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - - .syntax unified - .cpu cortex-m7 - .fpu softvfp - .thumb - -.global g_pfnVectors -.global Default_Handler - -/* start address for the initialization values of the .data section. -defined in linker script */ -.word _sidata -/* start address for the .data section. defined in linker script */ -.word _sdata -/* end address for the .data section. defined in linker script */ -.word _edata -/* start address for the .bss section. defined in linker script */ -.word _sbss -/* end address for the .bss section. defined in linker script */ -.word _ebss -/* stack used for SystemInit_ExtMemCtl; always internal RAM used */ - -/** - * @brief This is the code that gets called when the processor first - * starts execution following a reset event. Only the absolutely - * necessary set is performed, after which the application - * supplied main() routine is called. - * @param None - * @retval : None -*/ - - .section .text.Reset_Handler - .weak Reset_Handler - .type Reset_Handler, %function -Reset_Handler: - ldr sp, =_estack /* set stack pointer */ - -/* Call the clock system initialization function.*/ - bl SystemInit - -/* Copy the data segment initializers from flash to SRAM */ - ldr r0, =_sdata - ldr r1, =_edata - ldr r2, =_sidata - movs r3, #0 - b LoopCopyDataInit - -CopyDataInit: - ldr r4, [r2, r3] - str r4, [r0, r3] - adds r3, r3, #4 - -LoopCopyDataInit: - adds r4, r0, r3 - cmp r4, r1 - bcc CopyDataInit -/* Zero fill the bss segment. */ - ldr r2, =_sbss - ldr r4, =_ebss - movs r3, #0 - b LoopFillZerobss - -FillZerobss: - str r3, [r2] - adds r2, r2, #4 - -LoopFillZerobss: - cmp r2, r4 - bcc FillZerobss - -/* Call static constructors */ - bl __libc_init_array -/* Call the application's entry point.*/ - bl main - bx lr -.size Reset_Handler, .-Reset_Handler - -/** - * @brief This is the code that gets called when the processor receives an - * unexpected interrupt. This simply enters an infinite loop, preserving - * the system state for examination by a debugger. - * @param None - * @retval None -*/ - .section .text.Default_Handler,"ax",%progbits -Default_Handler: -Infinite_Loop: - b Infinite_Loop - .size Default_Handler, .-Default_Handler -/****************************************************************************** -* -* The minimal vector table for a Cortex M. Note that the proper constructs -* must be placed on this to ensure that it ends up at physical address -* 0x0000.0000. -* -*******************************************************************************/ - .section .isr_vector,"a",%progbits - .type g_pfnVectors, %object - .size g_pfnVectors, .-g_pfnVectors - - -g_pfnVectors: - .word _estack - .word Reset_Handler - - .word NMI_Handler - .word HardFault_Handler - .word MemManage_Handler - .word BusFault_Handler - .word UsageFault_Handler - .word 0 - .word 0 - .word 0 - .word 0 - .word SVC_Handler - .word DebugMon_Handler - .word 0 - .word PendSV_Handler - .word SysTick_Handler - - /* External Interrupts */ - .word WWDG_IRQHandler /* Window WatchDog */ - .word PVD_AVD_IRQHandler /* PVD/AVD through EXTI Line detection */ - .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */ - .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */ - .word FLASH_IRQHandler /* FLASH */ - .word RCC_IRQHandler /* RCC */ - .word EXTI0_IRQHandler /* EXTI Line0 */ - .word EXTI1_IRQHandler /* EXTI Line1 */ - .word EXTI2_IRQHandler /* EXTI Line2 */ - .word EXTI3_IRQHandler /* EXTI Line3 */ - .word EXTI4_IRQHandler /* EXTI Line4 */ - .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */ - .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */ - .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */ - .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */ - .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */ - .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */ - .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */ - .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */ - .word FDCAN1_IT0_IRQHandler /* FDCAN1 interrupt line 0 */ - .word FDCAN2_IT0_IRQHandler /* FDCAN2 interrupt line 0 */ - .word FDCAN1_IT1_IRQHandler /* FDCAN1 interrupt line 1 */ - .word FDCAN2_IT1_IRQHandler /* FDCAN2 interrupt line 1 */ - .word EXTI9_5_IRQHandler /* External Line[9:5]s */ - .word TIM1_BRK_IRQHandler /* TIM1 Break interrupt */ - .word TIM1_UP_IRQHandler /* TIM1 Update interrupt */ - .word TIM1_TRG_COM_IRQHandler /* TIM1 Trigger and Commutation interrupt */ - .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ - .word TIM2_IRQHandler /* TIM2 */ - .word TIM3_IRQHandler /* TIM3 */ - .word TIM4_IRQHandler /* TIM4 */ - .word I2C1_EV_IRQHandler /* I2C1 Event */ - .word I2C1_ER_IRQHandler /* I2C1 Error */ - .word I2C2_EV_IRQHandler /* I2C2 Event */ - .word I2C2_ER_IRQHandler /* I2C2 Error */ - .word SPI1_IRQHandler /* SPI1 */ - .word SPI2_IRQHandler /* SPI2 */ - .word USART1_IRQHandler /* USART1 */ - .word USART2_IRQHandler /* USART2 */ - .word USART3_IRQHandler /* USART3 */ - .word EXTI15_10_IRQHandler /* External Line[15:10]s */ - .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */ - .word 0 /* Reserved */ - .word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */ - .word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */ - .word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */ - .word TIM8_CC_IRQHandler /* TIM8 Capture Compare */ - .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */ - .word FMC_IRQHandler /* FMC */ - .word SDMMC1_IRQHandler /* SDMMC1 */ - .word TIM5_IRQHandler /* TIM5 */ - .word SPI3_IRQHandler /* SPI3 */ - .word UART4_IRQHandler /* UART4 */ - .word UART5_IRQHandler /* UART5 */ - .word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */ - .word TIM7_IRQHandler /* TIM7 */ - .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */ - .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */ - .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */ - .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */ - .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */ - .word ETH_IRQHandler /* Ethernet */ - .word ETH_WKUP_IRQHandler /* Ethernet Wakeup through EXTI line */ - .word FDCAN_CAL_IRQHandler /* FDCAN calibration unit interrupt*/ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */ - .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */ - .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */ - .word USART6_IRQHandler /* USART6 */ - .word I2C3_EV_IRQHandler /* I2C3 event */ - .word I2C3_ER_IRQHandler /* I2C3 error */ - .word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */ - .word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */ - .word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */ - .word OTG_HS_IRQHandler /* USB OTG HS */ - .word DCMI_PSSI_IRQHandler /* DCMI, PSSI */ - .word 0 /* Reserved */ - .word RNG_IRQHandler /* Rng */ - .word FPU_IRQHandler /* FPU */ - .word UART7_IRQHandler /* UART7 */ - .word UART8_IRQHandler /* UART8 */ - .word SPI4_IRQHandler /* SPI4 */ - .word SPI5_IRQHandler /* SPI5 */ - .word SPI6_IRQHandler /* SPI6 */ - .word SAI1_IRQHandler /* SAI1 */ - .word LTDC_IRQHandler /* LTDC */ - .word LTDC_ER_IRQHandler /* LTDC error */ - .word DMA2D_IRQHandler /* DMA2D */ - .word 0 /* Reserved */ - .word OCTOSPI1_IRQHandler /* OCTOSPI1 */ - .word LPTIM1_IRQHandler /* LPTIM1 */ - .word CEC_IRQHandler /* HDMI_CEC */ - .word I2C4_EV_IRQHandler /* I2C4 Event */ - .word I2C4_ER_IRQHandler /* I2C4 Error */ - .word SPDIF_RX_IRQHandler /* SPDIF_RX */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word DMAMUX1_OVR_IRQHandler /* DMAMUX1 Overrun interrupt */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word DFSDM1_FLT0_IRQHandler /* DFSDM Filter0 Interrupt */ - .word DFSDM1_FLT1_IRQHandler /* DFSDM Filter1 Interrupt */ - .word DFSDM1_FLT2_IRQHandler /* DFSDM Filter2 Interrupt */ - .word DFSDM1_FLT3_IRQHandler /* DFSDM Filter3 Interrupt */ - .word 0 /* Reserved */ - .word SWPMI1_IRQHandler /* Serial Wire Interface 1 global interrupt */ - .word TIM15_IRQHandler /* TIM15 global Interrupt */ - .word TIM16_IRQHandler /* TIM16 global Interrupt */ - .word TIM17_IRQHandler /* TIM17 global Interrupt */ - .word MDIOS_WKUP_IRQHandler /* MDIOS Wakeup Interrupt */ - .word MDIOS_IRQHandler /* MDIOS global Interrupt */ - .word 0 /* Reserved */ - .word MDMA_IRQHandler /* MDMA global Interrupt */ - .word 0 /* Reserved */ - .word SDMMC2_IRQHandler /* SDMMC2 global Interrupt */ - .word HSEM1_IRQHandler /* HSEM1 global Interrupt */ - .word 0 /* Reserved */ - .word ADC3_IRQHandler /* ADC3 global Interrupt */ - .word DMAMUX2_OVR_IRQHandler /* DMAMUX Overrun interrupt */ - .word BDMA_Channel0_IRQHandler /* BDMA Channel 0 global Interrupt */ - .word BDMA_Channel1_IRQHandler /* BDMA Channel 1 global Interrupt */ - .word BDMA_Channel2_IRQHandler /* BDMA Channel 2 global Interrupt */ - .word BDMA_Channel3_IRQHandler /* BDMA Channel 3 global Interrupt */ - .word BDMA_Channel4_IRQHandler /* BDMA Channel 4 global Interrupt */ - .word BDMA_Channel5_IRQHandler /* BDMA Channel 5 global Interrupt */ - .word BDMA_Channel6_IRQHandler /* BDMA Channel 6 global Interrupt */ - .word BDMA_Channel7_IRQHandler /* BDMA Channel 7 global Interrupt */ - .word COMP1_IRQHandler /* COMP1 global Interrupt */ - .word LPTIM2_IRQHandler /* LP TIM2 global interrupt */ - .word LPTIM3_IRQHandler /* LP TIM3 global interrupt */ - .word LPTIM4_IRQHandler /* LP TIM4 global interrupt */ - .word LPTIM5_IRQHandler /* LP TIM5 global interrupt */ - .word LPUART1_IRQHandler /* LP UART1 interrupt */ - .word 0 /* Reserved */ - .word CRS_IRQHandler /* Clock Recovery Global Interrupt */ - .word ECC_IRQHandler /* ECC diagnostic Global Interrupt */ - .word SAI4_IRQHandler /* SAI4 global interrupt */ - .word DTS_IRQHandler /* Digital Temperature Sensor interrupt */ - .word 0 /* Reserved */ - .word WAKEUP_PIN_IRQHandler /* Interrupt for all 6 wake-up pins */ - .word OCTOSPI2_IRQHandler /* OCTOSPI2 Interrupt */ - .word 0 /* Reserved */ - .word 0 /* Reserved */ - .word FMAC_IRQHandler /* FMAC Interrupt */ - .word CORDIC_IRQHandler /* CORDIC Interrupt */ - .word UART9_IRQHandler /* UART9 Interrupt */ - .word USART10_IRQHandler /* UART10 Interrupt */ - .word I2C5_EV_IRQHandler /* I2C5 Event Interrupt */ - .word I2C5_ER_IRQHandler /* I2C5 Error Interrupt */ - .word FDCAN3_IT0_IRQHandler /* FDCAN3 interrupt line 0 */ - .word FDCAN3_IT1_IRQHandler /* FDCAN3 interrupt line 1 */ - .word TIM23_IRQHandler /* TIM23 global interrupt */ - .word TIM24_IRQHandler /* TIM24 global interrupt */ - -/******************************************************************************* -* -* Provide weak aliases for each Exception handler to the Default_Handler. -* As they are weak aliases, any function with the same name will override -* this definition. -* -*******************************************************************************/ - .weak NMI_Handler - .thumb_set NMI_Handler,Default_Handler - - .weak HardFault_Handler - .thumb_set HardFault_Handler,Default_Handler - - .weak MemManage_Handler - .thumb_set MemManage_Handler,Default_Handler - - .weak BusFault_Handler - .thumb_set BusFault_Handler,Default_Handler - - .weak UsageFault_Handler - .thumb_set UsageFault_Handler,Default_Handler - - .weak SVC_Handler - .thumb_set SVC_Handler,Default_Handler - - .weak DebugMon_Handler - .thumb_set DebugMon_Handler,Default_Handler - - .weak PendSV_Handler - .thumb_set PendSV_Handler,Default_Handler - - .weak SysTick_Handler - .thumb_set SysTick_Handler,Default_Handler - - .weak WWDG_IRQHandler - .thumb_set WWDG_IRQHandler,Default_Handler - - .weak PVD_AVD_IRQHandler - .thumb_set PVD_AVD_IRQHandler,Default_Handler - - .weak TAMP_STAMP_IRQHandler - .thumb_set TAMP_STAMP_IRQHandler,Default_Handler - - .weak RTC_WKUP_IRQHandler - .thumb_set RTC_WKUP_IRQHandler,Default_Handler - - .weak FLASH_IRQHandler - .thumb_set FLASH_IRQHandler,Default_Handler - - .weak RCC_IRQHandler - .thumb_set RCC_IRQHandler,Default_Handler - - .weak EXTI0_IRQHandler - .thumb_set EXTI0_IRQHandler,Default_Handler - - .weak EXTI1_IRQHandler - .thumb_set EXTI1_IRQHandler,Default_Handler - - .weak EXTI2_IRQHandler - .thumb_set EXTI2_IRQHandler,Default_Handler - - .weak EXTI3_IRQHandler - .thumb_set EXTI3_IRQHandler,Default_Handler - - .weak EXTI4_IRQHandler - .thumb_set EXTI4_IRQHandler,Default_Handler - - .weak DMA1_Stream0_IRQHandler - .thumb_set DMA1_Stream0_IRQHandler,Default_Handler - - .weak DMA1_Stream1_IRQHandler - .thumb_set DMA1_Stream1_IRQHandler,Default_Handler - - .weak DMA1_Stream2_IRQHandler - .thumb_set DMA1_Stream2_IRQHandler,Default_Handler - - .weak DMA1_Stream3_IRQHandler - .thumb_set DMA1_Stream3_IRQHandler,Default_Handler - - .weak DMA1_Stream4_IRQHandler - .thumb_set DMA1_Stream4_IRQHandler,Default_Handler - - .weak DMA1_Stream5_IRQHandler - .thumb_set DMA1_Stream5_IRQHandler,Default_Handler - - .weak DMA1_Stream6_IRQHandler - .thumb_set DMA1_Stream6_IRQHandler,Default_Handler - - .weak ADC_IRQHandler - .thumb_set ADC_IRQHandler,Default_Handler - - .weak FDCAN1_IT0_IRQHandler - .thumb_set FDCAN1_IT0_IRQHandler,Default_Handler - - .weak FDCAN2_IT0_IRQHandler - .thumb_set FDCAN2_IT0_IRQHandler,Default_Handler - - .weak FDCAN1_IT1_IRQHandler - .thumb_set FDCAN1_IT1_IRQHandler,Default_Handler - - .weak FDCAN2_IT1_IRQHandler - .thumb_set FDCAN2_IT1_IRQHandler,Default_Handler - - .weak EXTI9_5_IRQHandler - .thumb_set EXTI9_5_IRQHandler,Default_Handler - - .weak TIM1_BRK_IRQHandler - .thumb_set TIM1_BRK_IRQHandler,Default_Handler - - .weak TIM1_UP_IRQHandler - .thumb_set TIM1_UP_IRQHandler,Default_Handler - - .weak TIM1_TRG_COM_IRQHandler - .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler - - .weak TIM1_CC_IRQHandler - .thumb_set TIM1_CC_IRQHandler,Default_Handler - - .weak TIM2_IRQHandler - .thumb_set TIM2_IRQHandler,Default_Handler - - .weak TIM3_IRQHandler - .thumb_set TIM3_IRQHandler,Default_Handler - - .weak TIM4_IRQHandler - .thumb_set TIM4_IRQHandler,Default_Handler - - .weak I2C1_EV_IRQHandler - .thumb_set I2C1_EV_IRQHandler,Default_Handler - - .weak I2C1_ER_IRQHandler - .thumb_set I2C1_ER_IRQHandler,Default_Handler - - .weak I2C2_EV_IRQHandler - .thumb_set I2C2_EV_IRQHandler,Default_Handler - - .weak I2C2_ER_IRQHandler - .thumb_set I2C2_ER_IRQHandler,Default_Handler - - .weak SPI1_IRQHandler - .thumb_set SPI1_IRQHandler,Default_Handler - - .weak SPI2_IRQHandler - .thumb_set SPI2_IRQHandler,Default_Handler - - .weak USART1_IRQHandler - .thumb_set USART1_IRQHandler,Default_Handler - - .weak USART2_IRQHandler - .thumb_set USART2_IRQHandler,Default_Handler - - .weak USART3_IRQHandler - .thumb_set USART3_IRQHandler,Default_Handler - - .weak EXTI15_10_IRQHandler - .thumb_set EXTI15_10_IRQHandler,Default_Handler - - .weak RTC_Alarm_IRQHandler - .thumb_set RTC_Alarm_IRQHandler,Default_Handler - - .weak TIM8_BRK_TIM12_IRQHandler - .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler - - .weak TIM8_UP_TIM13_IRQHandler - .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler - - .weak TIM8_TRG_COM_TIM14_IRQHandler - .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler - - .weak TIM8_CC_IRQHandler - .thumb_set TIM8_CC_IRQHandler,Default_Handler - - .weak DMA1_Stream7_IRQHandler - .thumb_set DMA1_Stream7_IRQHandler,Default_Handler - - .weak FMC_IRQHandler - .thumb_set FMC_IRQHandler,Default_Handler - - .weak SDMMC1_IRQHandler - .thumb_set SDMMC1_IRQHandler,Default_Handler - - .weak TIM5_IRQHandler - .thumb_set TIM5_IRQHandler,Default_Handler - - .weak SPI3_IRQHandler - .thumb_set SPI3_IRQHandler,Default_Handler - - .weak UART4_IRQHandler - .thumb_set UART4_IRQHandler,Default_Handler - - .weak UART5_IRQHandler - .thumb_set UART5_IRQHandler,Default_Handler - - .weak TIM6_DAC_IRQHandler - .thumb_set TIM6_DAC_IRQHandler,Default_Handler - - .weak TIM7_IRQHandler - .thumb_set TIM7_IRQHandler,Default_Handler - - .weak DMA2_Stream0_IRQHandler - .thumb_set DMA2_Stream0_IRQHandler,Default_Handler - - .weak DMA2_Stream1_IRQHandler - .thumb_set DMA2_Stream1_IRQHandler,Default_Handler - - .weak DMA2_Stream2_IRQHandler - .thumb_set DMA2_Stream2_IRQHandler,Default_Handler - - .weak DMA2_Stream3_IRQHandler - .thumb_set DMA2_Stream3_IRQHandler,Default_Handler - - .weak DMA2_Stream4_IRQHandler - .thumb_set DMA2_Stream4_IRQHandler,Default_Handler - - .weak ETH_IRQHandler - .thumb_set ETH_IRQHandler,Default_Handler - - .weak ETH_WKUP_IRQHandler - .thumb_set ETH_WKUP_IRQHandler,Default_Handler - - .weak FDCAN_CAL_IRQHandler - .thumb_set FDCAN_CAL_IRQHandler,Default_Handler - - .weak DMA2_Stream5_IRQHandler - .thumb_set DMA2_Stream5_IRQHandler,Default_Handler - - .weak DMA2_Stream6_IRQHandler - .thumb_set DMA2_Stream6_IRQHandler,Default_Handler - - .weak DMA2_Stream7_IRQHandler - .thumb_set DMA2_Stream7_IRQHandler,Default_Handler - - .weak USART6_IRQHandler - .thumb_set USART6_IRQHandler,Default_Handler - - .weak I2C3_EV_IRQHandler - .thumb_set I2C3_EV_IRQHandler,Default_Handler - - .weak I2C3_ER_IRQHandler - .thumb_set I2C3_ER_IRQHandler,Default_Handler - - .weak OTG_HS_EP1_OUT_IRQHandler - .thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler - - .weak OTG_HS_EP1_IN_IRQHandler - .thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler - - .weak OTG_HS_WKUP_IRQHandler - .thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler - - .weak OTG_HS_IRQHandler - .thumb_set OTG_HS_IRQHandler,Default_Handler - - .weak DCMI_PSSI_IRQHandler - .thumb_set DCMI_PSSI_IRQHandler,Default_Handler - - .weak RNG_IRQHandler - .thumb_set RNG_IRQHandler,Default_Handler - - .weak FPU_IRQHandler - .thumb_set FPU_IRQHandler,Default_Handler - - .weak UART7_IRQHandler - .thumb_set UART7_IRQHandler,Default_Handler - - .weak UART8_IRQHandler - .thumb_set UART8_IRQHandler,Default_Handler - - .weak SPI4_IRQHandler - .thumb_set SPI4_IRQHandler,Default_Handler - - .weak SPI5_IRQHandler - .thumb_set SPI5_IRQHandler,Default_Handler - - .weak SPI6_IRQHandler - .thumb_set SPI6_IRQHandler,Default_Handler - - .weak SAI1_IRQHandler - .thumb_set SAI1_IRQHandler,Default_Handler - - .weak LTDC_IRQHandler - .thumb_set LTDC_IRQHandler,Default_Handler - - .weak LTDC_ER_IRQHandler - .thumb_set LTDC_ER_IRQHandler,Default_Handler - - .weak DMA2D_IRQHandler - .thumb_set DMA2D_IRQHandler,Default_Handler - - .weak OCTOSPI1_IRQHandler - .thumb_set OCTOSPI1_IRQHandler,Default_Handler - - .weak LPTIM1_IRQHandler - .thumb_set LPTIM1_IRQHandler,Default_Handler - - .weak CEC_IRQHandler - .thumb_set CEC_IRQHandler,Default_Handler - - .weak I2C4_EV_IRQHandler - .thumb_set I2C4_EV_IRQHandler,Default_Handler - - .weak I2C4_ER_IRQHandler - .thumb_set I2C4_ER_IRQHandler,Default_Handler - - .weak SPDIF_RX_IRQHandler - .thumb_set SPDIF_RX_IRQHandler,Default_Handler - - .weak DMAMUX1_OVR_IRQHandler - .thumb_set DMAMUX1_OVR_IRQHandler,Default_Handler - - .weak DFSDM1_FLT0_IRQHandler - .thumb_set DFSDM1_FLT0_IRQHandler,Default_Handler - - .weak DFSDM1_FLT1_IRQHandler - .thumb_set DFSDM1_FLT1_IRQHandler,Default_Handler - - .weak DFSDM1_FLT2_IRQHandler - .thumb_set DFSDM1_FLT2_IRQHandler,Default_Handler - - .weak DFSDM1_FLT3_IRQHandler - .thumb_set DFSDM1_FLT3_IRQHandler,Default_Handler - - .weak SWPMI1_IRQHandler - .thumb_set SWPMI1_IRQHandler,Default_Handler - - .weak TIM15_IRQHandler - .thumb_set TIM15_IRQHandler,Default_Handler - - .weak TIM16_IRQHandler - .thumb_set TIM16_IRQHandler,Default_Handler - - .weak TIM17_IRQHandler - .thumb_set TIM17_IRQHandler,Default_Handler - - .weak MDIOS_WKUP_IRQHandler - .thumb_set MDIOS_WKUP_IRQHandler,Default_Handler - - .weak MDIOS_IRQHandler - .thumb_set MDIOS_IRQHandler,Default_Handler - - .weak MDMA_IRQHandler - .thumb_set MDMA_IRQHandler,Default_Handler - - .weak SDMMC2_IRQHandler - .thumb_set SDMMC2_IRQHandler,Default_Handler - - .weak HSEM1_IRQHandler - .thumb_set HSEM1_IRQHandler,Default_Handler - - .weak ADC3_IRQHandler - .thumb_set ADC3_IRQHandler,Default_Handler - - .weak DMAMUX2_OVR_IRQHandler - .thumb_set DMAMUX2_OVR_IRQHandler,Default_Handler - - .weak BDMA_Channel0_IRQHandler - .thumb_set BDMA_Channel0_IRQHandler,Default_Handler - - .weak BDMA_Channel1_IRQHandler - .thumb_set BDMA_Channel1_IRQHandler,Default_Handler - - .weak BDMA_Channel2_IRQHandler - .thumb_set BDMA_Channel2_IRQHandler,Default_Handler - - .weak BDMA_Channel3_IRQHandler - .thumb_set BDMA_Channel3_IRQHandler,Default_Handler - - .weak BDMA_Channel4_IRQHandler - .thumb_set BDMA_Channel4_IRQHandler,Default_Handler - - .weak BDMA_Channel5_IRQHandler - .thumb_set BDMA_Channel5_IRQHandler,Default_Handler - - .weak BDMA_Channel6_IRQHandler - .thumb_set BDMA_Channel6_IRQHandler,Default_Handler - - .weak BDMA_Channel7_IRQHandler - .thumb_set BDMA_Channel7_IRQHandler,Default_Handler - - .weak COMP1_IRQHandler - .thumb_set COMP1_IRQHandler,Default_Handler - - .weak LPTIM2_IRQHandler - .thumb_set LPTIM2_IRQHandler,Default_Handler - - .weak LPTIM3_IRQHandler - .thumb_set LPTIM3_IRQHandler,Default_Handler - - .weak LPTIM4_IRQHandler - .thumb_set LPTIM4_IRQHandler,Default_Handler - - .weak LPTIM5_IRQHandler - .thumb_set LPTIM5_IRQHandler,Default_Handler - - .weak LPUART1_IRQHandler - .thumb_set LPUART1_IRQHandler,Default_Handler - - .weak CRS_IRQHandler - .thumb_set CRS_IRQHandler,Default_Handler - - .weak ECC_IRQHandler - .thumb_set ECC_IRQHandler,Default_Handler - - .weak SAI4_IRQHandler - .thumb_set SAI4_IRQHandler,Default_Handler - - .weak DTS_IRQHandler - .thumb_set DTS_IRQHandler,Default_Handler - - .weak WAKEUP_PIN_IRQHandler - .thumb_set WAKEUP_PIN_IRQHandler,Default_Handler - - .weak OCTOSPI2_IRQHandler - .thumb_set OCTOSPI2_IRQHandler,Default_Handler - - .weak FMAC_IRQHandler - .thumb_set FMAC_IRQHandler,Default_Handler - - .weak CORDIC_IRQHandler - .thumb_set CORDIC_IRQHandler,Default_Handler - - .weak UART9_IRQHandler - .thumb_set UART9_IRQHandler,Default_Handler - - .weak USART10_IRQHandler - .thumb_set USART10_IRQHandler,Default_Handler - - .weak I2C5_EV_IRQHandler - .thumb_set I2C5_EV_IRQHandler,Default_Handler - - .weak I2C5_ER_IRQHandler - .thumb_set I2C5_ER_IRQHandler,Default_Handler - - .weak FDCAN3_IT0_IRQHandler - .thumb_set FDCAN3_IT0_IRQHandler,Default_Handler - - .weak FDCAN3_IT1_IRQHandler - .thumb_set FDCAN3_IT1_IRQHandler,Default_Handler - - .weak TIM23_IRQHandler - .thumb_set TIM23_IRQHandler,Default_Handler - - .weak TIM24_IRQHandler - .thumb_set TIM24_IRQHandler,Default_Handler - - From 43dfce4844764a23d0f68f3e9046cc4572ab52cc Mon Sep 17 00:00:00 2001 From: Boris Mladenov Beslimov Date: Thu, 22 Jan 2026 19:21:33 +0100 Subject: [PATCH 7/8] fix(tools): init.sh was using windows like python virtual env path --- .vscode/tasks.json | 5 ++++- tools/init.sh | 0 2 files changed, 4 insertions(+), 1 deletion(-) mode change 100644 => 100755 tools/init.sh diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 3c58499f..bf4f5d3f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -11,7 +11,10 @@ { "label": "Pre-flash check", "type": "shell", - "command": "${workspaceFolder}/virtual/Scripts/python", + "command": "${workspaceFolder}/virtual/bin/python", + "windows": { + "command": "${workspaceFolder}/virtual/Scripts/python" + }, "args": [ "${workspaceFolder}/tools/preflash_check.py" ], diff --git a/tools/init.sh b/tools/init.sh old mode 100644 new mode 100755 From 493da16a043d383e2b8a86b01f05f09ebb8f0cd7 Mon Sep 17 00:00:00 2001 From: Boris Mladenov Beslimov Date: Fri, 23 Jan 2026 00:19:08 +0100 Subject: [PATCH 8/8] fix(MPU): Update ST-LIB --- deps/ST-LIB | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/ST-LIB b/deps/ST-LIB index bd05e1b0..332e04d7 160000 --- a/deps/ST-LIB +++ b/deps/ST-LIB @@ -1 +1 @@ -Subproject commit bd05e1b07c1d2376486a757633137a0d7f3f4f1e +Subproject commit 332e04d7b84d18e36df36a9e7366c03d030b3a02