on
2021-11-30
01:09 AM
- edited on
2024-06-04
05:51 AM
by
Laurids_PETERSE
ST Open Bootloader is example application code for STM32 microcontrollers providing In-Application programming (IAP) and is offered in the STM32Cube MCU Packages and GitHub. It is fully compatible with the STM32 System Bootloader and supports the same communication interfaces and commands and can also be used with the STM32CubeProgrammer.
Open Bootloader is provided as example code that can be used to build a customized bootloader. It allows for downloading the application program to the internal user memory (Flash, SRAM, OTP) without the need for a debugger using one of the available communication interfaces (USART, I2C, SPI, USB-DFU or FDCAN).
Open Bootloader communicates via an interface link with the Host (STM32CubeProgrammer or another host) to download firmware to the device for writing into the targeted user memory. Open Bootloader relies on STM32Cube HAL/LL drivers for hardware system initialization and configuration of the clocks and the communication interfaces. Open Bootloader code can be loaded into user Flash or SRAM taking the necessary precautions to avoid erasing or corruption (i.e. using the write protection feature).
Open Bootloader is executed in a non-secure domain from user Flash or SRAM at the initial base address using the following resources:
This article shows where to find the ST Open Bootloader within the STM32Cube library package and steps through an example of programming it into an STM32 and using it with the STM32CubeProgrammer.
The ST Open Bootloader is part of the STM32Cube Library package. This example uses the STM32G0C1 eval board and the Open Bootloader can be found here:
STM32Cube_FW_G0_Vx.x.x\Projects\STM32G0C1E-EV\Applications\OpenBootloader
Project examples are provided for the STM32CubeIDE, IAR EWARM and Keil uVision toolchains, while STM32CubeIDE is used in this article. The ST Open Bootloader supports a variety of peripheral interfaces (UART, I2C, SPI, CAN, USB DFU) as does the STM32G0 System Memory Bootloader. USB DFU will be used in this example.
Download and unzip latest STM32G0CubeG0 Firmware Library:
Open The ST Open Bootloader project:
Within Windows File Explorer, double click on the STM32CubeIDE project filename, ".project" for ST Open Bootloader located in the STM32CubeG0 Library that was downloaded and unzipped at this location:
STM32Cube_FW_G0_V1.5.0\Projects\STM32G0C1E-EV\Applications\OpenBootloader\STM32CubeIDE
The project will then appear in the Project Explorer like this:
Build the project, enter debug mode and run the code
Enter Debug session: this programs the code into the flash and then starts the debug session
Exit the Debug Session by terminating it.
Boot mode is already set to execute from Flash by default.
Reset the board and the ST Open Bootloader will start executing. The ST Open Bootloader starts in the detection stage checking the various communication peripheral interfaces for activity looking for a host connection.
Plug in the USB Type C cable to the CN7 daughter board that is connected to the STM32G0 mother board. The USB host will begin communications enumerating the board as a USB DFU Device as confirmed in the Device Manager:
Open STM32CubeProgammer and select the USB Interface in the STM32CubeProgrammer to establish the connection through USB:
Confirm the USB connection is established as shown below. If it is not, click on the refresh button :
Now, connect by clicking on the Connect button:
Once the connection is made, the content of the flash will be displayed as shown below:
While the flash can now be read, erased or written, the primary objective is to upload a new application image into the STM32G0.
Is there a porting to stm32h7?
Only one STM32H7S board has a ready ported project for the bootloader. For other STM32H7 and boards you are free to port on your own.
Will this code run on STM32L562ZET6Q?
I'm doing the following steps but UART is not getting recognized in STM32CubeProgrammer.
Exit the Debug Session by terminating it.
Boot mode is already set to execute from Flash by default.
Reset the board and the ST Open Bootloader will start executing.
Please refer this for details :
Re: How to use ST Open bootloader for STM32L562ZET... - STMicroelectronics Community