Associate III
October 22, 2021
Solved
STM32CubeMX generated build for IAR does not work
- October 22, 2021
- 2 replies
- 2099 views
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
- Run STMCubeIDE generated project in production mode in IDE. Check expected result
- 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.
- 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
