Question
CubeMx STM32F4 1.11 SPI critical bug introduced in codegenerator
Posted on February 13, 2016 at 22:31
Hello,
in the new CubeMx STM32F4 1.11 library there is a new bug introduced. There is this new feature:Add new define USE_SPI_CRC for code cleanup when the CRC calculation is disabled.
The codegenerator generates (if CRC is disabled) in file stm32f4_hal_conf.h &sharpdefine USE_SPI_CRC 0U And the library checks against: &sharpifdef USE_SPI_CRC The problem is that even the USE_SPI_CRC is defined to ZERO, it IS DEFINED. So that the preprocessor ALWAYS handle&sharpifdef USE_SPI_CRC
as defined. I see here two solutions: 1) do not define USE_SPI_CRC at all in this case CRC is not used, i.e. comment out the line 2) for testing if the feature should be used rewrite the test to: &sharpif USE_SPI_CRC I think the 2) is the more robust. (You should not &sharpundef ) 1) AND 2) is I thing more optimal. For now I undef the generated code always after every generation :( regards, Adib. #!stm32-!cubemx-!spi-!bug #-