STM32CubeMX code generation error
Hello everyone,
I'm sitting over here working on one of my projects and found that STM32CubeMX generated code with an error. My project uses the STM32H7R3L8H6H MCU with Ethernet activated in the connectivity. I have my project set to "generate individual files" because I like it more that way. However, the file "eth.c" contains an error at the beginning of the file:
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
#pragma location=0x24020000
ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT]; /* Ethernet Rx DMA Descriptors */
#pragma location=0x24020080
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT]; /* Ethernet Tx DMA Descriptors */
#elif defined ( __CC_ARM ) /* MDK ARM Compiler */
__attribute__((at(0x24020000))) ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT]; /* Ethernet Rx DMA Descriptors */
__attribute__((at(0x24020080))) ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT]; /* Ethernet Tx DMA Descriptors */
#elif defined ( __GNUC__ ) || defined ( __ARMCC_VERSION )) /* GNU Compiler */
ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT] __attribute__((section(".RxDescripSection"))); /* Ethernet Rx DMA Descriptors */
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT] __attribute__((section(".TxDescripSection"))); /* Ethernet Tx DMA Descriptors */
#endif
ETH_BufferTypeDef Txbuffer[ETH_TX_DESC_CNT * 2U];
ETH_TxPacketConfigTypeDef TxConfig;The second closing bracket in line 13 shouldn't be there.
Can anyone at STM please take care of that? I know it's easy to correct on my end, but it's super annoying to have to do this every time the code is generated.
Also, why would STM32CubeMX generate all the code for the different compiler cases if I select "STM32CubeIDE" as Toolchain / IDE in my project settings?
![]()
It makes things much more cluttered, making the code hard to read.
I'm looking forward to an error-free STM32CubeMX.
And never forget:
"Always be yourself. Unless you can be a pirate. Then always be a pirate."
