STM32CubeProgrammer¶
Installing STM32CubeProgrammer [1]¶
Tip
The CubeProgrammer is just one (slow) way to flash our STM32 based modules. Since kirkstone release version you can also use fastboot protocol to flash a module.
For more read Fast Flashing STM32MP1 Boards
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.4.0
Download the STM32CubeProgrammer v2.4.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.4.0” as the installation directory, when it’s requested by the installer.
./SetupSTM32CubeProgrammer-2.4.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.4.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.4.0
-------------------------------------------------------------------
USB serial link¶
Install the libusb on your host computer:
sudo apt install libusb-1.0-0
To allow STM32CubeProgrammer to access the USB port through low-level commands, proceed as follows:
cd $HOME/STM32MPU_workspace/STM32MPU-Tools/STM32CubeProgrammer-2.4.0/Drivers/rules
sudo cp *.* /etc/udev/rules.d/
Flash the eMMC¶
Enable the USB-bootmode on your Development Kit. If you need help see Enabling USB-Bootmode.
Plug-in the Development Kit to power it up.
Press the reset button.
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>
Get the device port location for the USB link.
STM32_Programmer_CLI -l usb
-------------------------------------------------------------------
STM32CubeProgrammer v2.4.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
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 USB and reset your board. You eventually have to fit your U-Boot environment to let the image boot. See below.
Note
The .tsv
flashlayout documentation is available at https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout
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.
With UUU - Universal Update Utility you can do this via the script, and can ignore further steps.
Resetting the environment to default.
env default -a
saveenv
Resetting the board to get the uuid of the RootFS automatically loaded.
reset
Break into U-Boot prompt again by hitting any key.
Set correct init for systemd images:
setenv append_bootargs init=/sbin/init
saveenv
Boot the module:
boot