Skip to content

stm32: fix compilation error when not using uart#2959

Merged
HiFiPhile merged 2 commits intohathach:masterfrom
ho-ho-ho:master
Jan 27, 2025
Merged

stm32: fix compilation error when not using uart#2959
HiFiPhile merged 2 commits intohathach:masterfrom
ho-ho-ho:master

Conversation

@ho-ho-ho
Copy link
Copy Markdown

@ho-ho-ho ho-ho-ho commented Jan 23, 2025

Describe the PR
When not using uart the macro UART_CLK_EN is most likely also not defined (as it is defined in the board.h alongside UART_DEV). On some stm32 families (i.e. l0 and f1) this is handled correctly and the UART_CLK_EN macro is called from the #ifdef UART_DEV section, but on some families the macro is always called, resulting in a undefined symbol compile error.

This pr moves the call to UART_CLK_EN into the conditional section for the families with the wrong behaviour. It also only creates the UartHandle variable when uart is actually in use (more in line with the behaviour of the stm32l0 family which I consider to be the best implementation of this conditional compilation part).

@HiFiPhile
Copy link
Copy Markdown
Collaborator

Thank you !

@HiFiPhile HiFiPhile merged commit eca025f into hathach:master Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants