[rtems commit] bsp/stm32h7: Disable unused functions

Karel Gardas karel at rtems.org
Mon Jul 31 16:11:50 UTC 2023


Module:    rtems
Branch:    master
Commit:    4b3d7993d2cebf0596066d99f2475017064723c0
Changeset: http://git.rtems.org/rtems/commit/?id=4b3d7993d2cebf0596066d99f2475017064723c0

Author:    Karel Gardas <karel at functional.vision>
Date:      Wed Jul 19 18:18:29 2023 +0200

bsp/stm32h7: Disable unused functions

Re-apply based on:

    commit e4ba06f8b49da4334543f713ba437263c794d7ee
    Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
    Date:   Thu Apr 2 08:28:56 2020 +0200

        bsp/stm32h7: Disable unused functions

        Update #3910.

---

 bsps/arm/stm32h7/hal/stm32h7xx_hal.c       | 10 ++++++++++
 bsps/arm/stm32h7/hal/stm32h7xx_hal_eth.c   |  8 ++++++++
 bsps/arm/stm32h7/hal/stm32h7xx_hal_rcc.c   |  6 ++++++
 bsps/arm/stm32h7/hal/stm32h7xx_hal_uart.c  |  2 ++
 bsps/arm/stm32h7/hal/stm32h7xx_hal_usart.c |  2 ++
 5 files changed, 28 insertions(+)

diff --git a/bsps/arm/stm32h7/hal/stm32h7xx_hal.c b/bsps/arm/stm32h7/hal/stm32h7xx_hal.c
index c59b17d6cf..704626aa92 100644
--- a/bsps/arm/stm32h7/hal/stm32h7xx_hal.c
+++ b/bsps/arm/stm32h7/hal/stm32h7xx_hal.c
@@ -68,9 +68,11 @@
 /** @defgroup HAL_Exported_Variables HAL Exported Variables
   * @{
   */
+#ifndef __rtems__
 __IO uint32_t uwTick;
 uint32_t uwTickPrio   = (1UL << __NVIC_PRIO_BITS); /* Invalid PRIO */
 HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT;  /* 1KHz */
+#endif /* __rtems__ */
 /**
   * @}
   */
@@ -166,11 +168,13 @@ uint32_t common_system_clock;
   SystemCoreClock = common_system_clock;
 #endif /* DUAL_CORE && CORE_CM4 */
 
+#ifndef __rtems__
   /* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */
   if(HAL_InitTick(TICK_INT_PRIORITY) != HAL_OK)
   {
     return HAL_ERROR;
   }
+#endif /* __rtems__ */
 
   /* Init the low level hardware */
   HAL_MspInit();
@@ -179,6 +183,7 @@ uint32_t common_system_clock;
   return HAL_OK;
 }
 
+#ifndef __rtems__
 /**
   * @brief  This function de-Initializes common part of the HAL and stops the systick.
   *         This function is optional.
@@ -220,7 +225,9 @@ HAL_StatusTypeDef HAL_DeInit(void)
   /* Return function status */
   return HAL_OK;
 }
+#endif /* __rtems__ */
 
+#ifndef __rtems__
 /**
   * @brief  Initializes the MSP.
   * @retval None
@@ -287,6 +294,7 @@ __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
   /* Return function status */
   return HAL_OK;
 }
+#endif /* __rtems__ */
 
 /**
   * @}
@@ -315,6 +323,7 @@ __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
   * @{
   */
 
+#ifndef __rtems__
 /**
   * @brief This function is called to increment  a global variable "uwTick"
   *        used as application time base.
@@ -449,6 +458,7 @@ __weak void HAL_ResumeTick(void)
   /* Enable SysTick Interrupt */
   SysTick->CTRL  |= SysTick_CTRL_TICKINT_Msk;
 }
+#endif /* __rtems__ */
 
 /**
   * @brief  Returns the HAL revision
diff --git a/bsps/arm/stm32h7/hal/stm32h7xx_hal_eth.c b/bsps/arm/stm32h7/hal/stm32h7xx_hal_eth.c
index f1c09d95a7..1e961b277e 100644
--- a/bsps/arm/stm32h7/hal/stm32h7xx_hal_eth.c
+++ b/bsps/arm/stm32h7/hal/stm32h7xx_hal_eth.c
@@ -379,8 +379,10 @@ HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth)
   /*------------------ MAC, MTL and DMA default Configuration ----------------*/
   ETH_MACDMAConfig(heth);
 
+#ifndef __rtems__
   /* SET DSL to 64 bit */
   MODIFY_REG(heth->Instance->DMACCR, ETH_DMACCR_DSL, ETH_DMACCR_DSL_64BIT);
+#endif /* __rtems__ */
 
   /* Set Receive Buffers Length (must be a multiple of 4) */
   if ((heth->Init.RxBuffLen % 0x4U) != 0x0U)
@@ -449,6 +451,7 @@ HAL_StatusTypeDef HAL_ETH_DeInit(ETH_HandleTypeDef *heth)
   return HAL_OK;
 }
 
+#ifndef __rtems__
 /**
   * @brief  Initializes the ETH MSP.
   * @param  heth: pointer to a ETH_HandleTypeDef structure that contains
@@ -463,6 +466,7 @@ __weak void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
   the HAL_ETH_MspInit could be implemented in the user file
   */
 }
+#endif /* __rtems__ */
 
 /**
   * @brief  DeInitializes ETH MSP.
@@ -2959,6 +2963,7 @@ static void ETH_MACDMAConfig(ETH_HandleTypeDef *heth)
   */
 static void ETH_DMATxDescListInit(ETH_HandleTypeDef *heth)
 {
+#ifndef __rtems__
   ETH_DMADescTypeDef *dmatxdesc;
   uint32_t i;
 
@@ -2986,6 +2991,7 @@ static void ETH_DMATxDescListInit(ETH_HandleTypeDef *heth)
 
   /* Set Transmit Descriptor Tail pointer */
   WRITE_REG(heth->Instance->DMACTDTPR, (uint32_t) heth->Init.TxDesc);
+#endif /* __rtems__ */
 }
 
 /**
@@ -2997,6 +3003,7 @@ static void ETH_DMATxDescListInit(ETH_HandleTypeDef *heth)
   */
 static void ETH_DMARxDescListInit(ETH_HandleTypeDef *heth)
 {
+#ifndef __rtems__
   ETH_DMADescTypeDef *dmarxdesc;
   uint32_t i;
 
@@ -3031,6 +3038,7 @@ static void ETH_DMARxDescListInit(ETH_HandleTypeDef *heth)
 
   /* Set Receive Descriptor Tail pointer Address */
   WRITE_REG(heth->Instance->DMACRDTPR, ((uint32_t)(heth->Init.RxDesc + (uint32_t)(ETH_RX_DESC_CNT - 1U))));
+#endif /* __rtems__ */
 }
 
 /**
diff --git a/bsps/arm/stm32h7/hal/stm32h7xx_hal_rcc.c b/bsps/arm/stm32h7/hal/stm32h7xx_hal_rcc.c
index 8c987ac8ef..ff54ff5c73 100644
--- a/bsps/arm/stm32h7/hal/stm32h7xx_hal_rcc.c
+++ b/bsps/arm/stm32h7/hal/stm32h7xx_hal_rcc.c
@@ -172,6 +172,7 @@
   * @{
   */
 
+#ifndef __rtems__
 /**
   * @brief  Resets the RCC clock configuration to the default reset state.
   * @note   The default reset state of the clock configuration is given below:
@@ -387,6 +388,7 @@ HAL_StatusTypeDef HAL_RCC_DeInit(void)
 
   return HAL_OK;
 }
+#endif /* __rtems__ */
 
 /**
   * @brief  Initializes the RCC Oscillators according to the specified parameters in the
@@ -1234,7 +1236,11 @@ HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef  *RCC_ClkInitStruct, ui
 #endif /* DUAL_CORE && CORE_CM4 */
 
   /* Configure the source of time base considering new system clocks settings*/
+#ifndef __rtems__
   halstatus = HAL_InitTick(uwTickPrio);
+#else /* __rtems__ */
+  halstatus = HAL_OK;
+#endif /* __rtems__ */
 
   return halstatus;
 }
diff --git a/bsps/arm/stm32h7/hal/stm32h7xx_hal_uart.c b/bsps/arm/stm32h7/hal/stm32h7xx_hal_uart.c
index 5b0b039458..b616521578 100644
--- a/bsps/arm/stm32h7/hal/stm32h7xx_hal_uart.c
+++ b/bsps/arm/stm32h7/hal/stm32h7xx_hal_uart.c
@@ -671,6 +671,7 @@ HAL_StatusTypeDef HAL_UART_DeInit(UART_HandleTypeDef *huart)
   return HAL_OK;
 }
 
+#ifndef __rtems__
 /**
   * @brief Initialize the UART MSP.
   * @param huart UART handle.
@@ -685,6 +686,7 @@ __weak void HAL_UART_MspInit(UART_HandleTypeDef *huart)
             the HAL_UART_MspInit can be implemented in the user file
    */
 }
+#endif /* __rtems__ */
 
 /**
   * @brief DeInitialize the UART MSP.
diff --git a/bsps/arm/stm32h7/hal/stm32h7xx_hal_usart.c b/bsps/arm/stm32h7/hal/stm32h7xx_hal_usart.c
index bed9d165bb..07ab2f05f3 100644
--- a/bsps/arm/stm32h7/hal/stm32h7xx_hal_usart.c
+++ b/bsps/arm/stm32h7/hal/stm32h7xx_hal_usart.c
@@ -373,6 +373,7 @@ HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart)
   return HAL_OK;
 }
 
+#ifndef __rtems__
 /**
   * @brief Initialize the USART MSP.
   * @param husart USART handle.
@@ -387,6 +388,7 @@ __weak void HAL_USART_MspInit(USART_HandleTypeDef *husart)
             the HAL_USART_MspInit can be implemented in the user file
    */
 }
+#endif /* __rtems__ */
 
 /**
   * @brief DeInitialize the USART MSP.



More information about the vc mailing list