Page 1 of 1

New All-in-one STM32CubeProg

Posted: Wed Jan 03, 2018 3:55 pm
by Rick Kimball ... n4005.html

New All-in-one Software Tool from STMicroelectronics Makes STM32 Microcontroller Programming More User-Friendly

Geneva / 21 Dec 2017

STMicroelectronics’ STM32CubeProgrammer (STM32CUBEPROG) software tool delivers device-programming and firmware upgrade for STM32 microcontrollers in a unified, multi-platform, and user-configurable environment. New All-in-one Software Tool from STMicroelectronics Makes STM32 Microcontroller Programming More User-Friendly 
Ready to run on Windows®, Linux, or MacOS® operating systems, the STM32CubeProgrammer can program the STM32 microcontroller’s on-chip Flash/RAM or external memories using various file formats. Further capabilities include whole-memory or sector erase and programming microcontroller option bytes. Users can also generate encrypted files for secure programming (Secure Firmware Install/Update) to authenticate production and protect intellectual property.

With this universal tool, users can program STM32 microcontrollers through the device’s SWD (Single-Wire Debug) or JTAG debugging ports, or the bootloader ports (such as UART and USB). Hence the STM32CubeProgrammer brings the individual capabilities of the ST Visual Programmer, DFUse Device Firmware Update tool, Flash Loader, and ST-Link utility together within the STM32Cube ecosystem. ST will extend the STM32CubeProgrammer’s capabilities by adding programming access via microcontroller I2C and CAN ports.

Furthermore, the STM32CubeProgrammer provides many opportunities to customize and configure features, using either the Graphical User Interface (GUI) or the Command-Line Interface (CLI). Also, this all-in-one tool can be used in standalone mode or integrated and controlled from a custom application. Programming can be done manually or automated using scripts.

For more information, or to download the STM32CubeProgrammer free of charge, please visit

Re: New All-in-one STM32CubeProg

Posted: Wed Jan 03, 2018 6:55 pm
by stevestrong
Can this handle the F4 ROM USB DFU bootloader?

Re: New All-in-one STM32CubeProg

Posted: Wed Jan 03, 2018 7:08 pm
by Rick Kimball
Sounds like you should give it a spin and see @stevestrong

Re: New All-in-one STM32CubeProg

Posted: Fri Jan 05, 2018 6:23 am
by eggsylah
By coincidence I had downloaded this on Tuesday because I had hoped it included an SWO viewer that I could use under Linux -- sadly it doesn't appear to.

It works fine with OpenJDK on my Fedora 27 laptop using OpenJDK. The only catch was needing to install openjfx -- otherwise you get cryptic errors.

I have used it to update the ST-Link firmware on a few nucleo boards (F401, L432, L475).

I also just tried the DFU bootloader and it works well -- I was able to successfully load micropython on 2 different F407 boards. So that may be nice for the new F4 boards that are being developed here.

I still prefer flashing from a makefile or gdb but the command line version wasn't bad.
Here is the console output for a download of micropython:

Code: Select all

[eric@maxwell build-VCC_GND_F407]$ ~/STM32Cube/STM32CubeProgrammer/bin/ --connect port=usb1 -w firmware.elf 
                        STM32CubeProgrammer v1.0.0                  

USB speed              : Full Speed (12MBit/s)
Manufacturer ID        : STMicroelectronics
Product ID             : STM32  BOOTLOADER
Serial number          : 3575378E3335
Firmware version       : 0x011a
Device ID              : 0x0413
   AREA NAME          SECT.NBR        ADDRESS         SIZE         TYPE
   Internal Flash       0000          0x08000000      0016 KB      REW
                        0001          0x08004000      0016 KB      REW
                        0002          0x08008000      0016 KB      REW
                        0003          0x0800c000      0016 KB      REW
                        0004          0x08010000      0064 KB      REW
                        0005          0x08020000      0128 KB      REW
                        0006          0x08040000      0128 KB      REW
                        0007          0x08060000      0128 KB      REW
                        0008          0x08080000      0128 KB      REW
                        0009          0x080a0000      0128 KB      REW
                        0010          0x080c0000      0128 KB      REW
                        0011          0x080e0000      0128 KB      REW

   Option Bytes         0000          0x1fffc000      0016 B       RW

   OTP Memory           0000          0x1fff7800      0512 B       RW
                        0001          0x1fff7a00      0016 B       RW

   Device Feature       0000          0xffff0000      0004 B       RW

Device name:  STM32F405xx/F407xx/F415xx/F417xx
Device type:  MCU
Device CPU :  Cortex_M4

Memory Programming ...
Openeing and parsing file: firmware.elf
  File          : firmware.elf
  Size          : 322612 Bytes
  Address       : 0x08000000 

Erasing memory corresponding to segment 0:
Erasing internal memory sector 0
erasing sector 0000 @: 0x08000000 done
Erasing memory corresponding to segment 1:
Erasing internal memory sectors [5 7]
erasing sector 0005 @: 0x08020000 done
erasing sector 0006 @: 0x08040000 done
erasing sector 0007 @: 0x08060000 done
Download in Progress:
[==================================================] 100% 

File download complete
Time elapsed during the download operation is: 00:00:12.832


Re: New All-in-one STM32CubeProg

Posted: Fri Jan 05, 2018 9:16 am
by stevestrong
12.832 seconds? Hmm. This isn't too fast, is it?

Re: New All-in-one STM32CubeProg

Posted: Mon Jan 08, 2018 6:08 am
by eggsylah
Yes it could be faster but it is programming 308K!
As usual with flash it is the erase time that slows things down.

I tried loading the same data with J-Link and it took around 7s.
The original micropython makefile uses a python script which took 22s.
Using gdb and a BMP clone took almost 18s.

So I think the DFU time of 12s is ok and will be good to use on the F405/F411 board being designed.

Details below



Code: Select all

[eric@maxwell stm32]$ time make BOARD=BLACK_F407VE deploy
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Writing build-BLACK_F407VE/firmware.dfu to the board
File: build-BLACK_F407VE/firmware.dfu
    DfuSe v1, image size: 314553, targets: 1
    Target 0, alt setting: 0, name: "ST...", size: 314268, elements: 2
      0, address: 0x08000000, size: 14920
      1, address: 0x08020000, size: 299332
    usb: 0483:df11, device: 0x0000, dfu: 0x011a, UFD, 16, 0x6414b0d4
Writing memory...
0x08000000   14920 [=========================] 100%
0x08020000  299332 [=========================] 100%
Exiting DFU...

real    0m22.453s
user    0m4.252s
sys     0m0.891s
J-Link EDU

Code: Select all

eric@maxwell build-BLACK_F407VE]$ JLinkExe -Device STM32F407VE -If SWD
SEGGER J-Link Commander V6.22d (Compiled Dec 14 2017 18:34:26)
DLL version V6.22d, compiled Dec 14 2017 18:34:21

Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Dec 12 2017 16:37:47
Hardware version: V10.10
S/N: 260100168
License(s): FlashBP, GDB
VTref = 3.307V

Type "connect" to establish a target connection, '?' for help
Specify target interface speed [kHz]. <Default>: 4000 kHz
Device "STM32F407VE" selected.

Connecting to target via SWD
Found SW-DP with ID 0x2BA01477
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
Cortex-M4 identified.
J-Link>loadfile firmware0.bin 0x8000000
Downloading file [firmware0.bin]...
Comparing flash   [100%] Done.
Erasing flash     [100%] Done.
Programming flash [100%] Done.
Verifying flash   [100%] Done.
J-Link: Flash download: Bank 0 @ 0x08000000: 1 range affected (16384 bytes)
J-Link: Flash download: Total time needed: 0.450s (Prepare: 0.017s, Compare: 0.001s, Erase: 0.352s, Program: 0.074s, Verify: 0.000s, Restore: 0.004s)
J-Link>loadfile firmware1.bin 0x8020000
Downloading file [firmware1.bin]...
Comparing flash   [100%] Done.
Erasing flash     [100%] Done.
Programming flash [100%] Done.
Verifying flash   [100%] Done.
J-Link: Flash download: Bank 0 @ 0x08000000: 1 range affected (393216 bytes)
J-Link: Flash download: Total time needed: 6.805s (Prepare: 0.051s, Compare: 0.005s, Erase: 5.634s, Program: 1.068s, Verify: 0.007s, Restore: 0.038s)
GDB with Black Magic Probe (on a Baite ST-Link V2)

Code: Select all

[eric@maxwell build-BLACK_F407VE]$ time arm-none-eabi-gdb firmware.elf -ex "set confirm off" -ex "target extended-remote /dev/ttyBMP" -ex "monitor swdp_scan" -ex "attach 1" -ex "set confirm off" -ex "load" -ex "quit"
GNU gdb (GNU Tools for ARM Embedded Processors)
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from firmware.elf...(no debugging symbols found)...done.
Remote debugging using /dev/ttyBMP
Target voltage: unknown
Available Targets:
No. Att Driver
 1      STM32F4xx
Attaching to program: /home/eric/projects/micropython/micropython/ports/stm32/build-BLACK_F407VE/firmware.elf, Remote target
0x080423b0 in SysTick_Handler ()
Loading section .isr_vector, size 0x3a48 lma 0x8000000
Loading section .text, size 0x49120 lma 0x8020000
Loading section .data, size 0x24 lma 0x8069120
Start address 0x804a908, load size 314252
Transfer rate: 17 KB/sec, 969 bytes/write.
Detaching from program: /home/eric/projects/micropython/micropython/ports/stm32/build-BLACK_F407VE/firmware.elf, Remote target

real    0m17.751s
user    0m0.048s
sys     0m0.031s