Git Product home page Git Product logo

bootloaderz's Introduction

Bootloader-Z

IMPORTANT: This software, as any bootloader out there, might brick your device if misused or precautions are ignored. USE AT YOUR OWN RISK.

This is a custom STM32F1xx/STM32F4xx bootloader that allows flashing firmware binaries via USB, using DFU or HID-flash protocols. The -ambitious- intention behind the project is to implmenet the intricacies of many more STM32 MCUs into a single project that can be easily downloaded, configured, compiled and flashed.

Why?

Flashing new firmware with minimal interaction with the physical board is really convenient in some cases. In my case, it was flashing my 3d printer's BTT GTR 1.0 board through my OctoPi at the press of a button (two actually, reset + LCD encoder button), which I can now trigger via RPi's GPIO and flash at will, without any manual interaction.

The project

This bootloader is a work in progress, meaning it has not been tested widely, and there is still a lot to consider on hardware compatibility. Please consider this as something experimental, until you've made sure all aspects work on your specific board.

The project was inspired by Serasidis/STM32_HID_Bootloader (which originates from bootsector/stm32-hid-bootloader) and retains compatibility with the hid-flash tool.

The project is adapted to PlatformIO (the project should build and upload as is, provided you have an ST-Link/v2 device connected). It uses the original STM32Cube framework libraries instead of containing slightly modified parts of it. DFU protocol is implemented and tested on both STM32F1xx/4xx platforms. For the moment, compatibility with the older version of HID-Flash.exe is maintained only in STM32F4xx compilation. HID-flash tool's sources are not included in the project.

Before you try this, be absolutely sure that you have a copy of the original bootloader of your board, which you have successfully flashed back to the board without problems.

Configuration

Customizing the bootloader behavior is done by modifying the Configuration.h file. See file comments for details.

Building and uploading

Use an ST-Link compatible device, properly connected to your board and the PC. Use PlatformIO's upload command to install. Resetting the board with BOOT0 pin set to 3.3V should also work, but this depends on your board and MCU (check the wiki for more info on the subject).

Using

Enable the configured trigger and reset the board (in case of pin trigger, keep the pin enabled while resetting and until the USB device appears at the host. Depneding on which protocol you have enabled (DFU or HID), use dfu-util.exe or hid-flash.exe cmd line tool to upload a firmware binary file manually, or if your firmware project is a PlatformIO project, simply configure dfu or hid as your preferred upload-protocol in the env section of your firmware's platformio.ini file, like in the following example:

#
# Bigtreetech GTR V1.0 (STM32F407IGT6 ARM Cortex-M4)
#
[env:BIGTREE_GTR_V1_0]
extends            = stm32_variant
board              = marlin_BigTree_GTR_v1
board_build.offset = 0x8000
build_flags        = ${stm32_variant.build_flags} -DSTM32F407IX
upload_protocol    = dfu

Visit the wiki for more info on flashing and using.

Future development

More triggers, more flashing methods, more STM32 MCUs / boards to support.

So far, the project has been tested on the following boards:

STM32F4XX:

  • BigTreeTech GTR 1.0 (STM32F407IGT6)

STM32F1XX:

  • HR0214-32 development board (STM32F103C8T6)

bootloaderz's People

Contributors

zeleps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bootloaderz's Issues

Error: 'USBD_MAX_POWER' undeclared here (not in a function)

Hello,

The SD card reader of my BTT GTR 1.0 board is defective. Flashing only works if you hold the card firmly pressed in. Therefore, I would like to use the alternative function via USB.

The following error occurs when compiling the bootloader:

Compiling .pio\build\genericSTM32F407VGT6\platforms\stm32f4xx\usbd_customhid.o
platforms\stm32f4xx\usbd_customhid.c:141:3: error: 'USBD_MAX_POWER' undeclared here (not in a function); did you mean 'USBD_SELF_POWERED'?
USBD_MAX_POWER, /* MaxPower 100 mA: this current is used for detecting Vbus */
^~~~~~~~~~~~~~
USBD_SELF_POWERED
*** [.pio\build\genericSTM32F407VGT6\platforms\stm32f4xx\usbd_customhid.o] Error 1

I have adjusted the configuration according to the wiki https://github.com/zeleps/BootloaderZ/wiki/Configuring-a-BTT-GTR-1.0-for-automatic-flashing.

Alternatively, is it possible to flash without the alternative bootloader via USB using boot0 on R3 (pushbutton against 3.3V // wire to pin of an RPI) using dfu-util -D [path to firmware binary]/firmware.bin --dfuse-address 0x08008000:leave ?

Thanks in advance
Bauschlumpf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.