cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX generated build for IAR does not work

PeterL
Associate III

Hi

 

When generating for CubeIDE firmware executes fine in both production and engineering mode.

But for IAR/EWARM only engineering mode works. And, yes, I am aware of production mode not supported out of the box. Manual copy to target and start required.

 

Target STM32MP1-DK2

STMCubeMX 6.3.0

STMCubeIDE 1.7.0

EWARM 9.10.1

 

  /* USER CODE BEGIN WHILE */
  while (1)
  {
    static int loopCounter;
    loopCounter++;
    HAL_GPIO_WritePin(LED_Y_GPIO_Port, LED_Y_Pin, GPIO_PIN_SET);
    if( loopCounter < 10 )
    {
      for(volatile int i = 0; i < 5000000; i++);
    }
    else
    {
      HAL_Delay(500);
    }
    HAL_GPIO_WritePin(LED_Y_GPIO_Port, LED_Y_Pin, GPIO_PIN_RESET);
    if( loopCounter < 10 )
    {
      for(volatile int i = 0; i < 5000000; i++);
    }
    else
    {
      HAL_Delay(500);
    }
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */

Reproduction method

Generate STMCubeIDE and EWARM projects by changing in MX Project Manager from attached HAL_Tick_TIM6.ioc.

Add code snippet to main.c

 

  1. Run STMCubeIDE generated project in production mode in IDE. Check expected result
  2. Build EWARM and copy/rename to /usr/local/project/HAL_Tick_TIM6_CM4/lib/firmware/HAL_Tick_TIM6_CM4.elf. Start with /usr/local/project/HAL_Tick_TIM6_CM4/fw_cortex_m4.sh stop and then start. Check error result.
  3. Run elf-file from STMCubeIDE (step 1) again. Check error result.

 

Expected result

Continous blinking of amber LED.

 

Error result

9 blinks of amber LED and then a halt.

 

Observed cause for error, not knowing root cause

NVIC TIM6 IRQ is of some reason disabled. Hard to debug from IAR environment...

 

/Peter

1 ACCEPTED SOLUTION

Accepted Solutions
Olivier GALLIEN
ST Employee

Hi @PeterL​ ,

Did you perform a board reset between step 1/2/3 ?

Else, issue around NVIC TIM IRQ remind me this post :

https://community.st.com/s/question/0D53W00000Dhrg9SAB/hal-tick-does-not-get-incremented-on-second-debug-session-after-reset-freertos

Could it be occurrence of the same problem ?

Olivier

Olivier GALLIEN
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

2 REPLIES 2
Olivier GALLIEN
ST Employee

Hi @PeterL​ ,

Did you perform a board reset between step 1/2/3 ?

Else, issue around NVIC TIM IRQ remind me this post :

https://community.st.com/s/question/0D53W00000Dhrg9SAB/hal-tick-does-not-get-incremented-on-second-debug-session-after-reset-freertos

Could it be occurrence of the same problem ?

Olivier

Olivier GALLIEN
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.
PeterL
Associate III

Hi @Community member​ 

It is the same problem as the post you referred to. Maybe a good Idea to adress it in CubeMX? /Peter