cancel
Showing results for 
Search instead for 
Did you mean: 

Boot app code from external memory OSPI/QSPI ???

PLago.2
Associate II

Hello!

I'am playing with the STM32H7B3-DK and I have successfully bring up the board and run a custom gui:

The GUI assets are loaded in the external OSPI and the dual framebuffer is placed in the the external SDRAM.

Now I'am interested in loading also the application code in the external OSPI. This should be quite easy I hope, if I'm not wrong, it is just a matter of editing the STM32H7B3LIHXQ_FLASH.ld file.

However I'am confused on how to do with bootloader:

My intention is to boot the code from the OSPI, load it all in the internal RAM and execute it in the internal RAM:

  • how should I configure or develop a booloader?
  • where I can find a ready to use booloader.bin?

By googling I found this very interesting appnote: AN5188 which talks about external memory code execution, but it covers the cases in which the code is executed in place in the external memory.

Are there any appnotes about booting from external memory?

Thank you!!

Paul

Can

3 REPLIES 3

The loader in this context should

Set up all the clocks,

Set up the external memory interface in memory mapped mode, QSPI via say example BSP and XIP code,

Check the integrity of the QSPI based image, at least if Vector Table is present,

Transfer control by jumping into code via the SP/PC values given in the Vector Table

On the QSPI application side DO NOT mess with the clocks, so leave out call to SystemClock_Confg(), thus avoiding calls to HAL_RCC_OscoConfig() and HAL_RCC_ClockConfig(), rather using the already running system

Calling HAL_RCC_GetHCLKFreq() should refresh SystemCoreClock;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PLago.2
Associate II

Hi @Community member​ , thank you for your replay.

But I'am still confused on how to start working on my bootloader:

  • Should I start developing the bootloader from scratch and design a separeted cubemx project? Is there a ready to use example that copy the code from an external memory and run it in the internal ram?
  • Is there any appnotes explaining how to develop a bootloader? The stm32H750 has only 128K of internal flash, so it should be a quite common issue.

Thank you,

Paul

I don't use CubeMX, but there should be enough examples in the CubeH7 HAL trees to MacGyver something together in short order

STM32Cube_FW_H7_V1.7.0\Drivers\BSP\STM32H750B-DK\stm32h750b_discovery_qspi.c

STM32Cube_FW_H7_V1.7.0\Projects\STM32H750B-DK\Examples\QSPI\QSPI_MemoryMappedDual

STM32Cube_FW_H7_V1.7.0\Projects\STM32H743I-EVAL\Examples\QSPI\QSPI_ExecuteInPlace

STM32Cube_FW_H7_V1.7.0\Projects\STM32H743I-EVAL\Applications\IAP

STM32Cube_FW_H7_V1.7.0\Projects\STM32H750B-DK\Demonstrations\MenuLauncher\Core\Src\bsp.c

Start with a simple shell/template project that brings up clock and QSPI

The concepts of boot loaders is not specific to STM32 nor the H7, you're bring up the hardware, determining the specific responsibilities contracted on each side, and using the inherent functionality of the micro-controller to map vector tables and transfer control to other routines.

The H7 has more flash memory than specified.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..