cancel
Showing results for 
Search instead for 
Did you mean: 

What steps to follow after full erase using STM32CubeProgrammer?

Arnas Celkys
Associate II

If I want to fully erase eval board STM32MP15F and then re-populate it back to its original out-of-the-box state. Is it enough to upload the flash layout from:

en.FLASH-stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31.tar_v3.0\stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31\images\stm32mp1\flashlayout_st-image-weston\trusted

and reboot the board? Or are there any other steps I should follow?

Best regards, Arnas

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

for STM32MP family, we did not talk about 'chip' erase (as for MCUs with embedded Flash) but 'Flash' erase (Flash is external to the chip).

It is usually not needed using the provided Flashlayout.

Anyway, if you really want to erase the memory before flashing, one way to acheive this is to replace the 'P' options in the existing flashlayout by 'PD'.

e.g. for EV1 board, Trusted Starter Package on SD-Card:

#Opt	Id	Name	Type	IP	Offset	Binary
-	0x01	fsbl1-boot	Binary	none	0x0	arm-trusted-firmware/tf-a-stm32mp157f-ev1-usb.stm32
-	0x03	fip-boot	Binary	none	0x0	fip/fip-stm32mp157f-ev1-trusted.bin
PD	0x04	fsbl1	Binary	mmc0	0x00004400	arm-trusted-firmware/tf-a-stm32mp157f-ev1-sdcard.stm32
PD	0x05	fsbl2	Binary	mmc0	0x00044400	arm-trusted-firmware/tf-a-stm32mp157f-ev1-sdcard.stm32
PD	0x06	fip	Binary	mmc0	0x00084400	fip/fip-stm32mp157f-ev1-trusted.bin
PD	0x10	boot	System	mmc0	0x00484400	st-image-bootfs-openstlinux-weston-stm32mp1.ext4
PD	0x11	vendorfs	FileSystem	mmc0	0x04484400	st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
PD	0x12	rootfs	FileSystem	mmc0	0x05484400	st-image-weston-openstlinux-weston-stm32mp1.ext4
PD	0x13	userfs	FileSystem	mmc0	0x33E84400	st-image-userfs-openstlinux-weston-stm32mp1.ext4

But as Flash erasing take long time (especially the big userfs partition), in order to avoid timeout with CubeProgrammer GUI (fixed timeout), you should use STM32_Programmer_CLI (same functionality but on command line) and add '-tm 120000' to increase the timeout to allow the erase sequence to complete (here 120 seconds is enough for a 16GB SD-Card).

e.g. on Windows 10, for EV1 board, Trusted Starter Package on SD-Card:

STM32_Programmer_CLI.exe -c port=usb1 -w flashlayout_st-image-weston\trusted\FlashLayout_sdcard_stm32mp157f-ev1-trusted.tsv -tm 120000 

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

7 REPLIES 7
PatrickF
ST Employee

Hi,

to Flash Starter Package to STM32MP157F-DK2 board, see https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-DK2/Let's_start/Populate_the_target_and_boot_the_image

(similarly for STM32MP157F-EV1 board: https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-EV1/Let%27s_start/Populate_the_target_and_boot_the_image_

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks, Patrick, my question was a bit dummy one, i just was confused, why can I upload both the flashlayout_st-image-weston/trusted AND flashlayout_st-image-weston/optee ? Does the /trusted file content will not set everything ?

Thanks!

Hi,

On a product, usually only one Flashlayout is used. All provided Flashlayout flash everything to have a working Starter Package.

I agree that during evaluations, you could try one flashlayout and later another flashlayout.

I cannot guarantee that there is no side effect using many different flashlayout in sequence, but I think it has been designed to work in such a way (e.g. there is a PD to fully erase FIP partition before flashing, see https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout#SD_card_with_FIP).

Regards,

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks, Patrick,

If i got it correctly, when using the STM32CubeProgrammer we should always follow:

step 1: full chip erase

step 2: use ***/flashlayout_st-image-weston/trusted directory to pin point the flash layout

There should be no issues.

ahh also small issue the STM32CubeProgrammer does NOT support full chip erase for smt32mp1 familly

Hi,

for STM32MP family, we did not talk about 'chip' erase (as for MCUs with embedded Flash) but 'Flash' erase (Flash is external to the chip).

It is usually not needed using the provided Flashlayout.

Anyway, if you really want to erase the memory before flashing, one way to acheive this is to replace the 'P' options in the existing flashlayout by 'PD'.

e.g. for EV1 board, Trusted Starter Package on SD-Card:

#Opt	Id	Name	Type	IP	Offset	Binary
-	0x01	fsbl1-boot	Binary	none	0x0	arm-trusted-firmware/tf-a-stm32mp157f-ev1-usb.stm32
-	0x03	fip-boot	Binary	none	0x0	fip/fip-stm32mp157f-ev1-trusted.bin
PD	0x04	fsbl1	Binary	mmc0	0x00004400	arm-trusted-firmware/tf-a-stm32mp157f-ev1-sdcard.stm32
PD	0x05	fsbl2	Binary	mmc0	0x00044400	arm-trusted-firmware/tf-a-stm32mp157f-ev1-sdcard.stm32
PD	0x06	fip	Binary	mmc0	0x00084400	fip/fip-stm32mp157f-ev1-trusted.bin
PD	0x10	boot	System	mmc0	0x00484400	st-image-bootfs-openstlinux-weston-stm32mp1.ext4
PD	0x11	vendorfs	FileSystem	mmc0	0x04484400	st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
PD	0x12	rootfs	FileSystem	mmc0	0x05484400	st-image-weston-openstlinux-weston-stm32mp1.ext4
PD	0x13	userfs	FileSystem	mmc0	0x33E84400	st-image-userfs-openstlinux-weston-stm32mp1.ext4

But as Flash erasing take long time (especially the big userfs partition), in order to avoid timeout with CubeProgrammer GUI (fixed timeout), you should use STM32_Programmer_CLI (same functionality but on command line) and add '-tm 120000' to increase the timeout to allow the erase sequence to complete (here 120 seconds is enough for a 16GB SD-Card).

e.g. on Windows 10, for EV1 board, Trusted Starter Package on SD-Card:

STM32_Programmer_CLI.exe -c port=usb1 -w flashlayout_st-image-weston\trusted\FlashLayout_sdcard_stm32mp157f-ev1-trusted.tsv -tm 120000 

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks, will try that!