STM32CubeProgrammer

Installing STM32CubeProgrammer [1]

Note

The following instructions were tested on Ubuntu 16.04.

STM32CubeProgrammer requires 1.8 version of the Java platform.

sudo apt install openjdk-8-jre
sudo update-alternatives --config java

Select the java-8-openjdk configuration.

Create a directory on your computer:

mkdir $HOME/STM32MPU_workspace/STM32MPU-Tools
mkdir $HOME/STM32MPU_workspace/STM32MPU-Tools/STM32CubeProgrammer-2.2.0

Download the STM32CubeProgrammer v2.2.0 to your computer.

Uncompress the archive file to get the STM32CubeProgrammer installers:

unzip SetupSTM32CubeProgrammer.zip

Execute the Linux installer, which guides you through the installation process. Select “$HOME/STM32MPU-Tools/STM32CubeProgrammer-2.2.0” as the installation directory, when it’s requested by the installer.

./SetupSTM32CubeProgrammer-2.2.0.linux

Add the STM32CubeProgrammer binary path to your PATH environment variable. So append the ~/.bashrc with:

export PATH=$HOME/STM32MPU_workspace/STM32MPU-Tools/STM32CubeProgrammer-2.2.0/bin:$PATH

After this re-source ~/.bashrc:

source ~/.bashrc

Check that the STM32CubeProgrammer tool is properly installed and accessible:

$: STM32_Programmer_CLI --h

-------------------------------------------------------------------
                  STM32CubeProgrammer v2.2.0
-------------------------------------------------------------------

Flash the eMMC

  1. Enable the bootmode on your Development Kit. If you need help see Enabling Bootmode.
  2. Plug-in the Development Kit to power it up.
  3. Press the reset button.
  4. Go to the directory where your Images have been deployed to, or you downloaded our precompiled images to.

The following directory is an example, in this case its from a Yocto deploy.

cd $HOME/yocto/karo-bsp/tmp/deploy/images/<machine-name>
  1. Get the device port location for the USB link.
$: STM32_Programmer_CLI -l usb
   -------------------------------------------------------------------
                     STM32CubeProgrammer v2.1.0
   -------------------------------------------------------------------

=====  DFU Interface   =====

Total number of available STM32 device in DFU mode: 1

Device Index           : USB1 <--- see this
USB Bus Number         : 001
USB Address Number     : 005
Product ID             : DFU in HS Mode @Device ID /0x500, @Revision ID /0x0000
Serial number          : 0042001E3438511438333630
Firmware version       : 0x0110
Device ID              : 0x0500
  1. Program the eMMC with the images in flashlayout_<image-name>/ folder.
STM32_Programmer_CLI -c port=usb1 -w flashlayout_karo-image-weston//FlashLayout_emmc_stm32mp157c-qsmp-1570-basic.tsv

Tip

After the setup has run you can disable bootmode and reset your board. You eventually have to fit your u-boot environment to let the image boot. See below.

[1]From https://wiki.st.com/stm32mpu/index.php/Getting_started/STM32MP1_boards/STM32MP157C-DK2/Let%27s_start/Populate_the_target_and_boot_the_image

U-Boot Environment

Since we are not able to program the U-Boot environment with the STM32_Programmer_CLI, you will have to change it to boot your module.

  1. Set the correct baseboard variable:
setenv baseboard <your-baseboard>
Baseboard U-Boot String baseboard=
QSBase1 (just with QSMP-15XX) qsbase1
TX Mainboard 7 mb7
  1. Find out RootFS partition UUID:
mmc part

Copy guid from rootfs.

  1. Set RootFS partition UUID:
setenv rootpart_uuid <copied-uuid>
  1. Set correct init for systemd images:
setenv default_bootargs ${default_bootargs} init=/sbin/init
  1. Save the environment:
saveenv