cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating MCUboot into a project

Ade J.2
Associate II

Split from old thread: https://community.st.com/t5/stm32-mcus-security/information-about-mcuboot-and-illustrative-examples/td-p/689154 


Hello @Jocelyn RICARD ,

I'm looking for guidance on integrating Mcuboot into my project. I am using a NUCLEO-U5A5ZJ-Q

STM32CubeIDE 1.17

First of all some notes about the experience:

  1. When using the example selector in CubeIDE and, for example the SBSFU_Boot project, it has several problems related to paths in the shell scripts. It cannot find the env.sh file, since it's in the root SBSFU directory. 
  2. It shows only the content of the STM32CubeIDE directory, while it also has related content in the top directory?

How should I use this example correctly? Download the whole SBSFU project and not use CubeIDE, but use make/cmake and a manually installed compiler?

Are the provided examples by ST for Mcuboot in the SBSFU project using the modified Mcuboot middleware?
When writing my own bootloader is that the recommended way or is it only for demonstration purposes and  should I use the original mcubood itself?

It would highly appreciated if ST would make a proper step by step guide of how to build your own bootloader using Mcuboot on the wiki.st.com page. 
Edit: I am aware of AN5447, but it's very high level only..

 

Best regards,

Arnold

4 REPLIES 4
Jocelyn RICARD
ST Employee

Hello Arnold,

I would suggest using directly the example provided in the STM32CubeU5:

STM32Cube_FW_U5_V1.7.0\Projects\B-U585I-IOT02A\Applications\SBSFU\

In the readme file, it is explained what to do to adapt the example to your device.

The example is a porting on STM32U5, and mcuboot middleware is adapted to support more configuration use cases.

So, if you want to have a working setup you shouldn't change it.

Besides, there is a way to build a mcuboot for STM32 through trusted-firmware.org and CMake. This is part of BL2 TFM build. It follow TFM build rules.

Best regards

Jocelyn

 

 

Thanks @Jocelyn RICARD for your fast reply!

So for the example to work I should get the complete project and then open them individually in CubeIDE and then it should work fine?

I want to make some changes, so I guess I'll go straight to the stm32-mw-mcuboot after testing the example.

 

Best regards,

Arnold

Jocelyn RICARD
ST Employee

Hello @Ade J.2 ,

you can import the whole project at once in STM32CubeIDE.

Then build each project as described in the readme file.

Then you can make all the changes you need.

Best regards

Jocelyn

sakr
Associate

Hi,
I need to run the example on STM32L432xx development board. Apparently, this board is not supported by this example. So, I manually added the drivers related to the STM32L432xx board in the respective locations. The updated command in the STM32CubeIDE is as under, I have also attached the updated project with the post. 

arm-none-eabi-gcc -E -P -xc -DSTM32L432xx -DBL2 -I../../../Linker -I../../Inc -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/CMSIS/Device/ST/STM32L432xx/Include -I../../../../../../../Drivers/STM32L4xx_HAL_Driver/Inc -o./output.ld ../STM32L432KCUX_FLASH.ld && arm-none-eabi-gcc -E -P -xc -DSTM32L432xx -DBL2 -I../../../Linker -I../../Inc -I../../Inc -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../../../../../../../Drivers/STM32L4xx_HAL_Driver/Inc -o../image_macros_preprocessed_bl2.c ../../Src/image_macros_to_preprocess_bl2.c

The file `image_macros_to_preprocess_bl2.c` is defining some address locations and I could not resolve that. It seems to be related to the specific memory layout of the board. I am getting the following error when trying to build my project. 
 Screenshot 2025-03-18 022829.png

Kindly help me in getting out of it. Or recommend me some easy way to integrate MCUboot to my STM32L432xx project. 

Thanks in advance.

BR,
Saqib