From 443d56cfb161dfedc65d435fbeeb49b52b1f8f58 Mon Sep 17 00:00:00 2001 From: hydevcode Date: Tue, 1 Oct 2024 06:50:15 +0800 Subject: [PATCH] [bsp][airm2m/air105][rsoc] Fix compilation issues with bsp of airm2m/air105 --- .github/workflows/bsp_buildings.yml | 1 + .../manual_trigger_scons_except_STM32_all.yml | 2 +- bsp/airm2m/air105/board/board.c | 11 +++++++---- .../air105/libraries/HAL_Driver/Inc/core_irq.h | 4 ++-- .../air105/libraries/HAL_Driver/Src/core_dma.c | 16 ++++++++-------- .../air105/libraries/rt_drivers/drv_common.h | 6 ++++++ bsp/airm2m/air105/makesoc.py | 9 ++++----- 7 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/bsp_buildings.yml b/.github/workflows/bsp_buildings.yml index 394dfe1089c..59fac313e75 100644 --- a/.github/workflows/bsp_buildings.yml +++ b/.github/workflows/bsp_buildings.yml @@ -101,6 +101,7 @@ jobs: - "rm48x50" - "ht32/ht32f52352" - "ht32/ht32f12366" + - "airm2m/air105" - "w60x" - "essemi/es32f0654" - "essemi/es32f365x" diff --git a/.github/workflows/manual_trigger_scons_except_STM32_all.yml b/.github/workflows/manual_trigger_scons_except_STM32_all.yml index 6afbbb11305..dff767186a0 100644 --- a/.github/workflows/manual_trigger_scons_except_STM32_all.yml +++ b/.github/workflows/manual_trigger_scons_except_STM32_all.yml @@ -43,7 +43,7 @@ jobs: legs: - {RTT_BSP_NAME: "acm32_acm32f0x0-nucleo", RTT_TOOL_CHAIN: "sourcery-arm", RTT_BSP: "acm32/acm32f0x0-nucleo"} - {RTT_BSP_NAME: "acm32_acm32f4xx-nucleo", RTT_TOOL_CHAIN: "sourcery-arm", RTT_BSP: "acm32/acm32f4xx-nucleo"} - #- {RTT_BSP_NAME: "airm2m_air105", RTT_TOOL_CHAIN: "sourcery-arm", RTT_BSP: "airm2m/air105"} #scons fail in last step + - {RTT_BSP_NAME: "airm2m_air105", RTT_TOOL_CHAIN: "sourcery-arm", RTT_BSP: "airm2m/air105"} - {RTT_BSP_NAME: "airm2m_air32f103", RTT_TOOL_CHAIN: "sourcery-arm", RTT_BSP: "airm2m/air32f103"} #- {RTT_BSP_NAME: "allwinner_d1", RTT_TOOL_CHAIN: "sourcery-arm", RTT_BSP: "allwinner/d1"} # rt-smart fail toolchain #- {RTT_BSP_NAME: "allwinner_d1s", RTT_TOOL_CHAIN: "sourcery-arm", RTT_BSP: "allwinner/d1s"} #toochain diff --git a/bsp/airm2m/air105/board/board.c b/bsp/airm2m/air105/board/board.c index 4d6a04b2ad0..c25560ee945 100644 --- a/bsp/airm2m/air105/board/board.c +++ b/bsp/airm2m/air105/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2022, RT-Thread Development Team + * Copyright (c) 2006-2024 RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,8 +7,11 @@ * Date Author Notes * 2022-02-22 airm2m first version */ - #include "board.h" +#include "drv_common.h" +#include "drv_gpio.h" +#include "drv_usart_v2.h" + uint32_t SystemCoreClock; extern const uint32_t __isr_start_address; @@ -38,7 +41,7 @@ void SystemInit(void) __enable_irq(); } -void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */ +void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */ { SystemCoreClock = HSE_VALUE * (((SYSCTRL->FREQ_SEL & SYSCTRL_FREQ_SEL_XTAL_Mask) >> SYSCTRL_FREQ_SEL_XTAL_Pos) + 1); } @@ -56,7 +59,7 @@ void rt_hw_board_init(void) rt_hw_systick_init(); DMA_GlobalInit(); Uart_GlobalInit(); - DMA_TakeStream(DMA1_STREAM_1);//for qspi + DMA_TakeStream(DMA1_STREAM_1);/* for qspi */ CoreTick_Init(); #ifdef RT_USING_PIN rt_hw_pin_init(); diff --git a/bsp/airm2m/air105/libraries/HAL_Driver/Inc/core_irq.h b/bsp/airm2m/air105/libraries/HAL_Driver/Inc/core_irq.h index 3833dc234be..c8c54004650 100644 --- a/bsp/airm2m/air105/libraries/HAL_Driver/Inc/core_irq.h +++ b/bsp/airm2m/air105/libraries/HAL_Driver/Inc/core_irq.h @@ -21,14 +21,14 @@ #ifndef __CORE_IRQ_H__ #define __CORE_IRQ_H__ - +#include /** * @brief 设置中断回调函数 * * @param Irq 中断号 0~IRQ_LINE_MAX * @param Handler 中断回调函数,如 void Irq_Handler(uint32_t IrqLine, void *pData); 可以多个中断号对应1个中断函数,回调时传入中断号和用户数据 */ -void ISR_SetHandler(int32_t Irq, void *Handler); +void ISR_SetHandler(int32_t Irq, void *Handler, void *pData); /** * @brief 设置中断优先级 * diff --git a/bsp/airm2m/air105/libraries/HAL_Driver/Src/core_dma.c b/bsp/airm2m/air105/libraries/HAL_Driver/Src/core_dma.c index 4de24a03f1b..5bb9393b135 100644 --- a/bsp/airm2m/air105/libraries/HAL_Driver/Src/core_dma.c +++ b/bsp/airm2m/air105/libraries/HAL_Driver/Src/core_dma.c @@ -18,11 +18,11 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - +#include "core_irq.h" #include "user.h" typedef struct { - const DMA_TypeDef *RegBase; + DMA_TypeDef *RegBase; const uint32_t Index; CBFuncEx_t CB; void *pData; @@ -65,17 +65,17 @@ typedef struct /************ operation definition for DMA DMA_CFG_L REGISTER ************/ #define DMA_CFG_HS_SEL_SRC_Pos (11) -#define DMA_CFG_HS_SEL_SRC_Mask (0x01U<DMA_PeripheralDataSize << DMA_CTL_DST_TR_WIDTH_Pos); hwDMAChannal[Stream].TxDir = 1; -// hwDMA->CFG_L = (1 << 18); + /* hwDMA->CFG_L = (1 << 18); */ hwDMA->CFG_L = 0; break; default: @@ -333,7 +333,7 @@ uint32_t DMA_GetDataLength(uint8_t Stream, uint32_t FirstAddress) static void DMA_IrqHandle(int32_t IrqLine, void *pData) { uint32_t i; -// DBG("%x", DMA->StatusTfr_L); + /* DBG("%x", DMA->StatusTfr_L); */ if (DMA->StatusInt_L & (1 << 0)) { for(i = 0; i < DMA_STREAM_QTY; i++) @@ -352,7 +352,7 @@ static void DMA_IrqHandle(int32_t IrqLine, void *pData) if (DMA->StatusErr_L & (1 << i)) { DMA->ClearErr_L = (1 << i); - hwDMAChannal[i].CB(hwDMAChannal[i].pData, 0xffffffff); + hwDMAChannal[i].CB(hwDMAChannal[i].pData, (void *)0xffffffff); } } } diff --git a/bsp/airm2m/air105/libraries/rt_drivers/drv_common.h b/bsp/airm2m/air105/libraries/rt_drivers/drv_common.h index c178b99bb07..da95d91ea0e 100644 --- a/bsp/airm2m/air105/libraries/rt_drivers/drv_common.h +++ b/bsp/airm2m/air105/libraries/rt_drivers/drv_common.h @@ -29,6 +29,12 @@ void _Error_Handler(char *s, int num); #define DMA_NOT_AVAILABLE ((DMA_INSTANCE_TYPE *)0xFFFFFFFFU) +/** + * This function is mainly used for SysTick initialization + * + */ +void rt_hw_systick_init(void); + #ifdef __cplusplus } #endif diff --git a/bsp/airm2m/air105/makesoc.py b/bsp/airm2m/air105/makesoc.py index fb5ebbe08fd..8cb9672c284 100644 --- a/bsp/airm2m/air105/makesoc.py +++ b/bsp/airm2m/air105/makesoc.py @@ -1,9 +1,7 @@ - import os import sys import shutil -import urllib - +import urllib.request out_path='./' bin_file_name='rtthread.bin' pack_path='./pack' @@ -17,13 +15,14 @@ os.remove(out_file+'.soc') if not os.path.exists(pack_path+'/bootloader.bin'): - urllib.urlretrieve("http://cdndownload.openluat.com/rt-thread/airm2m/air105/bootloader.bin", pack_path+'/bootloader.bin') + urllib.request.urlretrieve("http://cdndownload.openluat.com/rt-thread/airm2m/air105/bootloader.bin", pack_path + '/bootloader.bin') if not os.path.exists(pack_path+'/soc_download.exe'): - urllib.urlretrieve("http://cdndownload.openluat.com/rt-thread/airm2m/air105/soc_download.exe", pack_path+'/soc_download.exe') + urllib.request.urlretrieve("http://cdndownload.openluat.com/rt-thread/airm2m/air105/bootloader.bin", pack_path + '/bootloader.bin') shutil.copy(out_path+bin_file_name, pack_path+'/'+bin_file_name) shutil.make_archive(out_file, 'zip', root_dir=pack_path) os.remove(pack_path+'/'+bin_file_name) os.rename(out_file+'.zip',out_file+'.soc') + print('end')