PanGuBoard DevelopmentKit

Usually when the system development is completed or tested, the compiled new version of U-Boot, Linux kernel and file system need to be written into the Flash memory chip, which we call system update. PanGu development board provides two methods for system update, USB method and SD card method.
The PanGu board supports multiple boot modes and device boot options, which are controlled by SW1. The SW1 is a three-bit DIP switch, which can be selected to start from one of QSPI Flash, eMMC, and SD devices.
The PanGu \ board selects the working mode of the STM32MP157 chip through the Boot Switch (SW1) dial switch.

Boot ModeBit1Bit2Bit3
Micro SD CardONOFFON
eMMCOFFONOFF
QSPI FlashONOFFOFF
USB updateOFFOFFOFF

SDCard Update

The PanGu board support programming Linux system by Micro SD.

Create update system on SDCard
Linux System
Use below command write PanGu-sdcard-basic-i2som-image-weston.raw.gz into Micro SD Card.

gzip -dc PanGu-SDCardUpdate-qt5-20190719200733.img.gz | sudo dd of=/dev/sdb conv=fsync status=progress

Windows system use USB Image Tool flash that file into Micro SD Card.
The switching device startup mode (SW1) is the Micro SD startup mode. After the power is connected, the PanGu board will start from the system of the Micro SD card and automatically complete the update operation. After the update is successful, the LED D17 will be always on. If it fails, LEDs D16 and D17 will go out.

 

USB Update

The PanGu development board uses USB to update the system to the onboard eMMC memory. When updating, use the STM32CubeProg software tool.
Although STM32CubeProg has a graphical interface, it also supports the command line to program.

Install STM32CubeProg programming tool

Download the STM32CubeProg software in the PanGu directory, extract it and install it.

$ cd $HOME/PanGu
$ mkdir STM32CubeProgrammer
$ cd STM32CubeProgrammer
$ unzip SetupSTM32CubeProgrammer.zip
$ ./SetupSTM32CubeProgrammer-2.0.0.linux

Then follow the prompts to select the installation, the default installation in the current user's home directory,, $HOME/STMicroelectronics/STM32Cube/STM32CubeProgrammer。
For ease of use, you can configure the STM32CubeProgrammer program directory as a PATH variable.

$ export PATH=$PATH:$HOME/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin

You can check the version to confirm that the configuration is configured correctly.

$ STM32_Programmer_CLI --version
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.0.0
      -------------------------------------------------------------------

STM32CubeProgrammer version: 2.0.0

The version shown here is 2.0.0, indicating that the PATH is configured correctly.

Linux下由于USB设备权限的原因,需要配置下udev,STM32CubeProgrammer里面有udev配置文件,可以让系统允许普通模式访问PanGu的USB烧写模式。
Under Linux, due to the permissions of the USB device, udev needs to be configured. The STM32CubeProgrammer has a udev configuration file, which allows the system to allow Pan mode to access PanGu's USB programming mode.

sudo cp $HOME/STMicroelectronics/STM32Cube/STM32CubeProgrammer/Drivers/rules/50-usb-conf.rules /etc/udev/rules.d/
sudo service udev restart

Programming under Linux

 

The following is an example of burning under Linux. The program name of Windows is STM32_Programmer_CLI.exe.
Before programming, you need to switch the device startup mode of the PanGu board to USB update mode.
Check if the USB device recognizes normal.

$ STM32_Programmer_CLI -l usb
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.0.0
      -------------------------------------------------------------------

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

Total number of available STM32 device in DFU mode: 1

  Device Index           : USB1
  USB Bus Number         : 001
  USB Address Number     : 001
  Product ID             : DFU in HS Mode @Device ID /0x500, @Revision ID /0x0000
  Serial number          : 003B00323438510238333630
  Firmware version       : 0x0110
  Device ID              : 0x0500

Then, using the provided programming package, execute the programming command and wait for the programming to complete.

STM32_Programmer_CLI -c port=usb1 -w flashlayout_i2som-image-weston/FlashLayout_emmc_stm32mp157a-panguboard-basic.tsv

烧写完成后,切换设备启动模式(SW1)为eMMC方式,重新上电后,PanGu开发板就从板载的eMMC存储器启动了。
After the programming is completed, the device startup mode (SW1) is switched to the eMMC mode. After power-on, the PanGu development board is booted from the onboard eMMC memory.

Programming under macOS

 

/Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/MacOs/bin/STM32_Programmer_CLI -c port=usb1 -w flashlayout_i2som-image-weston/FlashLayout_emmc_stm32mp157a-panguboard-basic.tsv

The partition structure of eMMC is as follows:

Partition nameeMMC partPartition FormatDescription
fsbl1mmcblk1boot0RAWu-boot-spl.stm32
fsbl2mmcblk1boot1RAWu-boot-spl.stm32
ssblmmcblk1RAWu-boot.img
bootfsmmcblk1p4Ext4bootfs.ext4
vendorfsmmcblk1p5Ext4vendorfs.ext4
rootfsmmcblk1p6Ext4rootfs.ext4
userfsmmcblk1p7Ext4userfs.ext4

Programming principle

USB烧写时,使用的配置文件是flashlayout_i2som-image-weston/FlashLayout_emmc_stm32mp157a-panguboard-basic.tsv。配置文件中规定了烧写文件和设备分区地址信息。配置文件内容如下:
When USB is written, the configuration file used is flashlayout_i2som-image-weston/FlashLayout_emmc_stm32mp157a-panguboard-basic.tsv. The configuration file specifies the programming file and device partition address information. The contents of the configuration file are as follows:

#Opt    Id  Name    Type    IP  Offset  Binary
-   0x01    fsbl1-boot  Binary  none    0x0 tf-a-stm32mp157a-panguboard-trusted.stm32
-   0x03    ssbl-boot   Binary  none    0x0 u-boot-stm32mp157a-panguboard-trusted.stm32
P   0x04    fsbl1   Binary  mmc1    boot1   u-boot-spl.stm32-stm32mp157a-panguboard-basic
P   0x05    fsbl2   Binary  mmc1    boot2   u-boot-spl.stm32-stm32mp157a-panguboard-basic
P   0x06    ssbl    Binary  mmc1    0x00080000  u-boot-stm32mp157a-panguboard-basic.img
P   0x21    bootfs  System  mmc1    0x00280000  st-image-bootfs-openstlinux-weston-pangu-20190722120938.bootfs.ext4
P   0x22    vendorfs    FileSystem  mmc1    0x04280000  st-image-vendorfs-openstlinux-weston-pangu-20190722120938.vendorfs.ext4
P   0x23    rootfs  FileSystem  mmc1    0x05280000  i2som-image-weston-openstlinux-weston-pangu-20190722120938.rootfs.ext4
P   0x24    userfs  FileSystem  mmc1    0x34100000  st-image-userfs-openstlinux-weston-pangu-20190722120938.userfs.ext4

配置文件共有7列,Binary代表目标烧写文件,对应的文件如下:
There are 7 columns in the configuration file. Binary represents the target burning file. The corresponding files are as follows:

File nameDescriptionReplacement instructions
u-boot-spl.stm32-stm32mp157a-panguboard-basicU-Boot SPLU-Boot has modify or recompile
u-boot-stm32mp157a-panguboard-basic.imgU-Boot imageU-Boot has modify or recompile
st-image-bootfs-openstlinux-weston-pangu-20190722120938.bootfs.ext4Store kernel image, DeviceTree fileYocto build
st-image-vendorfs-openstlinux-weston-pangu-20190722120938.vendorfs.ext4Store third-party libraries filesYocto build
i2som-image-weston-openstlinux-weston-pangu-20190722120938.rootfs.ext4The rootfs of i2som-image-weston systemYocto build
st-image-userfs-openstlinux-weston-pangu-20190722120938.userfs.ext4Store user applicationYocto build