Skip to main content
Explorer
Solved

STM32CubeMX Generates different names for interrupt handler in startup file & stm32l4xx_it.c

Hi everyone,

I just started developing software for a new project containing on of the STM32L4P5 series microcontrollers. Therefore I bought the NUCELO-L4P5ZG starter-kit to get used to the IDE, HAL and so on. I use the STM32CubeMX IDE (Version 6.16.1) to configure the board and generate the basic initialization sources. Further code writing is done in STM32CubeIDE (Version: 2.1.1).

For the beginning I configured three GPIO pins for the LEDs on the board and the LPUART for simple data transfer to terminal on host computer. For the transmission I want to use DMA . After generating the code with CubeMX and implementing some simple blink logic for the LEDs, I added the line HAL_UART_Transmit_DMA(&hlpuart1, buffer, 14); to the main loop. I debugged the code and saw that the code ran into the infinite loop in the DefaultHandler in the startup file startup_stm32l4p5zgtx.s:

 

After searching for two and a half hour I finally found the problem: the generated names for the interrupt handler in the startup file and the stm32l4xx_it.c are slightly different. See the following sections:

image.png

and 

image.png

After changing the name manually in the stm32l4xx_it.c file everything works fine (until the next generation of the initialization code with CubeMX).

Please see this as a bug report and consider this issue for new releases of CubeMX.

Attached: my entire project.

TDK
TDKBest answer

It appears this bug has been fixed. The code generates correctly on the latest STM32CubeMX version. Update your STM32CubeMX to fix this.

	.word	EXTI0_IRQHandler
	.word	EXTI1_IRQHandler
	.word	EXTI2_IRQHandler
	.word	EXTI3_IRQHandler
	.word	EXTI4_IRQHandler
	.word	DMA1_Channel1_IRQHandler
	.word	DMA1_Channel2_IRQHandler
	.word	DMA1_Channel3_IRQHandler
	.word	DMA1_Channel4_IRQHandler
	.word	DMA1_Channel5_IRQHandler
	.word	DMA1_Channel6_IRQHandler
	.word	DMA1_Channel7_IRQHandler
	.word	ADC1_2_IRQHandler
	.word	CAN1_TX_IRQHandler
	.word	CAN1_RX0_IRQHandler
	.word	CAN1_RX1_IRQHandler
	.word	CAN1_SCE_IRQHandler

 

Or, as a workaround, put

#define DMA1_Channel7_IRQHandler DMA1_CH7_IRQHandler

 in a USER CODE block at the top of the *_it.c file.

"If you feel a post has answered your question, please click ""Accept as Solution""."

1 reply

TDK
TDKBest answer

It appears this bug has been fixed. The code generates correctly on the latest STM32CubeMX version. Update your STM32CubeMX to fix this.

	.word	EXTI0_IRQHandler
	.word	EXTI1_IRQHandler
	.word	EXTI2_IRQHandler
	.word	EXTI3_IRQHandler
	.word	EXTI4_IRQHandler
	.word	DMA1_Channel1_IRQHandler
	.word	DMA1_Channel2_IRQHandler
	.word	DMA1_Channel3_IRQHandler
	.word	DMA1_Channel4_IRQHandler
	.word	DMA1_Channel5_IRQHandler
	.word	DMA1_Channel6_IRQHandler
	.word	DMA1_Channel7_IRQHandler
	.word	ADC1_2_IRQHandler
	.word	CAN1_TX_IRQHandler
	.word	CAN1_RX0_IRQHandler
	.word	CAN1_RX1_IRQHandler
	.word	CAN1_SCE_IRQHandler

 

Or, as a workaround, put

#define DMA1_Channel7_IRQHandler DMA1_CH7_IRQHandler

 in a USER CODE block at the top of the *_it.c file.

"If you feel a post has answered your question, please click ""Accept as Solution""."