From 4f10d05a5b0c4bd3bd53545e5fff1e05da4729cc Mon Sep 17 00:00:00 2001 From: CYFS <2805686936@qq.com> Date: Thu, 29 Aug 2024 06:31:59 +0800 Subject: [PATCH] =?UTF-8?q?[bsp][ht32]=20=E4=BF=AE=E5=A4=8D=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复scons编译问题并添加ci --- .github/workflows/bsp_buildings.yml | 4 ++- bsp/ht32/ht32f12366/rtconfig.py | 2 +- bsp/ht32/ht32f52352/rtconfig.py | 2 +- .../libraries/HT32_STD_1xxxx_FWLib/SConscript | 28 +++++++++++++++++- .../libraries/HT32_STD_5xxxx_FWLib/SConscript | 29 ++++++++++++++++++- bsp/ht32/tools/sdk_dist.py | 24 --------------- 6 files changed, 60 insertions(+), 29 deletions(-) diff --git a/.github/workflows/bsp_buildings.yml b/.github/workflows/bsp_buildings.yml index 26c8053f71..a99afd80ce 100644 --- a/.github/workflows/bsp_buildings.yml +++ b/.github/workflows/bsp_buildings.yml @@ -49,7 +49,7 @@ jobs: RTT_TOOL_CHAIN: "sourcery-arm" SUB_RTT_BSP: - "raspberry-pico" - - RTT_BSP: "others_at32_hc32" + - RTT_BSP: "others_at32_hc32_ht32" RTT_TOOL_CHAIN: "sourcery-arm" SUB_RTT_BSP: - "qemu-vexpress-a9" @@ -96,6 +96,8 @@ jobs: - "acm32/acm32f0x0-nucleo" - "acm32/acm32f4xx-nucleo" - "rm48x50" + - "ht32/ht32f52352" + - "ht32/ht32f12366" - RTT_BSP: "stm32l4_f0_f1" RTT_TOOL_CHAIN: "sourcery-arm" SUB_RTT_BSP: diff --git a/bsp/ht32/ht32f12366/rtconfig.py b/bsp/ht32/ht32f12366/rtconfig.py index 1c3077b6cf..33ae6cc4fa 100644 --- a/bsp/ht32/ht32f12366/rtconfig.py +++ b/bsp/ht32/ht32f12366/rtconfig.py @@ -48,7 +48,7 @@ if PLATFORM == 'gcc': CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' - + CFLAGS += ' -D USE_HT32F12365_66' CPATH = '' LPATH = '' diff --git a/bsp/ht32/ht32f52352/rtconfig.py b/bsp/ht32/ht32f52352/rtconfig.py index 964fa9313e..0525f0267a 100644 --- a/bsp/ht32/ht32f52352/rtconfig.py +++ b/bsp/ht32/ht32f52352/rtconfig.py @@ -48,7 +48,7 @@ if PLATFORM == 'gcc': CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' - + CFLAGS += ' -D USE_HT32F52342_52' CPATH = '' LPATH = '' diff --git a/bsp/ht32/libraries/HT32_STD_1xxxx_FWLib/SConscript b/bsp/ht32/libraries/HT32_STD_1xxxx_FWLib/SConscript index 7e3699bd21..ef04fa4fa9 100644 --- a/bsp/ht32/libraries/HT32_STD_1xxxx_FWLib/SConscript +++ b/bsp/ht32/libraries/HT32_STD_1xxxx_FWLib/SConscript @@ -2,11 +2,37 @@ import os import sys import rtconfig from building import * + +def get_source(ic_model, file_path, system_path, base_path): + source_path = [] + files_list = [] + readafter = 0 + if not os.path.isfile(file_path): + return + + with open(file_path, 'r') as file: + # content = file.read() + for line in file: + if readafter == 2 and line.find('>') != -1: + break + if readafter == 2: + files_list.append(line.strip()) + if line.find(ic_model) != -1: + readafter = 1 + if readafter == 1 and line.find('<') != -1: + readafter = 2 + for line in files_list: + if line.find('system') != -1: + source_path.append(os.path.join(system_path, line.strip())) + else: + source_path.append(os.path.join(base_path, line.strip())) + return source_path + Import('rtconfig') tools_path = os.path.normpath(os.getcwd() + '../../..' + '/tools') sys.path.append(tools_path) -from sdk_dist import get_source + source_file_path = os.path.join(os.getcwd(), 'Source_file') base_path = 'library/HT32F1xxxx_Driver/src/' diff --git a/bsp/ht32/libraries/HT32_STD_5xxxx_FWLib/SConscript b/bsp/ht32/libraries/HT32_STD_5xxxx_FWLib/SConscript index 2411aa028f..32e59edc7c 100644 --- a/bsp/ht32/libraries/HT32_STD_5xxxx_FWLib/SConscript +++ b/bsp/ht32/libraries/HT32_STD_5xxxx_FWLib/SConscript @@ -2,11 +2,38 @@ import os import sys import rtconfig from building import * + +def get_source(ic_model, file_path, system_path, base_path): + source_path = [] + files_list = [] + readafter = 0 + if not os.path.isfile(file_path): + return + + with open(file_path, 'r') as file: + # content = file.read() + for line in file: + if readafter == 2 and line.find('>') != -1: + break + if readafter == 2: + files_list.append(line.strip()) + if line.find(ic_model) != -1: + readafter = 1 + if readafter == 1 and line.find('<') != -1: + readafter = 2 + for line in files_list: + if line.find('system') != -1: + source_path.append(os.path.join(system_path, line.strip())) + else: + source_path.append(os.path.join(base_path, line.strip())) + return source_path + + Import('rtconfig') tools_path = os.path.normpath(os.getcwd() + '../../..' + '/tools') sys.path.append(tools_path) -from sdk_dist import get_source + source_file_path = os.path.join(os.getcwd(), 'Source_file') base_path = 'library/HT32F5xxxx_Driver/src/' diff --git a/bsp/ht32/tools/sdk_dist.py b/bsp/ht32/tools/sdk_dist.py index 01540d7ec6..49b2c2872a 100644 --- a/bsp/ht32/tools/sdk_dist.py +++ b/bsp/ht32/tools/sdk_dist.py @@ -37,27 +37,3 @@ def dist_do_building(BSP_ROOT, dist_dir): bsp_update_kconfig_library(dist_dir) -def get_source(ic_model, file_path, system_path, base_path): - source_path = [] - files_list = [] - readafter = 0 - if not os.path.isfile(file_path): - return - - with open(file_path, 'r') as file: - # content = file.read() - for line in file: - if readafter == 2 and line.find('>') != -1: - break - if readafter == 2: - files_list.append(line.strip()) - if line.find(ic_model) != -1: - readafter = 1 - if readafter == 1 and line.find('<') != -1: - readafter = 2 - for line in files_list: - if line.find('system') != -1: - source_path.append(os.path.join(system_path, line.strip())) - else: - source_path.append(os.path.join(base_path, line.strip())) - return source_path