All Projects → sfyip → STM32F103_MSD_BOOTLOADER

sfyip / STM32F103_MSD_BOOTLOADER

Licence: MIT license
STM32F103 Mass Storage Device Bootloader

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to STM32F103 MSD BOOTLOADER

DfuBootloader
STM32 USB device bootloader using DFU class interface
Stars: ✭ 79 (+243.48%)
Mutual labels:  stm32, bootloader
stm32-tkg-hid-bootloader
A HID driverless bootloader and flash tool companion for the STM32F1 line
Stars: ✭ 30 (+30.43%)
Mutual labels:  stm32, bootloader
FASTUSBasp
This is the fast avr programmer for AVR MCUs based on cheap stm32f103c8t6 board with usb-to-serial support.
Stars: ✭ 78 (+239.13%)
Mutual labels:  stm32, stm32f103
STM32F10x Servo Library
Servo library with stm developed by the Liek Software Team. We are working on new versions.
Stars: ✭ 14 (-39.13%)
Mutual labels:  stm32, stm32f103
stm32bl
STM32 MCU serial firmware loader (jet another stm32loader fw bootloader tool)
Stars: ✭ 22 (-4.35%)
Mutual labels:  stm32, bootloader
Sboot stm32
Secure USB DFU1.1 bootloader for STM32
Stars: ✭ 181 (+686.96%)
Mutual labels:  stm32, bootloader
stm32-usb-bootloader
This repository contains bootloader for stm32f1xx microcontrollers. It works for stm32f103ret6, but you can simply adopt it to any MCU supporting STM32 HAL library with USB and SD-card
Stars: ✭ 40 (+73.91%)
Mutual labels:  stm32, bootloader
Various mcu debugger diy
各种LInk大合集
Stars: ✭ 402 (+1647.83%)
Mutual labels:  stm32, bootloader
STM32F103-Bare-Metal
Programming the STM32F103C8 micro controller at the "bare metal" register level.
Stars: ✭ 42 (+82.61%)
Mutual labels:  stm32, stm32f103
grbl32
CNC controller running on the STM32F103 "Blue Pill" board, build and flash on Mac/Linux
Stars: ✭ 33 (+43.48%)
Mutual labels:  stm32, stm32f103
Stm32 Bootloader
UART bootloader for STM32 microcontroller.
Stars: ✭ 97 (+321.74%)
Mutual labels:  stm32, bootloader
stm32 tiny monitor
A tiny external monitor for PC using STM32 and ST7789. Connects to PC over USB and displays the captured screen on ST7789 (240x240) display.
Stars: ✭ 61 (+165.22%)
Mutual labels:  stm32, stm32f103
Awesome Embedded
A curated list of awesome embedded programming.
Stars: ✭ 831 (+3513.04%)
Mutual labels:  stm32, bootloader
Dapboot
DFU Bootloader for STM32 chips
Stars: ✭ 194 (+743.48%)
Mutual labels:  stm32, bootloader
Stm32 Bootloader
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.
Stars: ✭ 541 (+2252.17%)
Mutual labels:  stm32, bootloader
DHT11-DHT22-STM32-HAL
Библиотека для работы с датчиками DHT11/DHT22/AM2302/AM2301 на STM32
Stars: ✭ 26 (+13.04%)
Mutual labels:  stm32, stm32f103
STM32Keyboard
No description or website provided.
Stars: ✭ 15 (-34.78%)
Mutual labels:  stm32, stm32f103
Openblt
Official read-only mirror of the SVN OpenBLT bootloader repository. Updated daily.
Stars: ✭ 256 (+1013.04%)
Mutual labels:  stm32, bootloader
stm-ILI9341-spi
STM32 ILI9341 spi
Stars: ✭ 77 (+234.78%)
Mutual labels:  stm32, stm32f103
ScopeMCU
虚拟示波器 MCU端
Stars: ✭ 59 (+156.52%)
Mutual labels:  stm32, stm32f103

STM32F103_MSD_BOOTLOADER

STM32F103 Mass Storage Device Bootloader

Device: STM32F103C8T6 (Flash size: 64KB) / STM32F103CBT6 (Flash size: 128KB)

My example:

Name STM32F103C8T6 Address STM32F103CBT6 Address
Appcode starts from: 0x0800_4000 - 0x0800_FFFF (48KB) 0x0800_4000 - 0x0801_FFFF (112KB)
(Unused) starts from: 0x0800_36E0 - 0x0800_3FFF (2.28KB) 0x0800_36E0 - 0x0800_3FFF (2.28KB)
Bootloader starts from: 0x0800_0000 - 0x0800_36DF (13.72KB) 0x0800_0000 - 0x0800_36DF (13.72KB)

Simulate a USB removable disk (FAT32).

Just drag and drop the intel hex file to update the appcode. The bootloader will automatically restart if EOF RecordType is found in the hex file. Drag and drop the BIN file is removed. Since intel hex file has the following advantages over the bin file:

  1. Most of the compiler tools support direct export to intel hex file. No need to covert to bin file anymore
  2. provides better integrity check
  3. macOS works properly because of unique format in ihex file

During power up, the bootloader will check the content of 0x0800_4000 exists or not. Hold PA0 (Connect to GND) during power up can force to enter bootloader mode.

USB Drive tested with following operating systems:

  • Windows 8
  • Windows 7
  • MacOS Sierra
  • Ubuntu 18.04
  • Windows 10

Several examples are provided in "example-hex" folder to validate the bootloader feature.

Test Procedure:

  1. Hold PA0 during power up to enter bootloader mode.
  2. A removable disk drive named "BOOTLOADER" is recognized.
  3. Ensure PA0 is released.
  4. Drag and drop STM32F103_FlashPC13LED_FAST.hex to the removable disk.
  5. Since the intel hex file contains EOF record type, the bootloader will be self-reset.
  6. The bootloader jumps to Appcode. LED (PC13) blinks.

Features currently supported:

The following features can be activated by preprocessor constant in btldr_config.h

AES256-CTR Encryption:

For more detail, please see the tools/hex-crypt folder.

CRC32 Checksum verification:

Before bootloader jumps to main application, it calculates the app's CRC32 checksum and compares it to the CRC32 calculated at build time (which is stored at end of flash). Jump to app is only performed in case of valid checksum.

  1. In btldr_config.h, set BTLDR_ACT_CksNotVld to 1.
  2. Use Keil to build the project, the bootloader size should be under 16KB (STM32_MSD_BTLDR_CRC32.hex).
  3. Execute tools/crc-calc/add_crc32.bat to generate new hex file (CRC checksum is placed at last 32bit block of Flash).

Enable Bootloader from Application

It is possible to activate the bootloader from a running main application.

*((volatile uint32_t*)0x20004ffc) = BOOTKEY;	//same BOOTKEY as defined in Bootloader

/* Pull USB D+ PIN to GND so USB Host detects device disconnect */
LL_GPIO_SetPinMode(GPIOA,LL_GPIO_PIN_12, LL_GPIO_MODE_OUTPUT);
LL_GPIO_SetPinSpeed(GPIOA, LL_GPIO_PIN_12, LL_GPIO_SPEED_FREQ_LOW);
LL_GPIO_SetPinOutputType(GPIOA,LL_GPIO_PIN_12, LL_GPIO_OUTPUT_PUSHPULL);
LL_GPIO_ResetOutputPin(GPIOA, LL_GPIO_PIN_12);

LL_mDelay(1000);

NVIC_SystemReset();

Read the appcode content in firmware.bin

In btldr_config.h, set CONFIG_READ_FLASH to 1u to read the appcode content in firmware.bin. The content in firmware.bin is mapped to appcode area. Hence, the bin file size (flash) is also 48KB / 112KB.

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].