Conversation
1c2874a to
66742b3
Compare
66742b3 to
04d3851
Compare
There was a problem hiding this comment.
Pull Request Overview
This pull request adds Second Stage Bootloader (SSBL) support for the STM32N657X0-Q (NUCLEO-N657X0-Q) microcontroller, which lacks internal flash and relies on external flash memory. The implementation enables execution from external flash at XSPI2 addresses starting from 0x70100400 in memory-mapped mode.
Key Changes:
- Added STM32 External Memory Manager middleware with drivers for NOR SFDP, PSRAM, SDCARD, and user-defined memory types
- Implemented boot mechanisms for execute-in-place (XIP) and load-and-run (LRUN) modes
- Created linker scripts for external flash execution with proper memory region definitions
- Added build targets and configurations for external flash support
- Fixed HAL driver issues in USB, RCC, FMC, UART, and utility modules
Reviewed Changes
Copilot reviewed 112 out of 113 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Middlewares/ST/STM32_ExtMem_Manager/user/* | User-defined driver API, types, and weak implementations for custom memory support |
| Middlewares/ST/STM32_ExtMem_Manager/sdcard/* | SD card driver implementation with SAL integration |
| Middlewares/ST/STM32_ExtMem_Manager/psram/* | PSRAM driver for APS memory configuration |
| Middlewares/ST/STM32_ExtMem_Manager/nor_sfdp/* | NOR flash SFDP driver with JEDEC parameter parsing |
| Middlewares/ST/STM32_ExtMem_Manager/sal/* | Software Adaptation Layer for XSPI and SD peripherals |
| Middlewares/ST/STM32_ExtMem_Manager/boot/* | XIP and LRUN boot mechanism implementations |
| Middlewares/ST/STM32_ExtMem_Manager/stm32_extmem.* | Core external memory manager API |
| Linker/STM32N6xx_EXT_FLASH*.ld | Linker scripts for external flash execution with CACHEAXI and AXISRAM regions |
| Makefile* | Build system updates for external flash targets |
| Drivers/STM32N6xx_HAL_Driver/Src/* | Bug fixes in USB LL, RCC LL, FMC LL, UART HAL, and utility functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
04d3851 to
64a1bf9
Compare
64a1bf9 to
4cd4b75
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support for Second Stage Bootloader (SSBL) for board NUCLEO-N657X0-Q with STM32N657X0 Microcontroller (MCU)
The STM32N6xx series of MCUs does not have internal flash memory, so it relies on external flash. It includes an integrated mechanism that copies up to 255 KB of the First Stage Bootloader (FSBL) from external flash to RAM, starting at address 0x34180400, which corresponds to the AXISRAM2 segment. This functionality is implemented in this PR #38.
To use the AXISRAM2 segment for firmware, we cannot run the FSBL from it, so the software must run from another location. The best solution is an SSBL that runs from external memory. The SSBL allows us to unlock the full potential of the MCU's RAM, providing a total of 4.2 MB of contiguous embedded memory.
This PR introduces a linker script that prepares the firmware to run at XSPI2 addresses starting from 0x70100400 in memory-mapped mode, as well as drivers for the external flash MX25UM51245G, which comes with the board.
The sequence is as follows: the FSBL is placed at address 0x70000400, and the SSBL is placed at 0x70100400.
The SSBL runs from external flash and uses the CACHEAXI address space, which allows the firmware to be programmed at the beginning of AXISRAM.
At the time of working on this, I was not able to utilize VENCRAM for the SSBL.