cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX v4.17.0 - incorrectly generates the call of __HAL_DMA1_REMAP macro

tibor
Associate
Posted on October 18, 2016 at 12:50

THE SAME BUG IT WAS OBSERVED BY OTHERS, (compared to other posts this eventually helps to reproduce and understand the problem).

After upgrading STM32CubeMX from 4.16.1 to 4.17.0 I found a bug.

Environment: I use STM32Cube_FW_F0_V1.6.0 firmware library.

Symptom:

In the stm32f0xx_hal_dma_ex.h the __HAL_DMA1_REMAP macro, together with the change introduced by the generator in usart.c does not compiles.

Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_dma_ex.h:796:10: error: expected expression before 'do'

          do { assert_param(IS_HAL_DMA1_REMAP(__REQUEST__));                                             \

In the usart.c by generator, it is replaced the line

__HAL_DMA1_REMAP(HAL_DMA1_CH3_USART1_RX);

with 

    if (__HAL_DMA1_REMAP(HAL_DMA1_CH3_USART1_RX) != HAL_OK)

    {

      Error_Handler();

    }

The problem is similar what we find in the following article

http://pilt.github.io/2009/10/16/the-use-of-do-while-0-in-c-macros/

Temporarily I revert the changes in usart.c as a temporary workaround.

The problem is in the driver code, but the changes in the STM32CubeMX v4.17.0 with regard to the use of the macro causes an error.

#stm32 #bug #bug #cubemx #stm32cube
3 REPLIES 3
slimen
Senior
Posted on October 18, 2016 at 14:53

Hello,

This issue is reported to ST team in this

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Bug%20CubeMX%17%20STM32F303%20after%20emigration&currentviews=49

.

ST team is aware about this issue now and works to resolve this issue.

Regards

AndreaC
Associate III
Posted on October 20, 2016 at 09:58

I found the same issue in a project built for stm32f030cc, in stm32f0xx_hal_msp.c.

Also I was usingSTM32Cube_FW_F0_V1.6.0 firmware library. The faulty statement was this:

if

(__HAL_DMA1_REMAP(HAL_DMA1_CH1_ADC) != HAL_OK)
{
Error_Handler();
}

Like Tibor did, I worked-around by changing that block with this one simple line:

__HAL_DMA1_REMAP(HAL_DMA1_CH1_ADC);

And it all worked. BR, Andrea
stm32cube-t
Senior III
Posted on November 08, 2016 at 12:45

Dear Andrea,

STM32CubeMX 4.18 out in the next coming weeks should fix your issue.

Best regards