Skip to main content
Visitor II
September 13, 2023
Question

Coprocessor firmware doesn't start manually via rproc

  • September 13, 2023
  • 2 replies
  • 1898 views

Hello,
I'm working on a STM32MP157D-DK1 demoboard and I want to manually start the coprocessor from u-boot.

I'm tried to follow this tutorial: MANUAL START  

The steps that I maked are:

1) I generated the code with STM32CubeMx (I selected the board STM32MP157D-DK1 with default initialization of all peripherals) 

2) I imported the code into STM32cubeIDE and I added the following changes:

In main.c:
while (1)
{
 /* USER CODE END WHILE */
 /* USER CODE BEGIN 3 */
 HAL_GPIO_TogglePin(GPIOH, GPIO_PIN_7);
 HAL_Delay(500);
}

in gpio.c:
void MX_GPIO_Init(void)
{
 GPIO_InitTypeDef GPIO_InitStruct = { 0 };
 /* GPIO Ports Clock Enable */
 __HAL_RCC_GPIOC_CLK_ENABLE();
 __HAL_RCC_GPIOH_CLK_ENABLE();
 /*Configure GPIO pin*/
 GPIO_InitStruct.Pin = GPIO_PIN_7;
 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 GPIO_InitStruct.Pull = GPIO_NOPULL;
 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
}

3) I loaded the code (a simple toggle of the orange led) in production mode or Engineering mode via STM32cubeIDE and it works. 

4) I tried to starting the code from linux and it works:

02_start_from_linux.jpg

5) In the end I tried the rproc commands but without success.

I copied the file "test_mp1_CM4.elf" in the boot partition:

03_bootfs.jpg

and I tried to launch the firmware:

01_manual_boot_CM4.jpg

The led blink doesn't work.

What am I doing wrong?

 

PS: in the SDCARD I loaded the default image: en.flash-stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21.tar.gz

Thanks.

    This topic has been closed for replies.

    2 replies

    EdoardoAuthor
    Visitor II
    September 15, 2023

    Can anyone help me?

    I attached the "elf" file.

     

    Graduate
    October 1, 2023

    It might be that you need to modify the linux kernel device tree to automatically attach the remoteproc probe at boot - https://wiki.st.com/stm32mpu/wiki/How_to_start_the_coprocessor_from_the_bootloader#Linux_kernel

    To elaborate: If I recreate your steps with a similar "blink" elf-file, I have the same experience as you: The LED blinks when the elf is launched from linux, but not when launched from the u-boot elf.

    However, when I launch the elf-from uboot, and boot into linux, I see that the remoteproc state is set to "detatched" for the m4:

     cat >/sys/class/remoteproc/remoteproc0/state
    detached

     If I do not start the elf in uboot, the state is simply "offline".

    When the state is detached, I can start the application using

     echo start > /sys/class/remoteproc/remoteproc0/state
     cat /sys/class/remoteproc/remoteproc0/state
    running

    and the blinking starts. This is consistent with the guide linked above, so maybe you need to recompile the devicetree.

    Hope this helps.