-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix build for STM32C051xx boards #2791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Pin GPIO_AF0_USART2 is used by PeripheralPins.c Signed-off-by: Nessotrin <[email protected]>
Direct copy from STM32C031xx. It looks compatible. Signed-off-by: Nessotrin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First thanks for your contribution,
It misses several update to be properly added:
- Reference all the entries in the boards.txt
- Reference in the README.md
- Add a default clock config
@@ -61,7 +61,7 @@ extern "C" { | |||
#define GPIO_AF0_OSC ((uint8_t)0x00) /*!< OSC (By pass and Enable) Alternate Function mapping */ | |||
#define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< TIM14 Alternate Function mapping */ | |||
#endif /* !STM32C011xx */ | |||
#if defined(STM32C031xx) || defined(STM32C071xx) || defined(STM32C091xx) || defined(STM32C092xx) | |||
#if defined(STM32C031xx) || defined(STM32C051xx) || defined(STM32C071xx) || defined(STM32C091xx) || defined(STM32C092xx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, HAL could not be modified.
It is used as is and if an issue is identified then it have to be corrected first in the HAL driver; feel free to raised an issue on the related GitHub:
https://github.com/STMicroelectronics/stm32c0xx-hal-driver/blob/c283b143bef6bdaacf64240ee6f15eb61dad6125/Inc/stm32c0xx_hal_gpio_ex.h#L64
If it is a blocking issue then a workaround can be added in the stm32_def.h as it is already done for an other missing AF:
Arduino_Core_STM32/libraries/SrcWrapper/inc/stm32_def.h
Lines 223 to 225 in 0e2a66b
#if defined(STM32C0xx) && defined(USART3) && !defined(GPIO_AF7_USART3) | |
#define GPIO_AF7_USART3 ((uint8_t)0x07) | |
#endif // STM32C0xx && !defined(USART3) |
MEMORY | ||
{ | ||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE | ||
FLASH (rx) : ORIGIN = 0x8000000+ LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FLASH (rx) : ORIGIN = 0x8000000+ LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET | |
FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET |
Summary
This PR adds the ability to compile for STM32C051xx based boards. Most of the infrastructure was already there.
The STM32C051xx is a recently upgraded version of the STM32C031xx with 2x more flash.
The link script still mentions the STM32C031CxTx. Since it is auto-generated I chose to leave it as is. Someone with STM32CubeIDE could generate a new one, but I suspect there would be no difference whatsoever.