cancel
Showing results for 
Search instead for 
Did you mean: 

Hi,i am a beginner in MPU development. I have created cortex-M4 firmware project using stm32cubeide , but how can i start my firmware at the time of bootup?

AGupt.8
Associate II

i have read the article, https://wiki.st.com/stm32mpu/wiki/How_to_start_the_coprocessor_from_the_bootloader#Starting_the_coprocessor_firmware

where will i find this in my device tree

#define CONFIG_EXTRA_ENV_SETTINGS \

"stdin=serial\0" \

"stdout=serial\0" \

"stderr=serial\0" \

...

BOOTENV \

"m4fw_name=rproc-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 ext4load mmc 0:4 ${m4fw_addr} ${m4fw_name} ; then run boot_m4fw; fi;\0"

"bootcmd=run boot_m4_mmc0; run bootcmd_mmc0\0"

13 REPLIES 13
Cindy_GE
ST Employee

Hi,

You should add these line

"m4fw_name=rproc-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 ext4load mmc 0:4 ${m4fw_addr} ${m4fw_name} ; then run boot_m4fw; fi;\0"

"bootcmd=run boot_m4_mmc0; run bootcmd_mmc0\0"

into <U-boot source code>/include/configs/stm32mp1.h, then re-compile/flash U-boot, bot the device tree.

AGupt.8
Associate II

a

#define CONFIG_EXTRA_ENV_SETTINGS \

   "kernel_addr_r=0xc2000000\0" \

   "fdt_addr_r=0xc4000000\0" \

   "scriptaddr=0xc4100000\0" \

   "pxefile_addr_r=0xc4200000\0" \

   "splashimage=0xc4300000\0" \

   "ramdisk_addr_r=0xc4400000\0" \

   "altbootcmd=run bootcmd\0" \

   "env_check=if env info -p -d -q; then env save; fi\0" \

   STM32MP_BOOTCMD \

   BOOTENV \

       "m4fw_name=rproc-m4-fw_CM4.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 ext4load mmc 0:4 ${m4fw_addr} ${m4fw_name} ; then run boot_m4fw; fi;\0"

       "bootcmd=run boot_m4_mmc0; run bootcmd_mmc0\0"

i copied this in u-boot/include/configs/stm32mp1.h and tried compiling, but i am getting the below error

include/configs/stm32mp1.h:165:9: error: expected identifier or ‘(’ before string constant

 165 |        "bootcmd=run boot_m4_mmc0; run bootcmd_mmc0\0"

     |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

scripts/Makefile.build:155: recipe for target 'lib/asm-offsets.s' failed

make[1]: *** [lib/asm-offsets.s] Error 1

Makefile:1837: recipe for target 'prepare0' failed

make: *** [prepare0] Error 2

There should be one "\" ate the end of ​

 "boot_m4_mmc0=if ext4load mmc 0:4 ${m4fw_addr} ${m4fw_name} ; then run boot_m4fw; fi;\0" \

Hi, it solved my compilation issue.And it generated the following files,

  1. u-boot (executable) file
  2. u-boot.bin
  3. u-boot.cfg
  4. u-boot.cfg.configs
  5. u-boot.dtb
  6. u-boot.lds
  7. u-boot.map
  8. u-boot.srec
  9. u-boot.sym
  10. u-boot-dtb.bin
  11. u-boot-nodtb.bin

But as i am new to MPU development, i don't know what to do next and what steps do i follow next?

Do i need to replace the files in u-boot directory in starter package with these files, and populate the board again OR Do i need to replace the files generated by stm32cubeide(image attached) with these files.

  1. First you need to check the starter package version you used, if you use v2.x or v1.x, you should replace <starter_package_patch>/.../bootloader/u-boot-stm32mp177x-dkx-trusted.stm32 with u-boot.stm32 (generated), but looks, you don't have it in you list, so I guess you are using v3.0, which FIP package is used, this version is a little complex, you need more step to do this. so I suggest you to change to v2.x to start learning.
  2. If you change/check the version you used is v2.x, check out corresponding u-boot version, then recompile to get u-boot.stm32.
  3. Replace <starter_package_patch>/.../bootloader/u-boot-stm32mp177x-dkx-trusted.stm32 with u-boot.stm32 (generated).
  4. copy a tsv file like FlashLayout_sdcard_stm32mp157c-dk2-trusted.tsv, re-name to FlashLayout_sdcard_stm32mp157c-dk2-trusted-test.tsv, then modify the u-boot file with correct name, like:

PD 0x06 ssbl Binary mmc0 0x00084400 bootloader/u-boot.stm32

then re-flash the board.

The cubeIDE generated files only the dtb file, are not useful.

i am extremely sorry but i didn't understood this part

" PD 0x06 ssbl Binary mmc0 0x00084400 bootloader/u-boot.stm32

then re-flash the board.

The cubeIDE generated files only the dtb file, are not useful."

is there any video which shows step by step process to start the coprocessor from bootloader?

what are you using to flash the board? and how do you compile the u-boot image, with CubeIDE?