Giter Site home page Giter Site logo

stm32-uart-dfu's Introduction

stm32-uart-dfu

Simple command-line tool that works with stm32 microcontrollers uart bootloader.

Installing dependencies and usage:

To install python and dependencies you can use pyenv and poetry (pyenv-virtualenv plugin for virtual environment):

poetry install

Or, alternatively, just run:

pip install -r requirements.txt

Usage

Available dfu operations:

  • id: prints mcu id (2 bytes)
  • run: MCU jumps at specified address
  • erase: erase specified size of memory at address
  • dump: dump specified size of memory from address to a file
  • load: load binary file to memory at address.

To get all available commands:

python3 -m stm32_uart_dfu --help

To get specific command help:

python3 -m stm32_uart_dfu load --help

Example:

python3 -m stm32_uart_dfu --port /dev/ttyUSB0 load --file firmware.bin --erase -m map.json

Memory map file:

Memory map file contains mcu's flash memory sectors information (address, size). Table with flash memory organization can be found in reference manual in embedded flash memory section. Json file with memory map example for stm32f407 can be found in memory_map directory. Basically this file contains list of dicts like that:

[
  {
    "address": "0x8000000",
    "size": "0x4000"
  },
  {
    "address": "0x8004000",
    "size": "0x4000"
  },
  ...
]

Without memory map only mass erase is available.

stm32-uart-dfu's People

Contributors

abcdeath avatar dferrarigrowtech avatar gised-link avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

stm32-uart-dfu's Issues

Program does not start after programming

Hello and thank you for this well written utility!
I succesfully managed to flash my MCU with this utility. Here's the command and the output:

python3.9 -m stm32_uart_dfu --port /dev/ttyTHS1 load --file blink.elf --erase -m memory_map/stm32f446re.json --run
Erasing 139936 bytes from 0x8000000...
[████████████████████████████████████████] done.
Loading blink.elf (139936 bytes) at 0x8000000
[████████████████████████████████████████] done.
Validating firmware...
[████████████████████████████████████████] done.
Success!
MCU will be running from 0x8000000.

After that I set BOOT0 to LOW and clicked on the reset button. But unfortunately the MCU does nothing (it seems that the program is not flashed)

WIth STM32cube programmer I noticed som differences between the flashed memory content (first image) and the program (second image)

immagine
immagine

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.