Skip to main content
Visitor II
July 13, 2021
Solved

What steps to follow after full erase using STM32CubeProgrammer?

  • July 13, 2021
  • 1 reply
  • 2693 views

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

    This topic has been closed for replies.
    Best answer by PatrickF

    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.

    1 reply

    Visitor II
    July 13, 2021

    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!

    Technical Moderator
    July 13, 2021

    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,