From 4a10efe888c8749713ec78cbbdea467c0f23f481 Mon Sep 17 00:00:00 2001 From: TLIG Dhaou Date: Fri, 22 Jul 2022 11:50:33 +0200 Subject: [PATCH 1/3] west.yml: Update hal_stm32 with recent cube packages stm32cube: update stm32f4 to cube version V1.27.1. stm32cube: update stm32f7 to cube version V1.17.0. stm32cube: update stm32g0 to cube version V1.6.1. stm32cube: update stm32g4 to cube version V1.5.1. stm32cube: update stm32l4 to cube version V1.17.2. stm32cube: update stm32mp1 to cube version 1.6.0. stm32cube: update stm32u5 to cube version V1.1.1. stm32cube: update stm32wb to cube version V1.14.0. lib/stm32: update stm32wb to cube version V1.14.0 Signed-off-by: TLIG Dhaou --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index bc722834b9adf0..fb042de2251fd6 100644 --- a/west.yml +++ b/west.yml @@ -124,7 +124,7 @@ manifest: groups: - hal - name: hal_stm32 - revision: 51b373cd3455b8c2b9babbf6ff41918116a442ac + revision: 5b1610c3cf46589d50e2634ba240b7b38bc59c53 path: modules/hal/stm32 groups: - hal From c1cf298347013d2048decb1a0e914f274ac7d0f3 Mon Sep 17 00:00:00 2001 From: TLIG Dhaou Date: Wed, 17 Aug 2022 14:21:45 +0200 Subject: [PATCH 2/3] drivers: ethernet: patch for the stm32 drivers This commit is a patch to fix the ETH buffer redefined in many files. Signed-off-by: TLIG Dhaou --- drivers/ethernet/eth_stm32_hal.c | 8 ++++---- drivers/ethernet/eth_stm32_hal_priv.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index a423acd976b49a..0696fc054bdb01 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -86,8 +86,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); static ETH_DMADescTypeDef dma_rx_desc_tab[ETH_RXBUFNB] __eth_stm32_desc; static ETH_DMADescTypeDef dma_tx_desc_tab[ETH_TXBUFNB] __eth_stm32_desc; -static uint8_t dma_rx_buffer[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __eth_stm32_buf; -static uint8_t dma_tx_buffer[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __eth_stm32_buf; +static uint8_t dma_rx_buffer[ETH_RXBUFNB][ETH_STM32_RX_BUF_SIZE] __eth_stm32_buf; +static uint8_t dma_tx_buffer[ETH_TXBUFNB][ETH_STM32_TX_BUF_SIZE] __eth_stm32_buf; #if defined(CONFIG_SOC_SERIES_STM32H7X) static ETH_TxPacketConfig tx_config; @@ -194,7 +194,7 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) k_mutex_lock(&dev_data->tx_mutex, K_FOREVER); total_len = net_pkt_get_len(pkt); - if (total_len > ETH_TX_BUF_SIZE) { + if (total_len > ETH_STM32_TX_BUF_SIZE) { LOG_ERR("PKT too big"); res = -EIO; goto error; @@ -825,7 +825,7 @@ static int eth_initialize(const struct device *dev) #if defined(CONFIG_SOC_SERIES_STM32H7X) heth->Init.TxDesc = dma_tx_desc_tab; heth->Init.RxDesc = dma_rx_desc_tab; - heth->Init.RxBuffLen = ETH_RX_BUF_SIZE; + heth->Init.RxBuffLen = ETH_STM32_RX_BUF_SIZE; #endif /* CONFIG_SOC_SERIES_STM32H7X */ hal_ret = HAL_ETH_Init(heth); diff --git a/drivers/ethernet/eth_stm32_hal_priv.h b/drivers/ethernet/eth_stm32_hal_priv.h index 765ddc35e11d5b..953ee44a5ade0d 100644 --- a/drivers/ethernet/eth_stm32_hal_priv.h +++ b/drivers/ethernet/eth_stm32_hal_priv.h @@ -17,8 +17,8 @@ #define ETH_STM32_HAL_FRAME_SIZE_MAX (ETH_STM32_HAL_MTU + 18) /* Definition of the Ethernet driver buffers size and count */ -#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ -#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_STM32_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_STM32_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ /* Device constant configuration parameters */ struct eth_stm32_hal_dev_cfg { From d073cffef876c8f46b0c18d2a9700ebc2c155fd5 Mon Sep 17 00:00:00 2001 From: TLIG Dhaou Date: Wed, 17 Aug 2022 15:17:03 +0200 Subject: [PATCH 3/3] drivers: counter: Patch for the stm32 counter Fix the TIM_Typedef types. Signed-off-by: TLIG Dhaou --- drivers/counter/counter_ll_stm32_timer.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/counter/counter_ll_stm32_timer.c b/drivers/counter/counter_ll_stm32_timer.c index 68e1f2473b433d..13d5b07feca37c 100644 --- a/drivers/counter/counter_ll_stm32_timer.c +++ b/drivers/counter/counter_ll_stm32_timer.c @@ -35,11 +35,17 @@ static void(*const set_timer_compare[TIMER_MAX_CH])(TIM_TypeDef *, }; /** Channel to compare get function mapping. */ +#if !defined(CONFIG_SOC_SERIES_STM32F4X) +static uint32_t(*const get_timer_compare[TIMER_MAX_CH])(const TIM_TypeDef *) = { + LL_TIM_OC_GetCompareCH1, LL_TIM_OC_GetCompareCH2, + LL_TIM_OC_GetCompareCH3, LL_TIM_OC_GetCompareCH4, +}; +#else static uint32_t(*const get_timer_compare[TIMER_MAX_CH])(TIM_TypeDef *) = { LL_TIM_OC_GetCompareCH1, LL_TIM_OC_GetCompareCH2, LL_TIM_OC_GetCompareCH3, LL_TIM_OC_GetCompareCH4, }; - +#endif /** Channel to interrupt enable function mapping. */ static void(*const enable_it[TIMER_MAX_CH])(TIM_TypeDef *) = { LL_TIM_EnableIT_CC1, LL_TIM_EnableIT_CC2, @@ -54,11 +60,18 @@ static void(*const disable_it[TIMER_MAX_CH])(TIM_TypeDef *) = { #ifdef CONFIG_ASSERT /** Channel to interrupt enable check function mapping. */ +#if !defined(CONFIG_SOC_SERIES_STM32F4X) +static uint32_t(*const check_it_enabled[TIMER_MAX_CH])(const TIM_TypeDef *) = { + LL_TIM_IsEnabledIT_CC1, LL_TIM_IsEnabledIT_CC2, + LL_TIM_IsEnabledIT_CC3, LL_TIM_IsEnabledIT_CC4, +}; +#else static uint32_t(*const check_it_enabled[TIMER_MAX_CH])(TIM_TypeDef *) = { LL_TIM_IsEnabledIT_CC1, LL_TIM_IsEnabledIT_CC2, LL_TIM_IsEnabledIT_CC3, LL_TIM_IsEnabledIT_CC4, }; #endif +#endif /** Channel to interrupt flag clear function mapping. */ static void(*const clear_it_flag[TIMER_MAX_CH])(TIM_TypeDef *) = {