letssteam / DapLink-EasyFlash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple DAPLink tool

Introduction

This tools is for internal usage, we use it to load daplink on target (STM32L475, STM32WB55, ...), to replace ST-LINK.

With OpenOCD, the program steps are :

  1. Unlock the RDP of the STM32F1x (if needed)
  2. Mass erase flash
  3. Flash bootloader
  4. Send firmware
  5. (optionnal) Send test program

Requirements

πŸ’» System

Linux

  • OpenOCD: sudo apt install openocd
  • Python 3.x: sudo apt install python3
  • Python3 pip: sudo apt install python3-pip

πŸ’‘ All in one: sudo apt install openocd python3 python3-pip

Windows

MacOs

Untested, but certainly identical to Linux.

🐍 Python

πŸ’‘ You can install everything (virtual env include), with the install.sh script (Linux only).

πŸ’Ύ Bootloader & Firmware

DapLink bootloaders and firmwares can be found at https://github.com/letssteam/DAPLink/releases

Usage

πŸ”Œ Hardware

To allow the program flash the DapLink bootloader, the DapLink firmware, then the test program (optional), it's important to wiring you board.

Note: Connect the target (STM32 Disco L475 IoTNode, STM32 Nucleo WB55, ...) to your computer after wiring and connecting the probe to your computer

STM32 Disco L475 IoTNode

Here are somes schematics, to show you how to plug probes to the board.

STLink V2 (or clones)

Black Magic Probe (V2.1 in this picture)

Nucleo's STLink

⚠️ Remove both jumper CN2 (orange rectangle) before flashing anything. Then replace them when you are finished.

STM32 Nucleo WB55

Soon... ;)

πŸ’» Software

The program offer a simple GUI interface to select the bootload and the firmware that will be flashed on the STM32F1x.

  1. Launch the script easy_daplink.py file (e.g python3 easy_daplink.py)
    If you're using a virtual environment, you can launch it with python in the venv/bin/ directory (for example: venv/bin/python3 easy_daplink.py), or you can start the program with start_venv.sh (Linux only).
  2. Select the script folder of OpenOCD (e.g On Linux : /usr/share/openocd/scripts/)
  3. Select files you downloaded from requirements
    1. The bootloader binary file to flash (e.g: stm32f103xb_bl.bin)
    2. The firmware binary file to flash (e.g: stm32f103xb_stm32l475vg_if.bin)
    3. (optionnal) The program binary file to flash (you can find test program in test bin folder)
  4. Set the mount point name
    1. For "Maintenance", after bootloader was flashed (e.g: MAINTENANCE)
    2. For "Programming", after firmware was flashed (e.g: DIS_L4IOT, DAPLINK, ...)
  5. Define the timeout mount point waiting (e.g: 10000), in milliseconds (1000 milliseconds = 1 second)
  6. Push the "Start" button.

πŸ’‘ Pro tips: All inputs are saved for the next time you will open the tool !

Test files

In the test bin folder, you can find some simple programs for targets.

test-l475.bin

It blinks the LEDs, LD1 and LD2, in two different patterns.

test-wb55.bin

Toggles between high and low states of pins PC10 and PC12. (The video is the result on the STeaMi board).

About


Languages

Language:Tcl 70.3%Language:Python 28.4%Language:Shell 1.2%