cancel
Showing results for 
Search instead for 
Did you mean: 

OpenAMP_FreeRTOS example vs Cube Project - Why is the Cube project putting the init for IPCC and OpenAMP is the else section of the Is_Engineering_Boot_Mode() if statement?

GreenGuy
Lead

I created a project using CUBEIDE for STM32MP157C-DK2 and set all peripherals to initialize. I enabled FreeRTOS and then started porting over the example code in in the Projects folder for the OpenAMP_FreeRTOS_echo application. It is all compiling OK but the code is not executing correctly. Comparing the application example code to the CUBEIDE project I find that the code to init the IPCC and OpenAMP in the example is :

 /* Configure the system clock */

 if (IS_ENGINEERING_BOOT_MODE())

 {

   /* Configure the system clock */

   SystemClock_Config();

 }

 /* IPCC initialisation */

 MX_IPCC_Init();

 /* OpenAmp initialisation ---------------------------------*/

 MX_OPENAMP_Init(RPMSG_REMOTE, NULL);

But the CUBEIDE generated code looks like this:

 if(IS_ENGINEERING_BOOT_MODE())

 {

   /* Configure the peripherals common clocks */

   PeriphCommonClock_Config();

 }

 else

 {

   /* IPCC initialisation */

    MX_IPCC_Init();

   /* OpenAmp initialisation ---------------------------------*/

   MX_OPENAMP_Init(RPMSG_REMOTE, NULL);

 }

If I understand this correctly the code inside the  if (IS_ENGINEERING_BOOT_MODE()) will get run but the IPCC init will not which the project needs. This code is generated by CUBE and I cannot see how set up CUBE to generate the code correctly.

Any ideas? What am I missing?

1 ACCEPTED SOLUTION

Accepted Solutions
PatrickF
ST Employee

Hi,

IS_ENGINEERING_BOOT_MODE() is true when BOOT[2:0] pins are set to 0b100, which mean Cortex-A7 is not started from Flash (i.e. A7 core0 in endless loop toggling PA13 at 5kHz) and so there is no Linux RPMsg counterpart available to interact with IPCC and OpenAMP.

Sound logical to me to skip IPCC and OpenAMP init in that case.

If you wish to test your M4 FW in Engineering Boot (i.e. without Linux), you may think about adding fake functions anywhere communications with Linux are expected (using IS_ENGINEERING_BOOT_MODE() as well to keep normal behavior when Linux is running on 'production mode').

See also :

https://wiki.st.com/stm32mpu/wiki/STM32CubeIDE#Engineering_mode

https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_development_guidelines#Cortex-M4_Startup_Engineering_mode_-28-E2-80-9CMCU_Single_Core_like-E2-80-9D-29

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
PatrickF
ST Employee

Hi,

IS_ENGINEERING_BOOT_MODE() is true when BOOT[2:0] pins are set to 0b100, which mean Cortex-A7 is not started from Flash (i.e. A7 core0 in endless loop toggling PA13 at 5kHz) and so there is no Linux RPMsg counterpart available to interact with IPCC and OpenAMP.

Sound logical to me to skip IPCC and OpenAMP init in that case.

If you wish to test your M4 FW in Engineering Boot (i.e. without Linux), you may think about adding fake functions anywhere communications with Linux are expected (using IS_ENGINEERING_BOOT_MODE() as well to keep normal behavior when Linux is running on 'production mode').

See also :

https://wiki.st.com/stm32mpu/wiki/STM32CubeIDE#Engineering_mode

https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_development_guidelines#Cortex-M4_Startup_Engineering_mode_-28-E2-80-9CMCU_Single_Core_like-E2-80-9D-29

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
GreenGuy
Lead

​Thank You for pointing that out.  I was twisted around on my understanding of the engineering mode.  I was actually running in production mode so the code in the else section was being run which would have been equivalent to the example application.

PatrickF
ST Employee

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question.

See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.