Skip to main content
Visitor II
January 27, 2023
Question

Start M4 firmware automatically

  • January 27, 2023
  • 3 replies
  • 1446 views

Hi!

I am using STM32MP157C-DK2 and i want to start the coprocessor from bootloader (I have readed the wiki page). First, I have done it manually and everithing works fine:

  • I have changed kernel m4_rproc:
&m4_rproc{
	/*Restriction: "memory-region" property is not managed - please to use User-Section if needed*/
	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
	mbox-names = "vq0", "vq1", "shutdown";
	status = "okay";
 
	/* USER CODE BEGIN m4_rproc */
	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
			<&vdev0vring1>, <&vdev0buffer>, <&mcu_rsc_table>;
	interrupt-parent = <&exti>;
	interrupts = <68 1>;
	wakeup-source;
	st,auto-boot = <1>;
	/* USER CODE END m4_rproc */
 
	m4_system_resources{
		status = "okay";
 
		/* USER CODE BEGIN m4_system_resources */
		/* USER CODE END m4_system_resources */
	};
};
  • I have loaded the firmware and run bootcmd:
load mmc 0#bootfs 0xc2000000 core_communication_new_CM4.elf
rproc init
rproc load 0 0xc2000000 2827764
rproc start 0
run bootcmd

With this, I was able to start the coprocessor firmware.

Now, I want to do it automatically: every time the board boots I want the coprocessor firmware to start. I have read on the wiki page and edited the stm32mp15_st_common.h file:

#define CONFIG_EXTRA_ENV_SETTINGS \
	STM32MP_MEM_LAYOUT \
	STM32MP_BOOTCMD \
	STM32MP_PARTS_DEFAULT \
	BOOTENV \
	"m4fw_name=rproc-m4-fw.elf\0" \
 "m4fw_addr=0xc2000000\0" \
	"boot_m4fw=rproc init; rproc load 0 0xc2000000 2827764; rproc start 0\0" \
 "boot_m4_mmc0=if load mmc 0#bootfs 0xc2000000 core_communication_new_CM4.elf ; then run boot_m4fw; fi;\0" \
 "bootcmd=run boot_m4_mmc0; run bootcmd_mmc0\0"
	STM32MP_EXTRA \
	STM32MP_BOARD_EXTRA_ENV

But now, I do not know how to go on. ¿How can I compile it and get it on the board?

Thanks!

https://wiki.st.com/stm32mpu/wiki/How_to_start_the_coprocessor_from_the_bootloader

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    January 27, 2023

    Hello @JIrao.1​ ,

    In the wiki link you target, it is also mentioned that you have to recompile U-Boot after your modification.

    Please find below 2 links that will help you to do it:

    I hope that this information will help you.

    Kind regards,

    Erwan.

    JIrao.1Author
    Visitor II
    January 31, 2023

    Hi @Erwan SZYMANSKI​ thanks for your reply! :beaming_face_with_smiling_eyes:

    I have read and followed the steps of the wiki page (how to cross compile with the distribution package):

    • I have created fip-stm32mp157c-core_communication_new-mx-trusted.bin file with the above settings.
    • I then copied the binary to the sda5 dedicated partition:

    0693W00000Y9aCvQAJ.jpg

    • Finally, I have rebooted the board but the M4 firmware does not boot.

    I do not know if the ${kernel_addr_r} is not correctly asigned or I have forgotten some step.

    Can you help me?

    Thanks!

    Technical Moderator
    February 1, 2023

    Hello @JIrao.1​ ,

    Did you also check the information provided by this wiki link: https://wiki.st.com/stm32mpu/wiki/Linux_remoteproc_framework_overview#Remote_processor_-27early-27_boot ?

    Kind regards,

    Erwan.