cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP1 - How to start the coprocessor from the bootloader

mjuels
Associate III
I am working on a STM32MP157D-DK1 board, and I am trying to follow the guide from the wiki to start the coprocessor from u-boot:
 
I have pulled the u-boot source code:
devtool modify u-boot-stm32mp
 
 
And modified include/configs/stm32mp15_st_common.h to contain:
 
#define CONFIG_EXTRA_ENV_SETTINGS \
STM32MP_MEM_LAYOUT \
STM32MP_BOOTCMD \
STM32MP_PARTS_DEFAULT \
BOOTENV \
"m4fw_name=my-m4-fw.elf\0" \
  "m4fw_addr=${kernel_addr_r}\0" \
"boot_m4fw=rproc init; rproc load 0 ${m4fw_addr} ${filesize}; rproc start 0\0" \
  "boot_m4_mmc0=if load mmc 0#bootfs ${m4fw_addr} ${m4fw_name} ; then run boot_m4fw; fi;\0"\
  "bootcmd=echo \"Loading the firmware!\"; echo \"ELF files is: ${m4fw_name}\"; run boot_m4_mmc0; run bootcmd_mmc0\0"
 
I have rebuild the distribution as:
bitbake st-image-weston
 
(No issues or erros)
 
and uploaded all image files via CubeProgrammer using the FlashLayout_sdcard_stm32mp157d-dk1-optee.tsv file.
 
I have copied the my-m4-fw.elf to the bootfs partition, but when u-boot launches and I type in:
STM32MP> env print bootcmd 
 
I still get:
bootcmd=run bootcmd_stm32mp
 
instead of the command I manually configured from the wiki example.
 
What am I doing wrong?
1 ACCEPTED SOLUTION

Accepted Solutions

Thank you so much for the reply - Although very silly, your first suggestion turned out to help; I had confused "stm32mp15_st_common.h" with "stm32mp15_common.h" and edited the wrong one.

I still have problems, but I will add them in a separate post to stay on topic.

Thank you.

View solution in original post

2 REPLIES 2
higgs147
Associate II

It appears that your modification to the U-Boot environment settings is not taking effect when U-Boot is launched. To troubleshoot this issue, you can follow these steps:

  1. Double-check your modifications: Make sure you have saved your changes to the include/configs/stm32mp15_st_common.h file after adding the CONFIG_EXTRA_ENV_SETTINGS lines. Sometimes, changes might not be saved properly.

  2. Rebuild U-Boot: After making changes to the U-Boot configuration, you should rebuild U-Boot to incorporate your modifications. You mentioned that you rebuilt the distribution (st-image-weston), but it's essential to ensure that U-Boot itself is rebuilt with your custom configuration. You can rebuild U-Boot by running the following command in your Yocto build environment:

    Copy code
    bitbake u-boot-stm32mp

    This command will rebuild U-Boot with your custom environment settings.

  3. Flash the modified U-Boot image: After rebuilding U-Boot, make sure that you flash the updated U-Boot image to the appropriate location on your STM32MP157D-DK1 board.

  4. Confirm the environment variables: After flashing the updated U-Boot image, reboot your board and enter U-Boot. Then, check the environment variables to ensure that your changes are reflected:

    shellCopy code
    STM32MP> printenv

    This will display the current U-Boot environment variables, including bootcmd. Verify that your custom bootcmd is set correctly.

  5. Save the environment: If you see that your custom bootcmd is correct but not taking effect, you may need to save the environment changes. You can do this by running the following command in U-Boot:

    shellCopy code
    STM32MP> saveenv

    This command will save the current environment settings to non-volatile storage so that they persist across reboots.

  6. Reboot the board: After saving the environment, you can reboot the board and see if your custom bootcmd is executed as expected.

If you follow these steps carefully and ensure that your custom bootcmd is set correctly in the U-Boot environment, it should work as intended. Make sure to double-check the U-Boot image's flash location and that your changes are saved correctly to the U-Boot environment

Thank you so much for the reply - Although very silly, your first suggestion turned out to help; I had confused "stm32mp15_st_common.h" with "stm32mp15_common.h" and edited the wrong one.

I still have problems, but I will add them in a separate post to stay on topic.

Thank you.