From 5b13baf96a2c0430e00a83886a8b316477250a5d Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Wed, 4 Sep 2024 12:34:26 -0500 Subject: [PATCH] bsps/stm32h7: Resolve HAL const warning HAL init functions take a non-const reference parameter. Explicitly cast away the constness to remove the warning. --- bsps/arm/stm32h7/start/bspstarthooks.c | 14 +++++++++++--- bsps/arm/stm32h7/start/stm32h7-hal.c | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bsps/arm/stm32h7/start/bspstarthooks.c b/bsps/arm/stm32h7/start/bspstarthooks.c index 1591cc36bb..d9adf8d49a 100644 --- a/bsps/arm/stm32h7/start/bspstarthooks.c +++ b/bsps/arm/stm32h7/start/bspstarthooks.c @@ -55,7 +55,10 @@ void stm32h7_init_oscillator(void) { HAL_StatusTypeDef status; - status = HAL_RCC_OscConfig(&stm32h7_config_oscillator); + status = HAL_RCC_OscConfig(RTEMS_DECONST( + RCC_OscInitTypeDef *, + &stm32h7_config_oscillator + )); if (status != HAL_OK) { bsp_reset(RTEMS_FATAL_SOURCE_BSP, 0); } @@ -66,7 +69,7 @@ void stm32h7_init_clocks(void) HAL_StatusTypeDef status; status = HAL_RCC_ClockConfig( - &stm32h7_config_clocks, + RTEMS_DECONST( RCC_ClkInitTypeDef *, &stm32h7_config_clocks ), stm32h7_config_flash_latency ); if (status != HAL_OK) { @@ -78,7 +81,12 @@ void stm32h7_init_peripheral_clocks(void) { HAL_StatusTypeDef status; - status = HAL_RCCEx_PeriphCLKConfig(&stm32h7_config_peripheral_clocks); + status = HAL_RCCEx_PeriphCLKConfig( + RTEMS_DECONST( + RCC_PeriphCLKInitTypeDef *, + &stm32h7_config_peripheral_clocks + ) + ); if (status != HAL_OK) { bsp_reset(RTEMS_FATAL_SOURCE_BSP, 0); } diff --git a/bsps/arm/stm32h7/start/stm32h7-hal.c b/bsps/arm/stm32h7/start/stm32h7-hal.c index 2eb4b99d00..dfe6342b08 100644 --- a/bsps/arm/stm32h7/start/stm32h7-hal.c +++ b/bsps/arm/stm32h7/start/stm32h7-hal.c @@ -272,7 +272,7 @@ void stm32h7_gpio_init(const stm32h7_gpio_config *config) index = stm32h7_get_module_index(config->regs); stm32h7_clk_enable(index); - HAL_GPIO_Init(config->regs, &config->config); + HAL_GPIO_Init(config->regs, RTEMS_DECONST( GPIO_InitTypeDef *, &config->config )); } void stm32h7_uart_polled_write(rtems_termios_device_context *base, char c)