All Projects → akospasztor → Stm32 Bootloader

akospasztor / Stm32 Bootloader

Licence: other
Customizable Bootloader for STM32 microcontrollers. This example demonstrates how to perform in-application-programming of a firmware located on an external SD card with FAT32 file system.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Stm32 Bootloader

Stm32 Dma Uart
Efficient DMA timeout mechanism for peripheral DMA configured in circular mode demonstrated on a STM32 microcontroller.
Stars: ✭ 111 (-79.48%)
Mutual labels:  stm32, microcontroller, mcu, example, demo
Nf Interpreter
⚙️ nanoFramework Interpreter, CLR, HAL, PAL and reference target boards
Stars: ✭ 168 (-68.95%)
Mutual labels:  firmware, stm32, microcontroller, mcu
Openblt
Official read-only mirror of the SVN OpenBLT bootloader repository. Updated daily.
Stars: ✭ 256 (-52.68%)
Mutual labels:  stm32, microcontroller, bootloader
Awesome Embedded
A curated list of awesome embedded programming.
Stars: ✭ 831 (+53.6%)
Mutual labels:  stm32, microcontroller, bootloader
Daplink
Stars: ✭ 1,162 (+114.79%)
Mutual labels:  firmware, microcontroller, mcu
systemboot
SystemBoot is a LinuxBoot distribution that works as a system firmware + bootloader, based on u-root
Stars: ✭ 103 (-80.96%)
Mutual labels:  firmware, boot, bootloader
Stm32 Bootloader
UART bootloader for STM32 microcontroller.
Stars: ✭ 97 (-82.07%)
Mutual labels:  firmware, stm32, bootloader
pikascript
Ultralightweight Python engine that can run with 4KB of RAM and 32KB of Flash (such as STM32G030C8 and STM32F103C8), and is very easy to deploy and expand.
Stars: ✭ 855 (+58.04%)
Mutual labels:  microcontroller, stm32, mcu
remote-pinetime-bot
Telegram Bot to flash and test PineTime firmware remotely
Stars: ✭ 23 (-95.75%)
Mutual labels:  flash, firmware, bootloader
Various mcu debugger diy
各种LInk大合集
Stars: ✭ 402 (-25.69%)
Mutual labels:  stm32, bootloader, mcu
stm32bl
STM32 MCU serial firmware loader (jet another stm32loader fw bootloader tool)
Stars: ✭ 22 (-95.93%)
Mutual labels:  flash, stm32, bootloader
IOsonata
IOsonata multi-platform multi-architecture power & performance optimized software library for fast and easy IoT MCU firmware development. Object Oriented design, no board package to define, just pure plug & play any boards
Stars: ✭ 40 (-92.61%)
Mutual labels:  firmware, stm32, mcu
stm32DevelopmentBoards
Development boards and software templates for STM32 MCU
Stars: ✭ 41 (-92.42%)
Mutual labels:  stm32, mcu
mikroe-uhb
USB HID Bootloader programming tool for devices manufactured by MikroElektronika
Stars: ✭ 15 (-97.23%)
Mutual labels:  microcontroller, bootloader
Flutter Ui Nice
More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.
Stars: ✭ 3,092 (+471.53%)
Mutual labels:  example, demo
Tock
A secure embedded operating system for microcontrollers
Stars: ✭ 3,258 (+502.22%)
Mutual labels:  microcontroller, mcu
Api Docs
api.nasa.gov
Stars: ✭ 267 (-50.65%)
Mutual labels:  example, demo
Ironos
Open Source Soldering Iron firmware for Miniware and Pinecil
Stars: ✭ 3,945 (+629.21%)
Mutual labels:  firmware, flash
Home
🏠 The landing page for nanoFramework repositories.
Stars: ✭ 315 (-41.77%)
Mutual labels:  stm32, mcu
OtterPill
stm32f072 dev board with arduino nano alike pinout
Stars: ✭ 127 (-76.52%)
Mutual labels:  firmware, stm32

STM32 Bootloader

Customizable Bootloader for STM32 microcontrollers. This project includes demonstrations for various hardware how to perform in-application-programming of a firmware located on external SD card with FAT32 file system.

Each example uses the same bootloader library located in the lib/stm32-bootloader folder. The examples are located in the projects folder and they come with a separate, dedicated README file with description related to that specific implementation.

Update: the STM32L496-Discovery example supports compiling and building the project with the GNU Arm Embedded Toolchain (ARM GCC) out-of-the-box, in addition to IAR EWARM. Check out the project README for further information.

Please refer to https://akospasztor.github.io/stm32-bootloader for complete documentation of the bootloader library source code.

Build Status

Table of Contents

Bootloader features

  • Configurable application space
  • Flash erase
  • Flash programming
  • Flash verification after programming
  • Checksum verification
  • Flash protection check, write protection enable/disable
  • Extended error handling, fail-safe design
  • Bootloader firmware update and the ability to perform full chip re-programming: enter ST's built-in bootloader from software (without triggering the BOOT pin)
  • Serial tracing over SWO for easier debugging and development
  • Easy to customize and port to other microcontrollers

Source code organization

Repository
├── docs
├── drivers
│   ├── CMSIS
│   └── STM32L4xx_HAL_Driver
├── lib
│   ├── fatfs
│   └── stm32-bootloader
└── projects
    ├── STM32L476-CustomHw
    ├── STM32L496-CustomHw
    └── STM32L496-Discovery

The docs folder contains the generated documentation of the bootloader source code and other documentation-related static files.

The drivers folder contains the CMSIS (Cortex Microcontroller Software Interface Standard) as well as the HAL (Hardware Abstraction Layer) drivers from ST.

The bootloader source code and corresponding header file can be found in lib/stm32-bootloader folder. Additionally, the lib folder contains the FatFs library as well.

The various demonstrations reside in the projects folder. Each example project contains an include and source folder where the header and source files are located respectively. The compiler and SDK-specific files are located in their respective subfolders. Furthermore, every example project has a dedicated README file explaining its functionality in detail.

Examples

This repository contains the following examples.

Microcontroller Hardware Project path
STM32L476VG Custom projects/STM32L476-CustomHw
STM32L496VG Custom projects/STM32L496-CustomHw
STM32L496AG 32L496GDISCOVERY projects/STM32L496-Discovery

How to use

The bootloader can be easily customized and tailored to the required hardware and environment, i.e. to perform firmware updates over various interfaces or even to implement over-the-air (OTA) updates if the hardware incorporates wireless communication modules. In order to perform successful in-application-programming, the following sequence has to be kept:

  1. Check for flash write protection and disable it if necessary.
  2. Initialize flash with Bootloader_Init().
  3. Erase application space with Bootloader_Erase().
  4. Prepare for programming by calling Bootloader_FlashBegin().
  5. Perform programming by repeatedly calling the Bootloader_FlashNext() function. The programming procedure requires 8 bytes of data (double word) to be programmed at once into the flash. This function automatically increases the address where the data is being written.
  6. Finalize programming by calling Bootloader_FlashEnd().

The application image has to be in binary format. If the checksum verification is enabled, the binary must include the checksum value at the end of the image. When creating the application image, the checksum has to be calculated over the entire image (except the checksum area) with the following parameters:

  • Algorithm: CRC32
  • Size: 4 bytes
  • Initial value: 0xFFFFFFFF
  • Bit order: MSB first

Important notes:

  • In order to perform a successful application jump from the bootloader, the vector table of the application firmware should be relocated. On system reset, the vector table is fixed at address 0x00000000. When creating an application, the microcontroller startup code sets the vector table offset to 0x0000 in the system_stm32xxxx.c file by default. This has to be either disabled (the bootloader can be configured to perform the vector table relocation before the jump) or manually set the vector table offset register (VTOR) to the appropriate offset value which is the start address of the application space. For more information, please refer to [1].
  • The linker settings of the application firmware need to be adjusted from their default settings so that the start address of flash reflects the actual start address of the application space.

Configuration

The bootloader can be widely configured in the bootloader.h file. The file includes detailed comments and descriptions related to the configurable parameters and definitions.

References

[1] PM0214, "STM32F3 Series, STM32F4 Series, STM32L4 Series and STM32L4+ Series Cortex®-M4 Programming Manual", http://www.st.com/resource/en/programming_manual/dm00046982.pdf

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].