cancel
Showing results for 
Search instead for 
Did you mean: 

Can't debug Cortex®-M4 side software on STM32H7 dual core.

Paco
Associate II

Hi All,

I am using STM32H747IDISCO kit.

I make a new project on STM32CubeIDE(Vewsion 1.18.1), following these steps below.

1.Start STM32CubeIDE(Vewsion 1.18.1), and click [Start new STM32 Project] button on STM32CubeIDE Home.

2.Input "STM32H747I-DISCO" in Commercial Part Number Box on Boad Selector tab.

3.Click Boads list 1 item displayed on right side, and click [Next] button.

4.Input "TestPrj" in Project Name Box in STM32 Project daialog, and click finish button.

After a while, TestPrj.ioc is opened, then click Project -> Generate code. 

C/C++ perspective is opened.

I add some processes in CM4 main function that turn on LED1 like the following.

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

/* added proccess start */
{
/* Configure the GPIO_LED pin */
    GPIO_InitTypeDef  GPIO_InitStruct;

    __HAL_RCC_GPIOI_CLK_ENABLE();
    GPIO_InitStruct.Pin = GPIO_PIN_12;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_PULLUP;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
    /* turn on LED */
    HAL_GPIO_WritePin (GPIOI, (uint16_t)GPIO_PIN_12, GPIO_PIN_RESET);
    printf("Hello World!!\r\n");
  }
/* added proccess end */

  /* USER CODE BEGIN Init */
  /* USER CODE END Init */ 

I execute build all, and load the code to board following the next guide.

 (https://www.st.com/resource/en/application_note/dm00629855-getting-started-with-projects-based-on-dualcore-stm32h7-microcontrollers-in-stm32cubeide-stmicroelectronics.pdf)

I set a breakpoint HAL_GPIO_WritePin (GPIOI, (uint16_t)GPIO_PIN_12, GPIO_PIN_RESET); line, and start debug, but it does not break.

LED1 is turned on, so it is clear that the breakpoint set above is proccessed.

And "Hello world!!" is not displayed on SWV ITM Data Console.

To display printf output in SWV ITM Data Console, I reffered to related website.

As mentioned above, I can’t debug(break, printf output to console, etc) on CM4 side.

Please teach me how to debug(break, printf output to console, etc) on CM4 side software on STM32H747.

1 REPLY 1
mƎALLEm
ST Employee

Hello,

Debugging the generated code for dual core is bit tricky as there is a kind of synchronization between CM4 and CM7 and CM4 enters in low power mode until the CM7 wakes it up.

I suggest you to comment the following code for debug:

CM7:

  while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) != RESET) && (timeout-- > 0));
  if ( timeout < 0 )
  {
  Error_Handler();
  }
while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) == RESET) && (timeout-- > 0));
if ( timeout < 0 )
{
Error_Handler();
}

CM4:

HAL_PWREx_ClearPendingEvent();
HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN);

 

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.