[action/ci] Add bsp detail python script

This commit is contained in:
supperthomas 2024-08-24 23:53:28 +00:00 committed by Meco Man
parent b19672ccc1
commit 1df5be69e8
3 changed files with 3182 additions and 0 deletions

172
tools/ci/bsp_detail.py Normal file
View File

@ -0,0 +1,172 @@
#
# Copyright (c) 2024, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
# Change Logs:
# Date Author Notes
# 2024-08-24 supperthomas the first version
#
# 这个文件会根据bsp中的信息生成对应的bsp_detail.yml文件这个文件会包含bsp中的一些信息比如是否有Kconfig文件是否有template.uvprojx文件等等
# 根据生成的bsp_detail.yml文件会生成一个toolchain_bsp.yml文件这个文件会包含所有的gcc编译器的信息以及对应的bsp文件夹
import os
import pandas as pd
import yaml
from datetime import datetime
import subprocess
#pip install pandas
#pip install tabulate
# 产生toolchain.yml文件
def generate_toolchain_yaml(input_file, output_file, header_comment):
with open(input_file, 'r', encoding='utf-8') as file:
data = yaml.safe_load(file)
toolchain_data = {}
for folder, details in data.items():
gcc = details.get('gcc')
if gcc:
if gcc not in toolchain_data:
toolchain_data[gcc] = {'bsp': []}
toolchain_data[gcc]['bsp'].append(folder)
with open(output_file, 'w', encoding='utf-8') as file:
file.write(f"# {header_comment}\n")
yaml.dump(toolchain_data, file, default_flow_style=False, allow_unicode=True)
# 这个脚本主要用来生成一个bsp相关的信息的文件放到bsp根目录下面
def check_files(root_dir, file_list):
data = []
folders_checked = set()
for projects in sconstruct_paths:
if projects not in folders_checked:
#file_dict = {file: True if os.path.isfile(os.path.join(projects, file)) else '' for file in file_list}
file_dict = {}
for file in file_list:
file_exists = os.path.isfile(os.path.join(projects, file))
if file == 'template.uvprojx':
file_dict['mdk5'] = True if file_exists else False
elif file == 'template.ewp':
file_dict['iar'] = True if file_exists else False
elif file == 'template.uvproj':
file_dict['mdk4'] = True if file_exists else False
elif file == 'template.Uv2':
file_dict['mdk3'] = True if file_exists else False
elif file == 'Kconfig':
file_dict['menuconfig'] = True if file_exists else False
else:
file_dict[file] = True if file_exists else False
# 提取 rtconfig.py 中的 PREFIX 信息
rtconfig_path = os.path.join(projects, 'rtconfig.py')
if os.path.isfile(rtconfig_path):
print(f"Reading {rtconfig_path}")
with open(rtconfig_path, 'r') as f:
for line in f:
if line.strip().startswith('PREFIX'):
prefix_value = line.split('=')[1].strip().strip("'\"")
# 只提取实际的编译器前缀
if 'os.getenv' in prefix_value:
prefix_value = prefix_value.split('or')[-1].strip().strip("'\"")
file_dict['gcc'] = f"{prefix_value}gcc"
print(f"Found PREFIX: {prefix_value} in {rtconfig_path}")
break
else:
print(f"No PREFIX found in {rtconfig_path}")
# 去掉路径中的 '/workspaces/rt-thread/bsp/' 部分
projects2 = projects.replace(root_dir + '/', '')
file_dict['Folder'] = projects2
data.append(file_dict)
#data.append({'Folder': projects2, **file_dict})
folders_checked.add(projects)
df = pd.DataFrame(data)
return df
def find_sconstruct_paths(project_dir, exclude_paths):
sconstruct_paths = []
for root, dirs, files in os.walk(project_dir):
if all(exclude_path not in root for exclude_path in exclude_paths):
if 'SConstruct' in files:
sconstruct_paths.append(root)
return sconstruct_paths
def output_to_markdown(df, output_file):
with open(output_file, 'w', encoding='utf-8') as file:
file.write(df.to_markdown(index=False))
def output_to_yaml(dataframe, output_file, header_comment):
data = dataframe.to_dict(orient='records')
yaml_data = {}
for item in data:
folder = item.pop('Folder')
filtered_item = {k: v for k, v in item.items() if v is True or isinstance(v, str)}
yaml_data[folder] = filtered_item
with open(output_file, 'w', encoding='utf-8') as file:
file.write(f"# {header_comment}\n")
yaml.dump(yaml_data, file, default_flow_style=False, allow_unicode=True)
# 示例用法:
# Find the rt-thread root directory
rtt_root = os.getcwd()
while not os.path.exists(os.path.join(rtt_root, 'LICENSE')):
rtt_root = os.path.dirname(rtt_root)
bsp_root = os.path.join(rtt_root, 'bsp')
exclude_paths = ['templates', 'doc']
files_to_check = ['README.md','rtconfig.h', '.config','Kconfig', 'template.uvprojx','template.ewp', 'README.md', 'README_ZH.md', 'template.Uv2','template.uvproj']
sconstruct_paths = find_sconstruct_paths(bsp_root, exclude_paths)
result_table = check_files(bsp_root, files_to_check)
print(result_table)
output_file = 'output.md'
output_to_markdown(result_table, output_file)
# 将 output.yml 和 toolchain.yml 文件保存到 bsp 目录下
# 获取今天的日期
today_date = datetime.today().strftime('%Y-%m-%d')
# 获取当前年份
current_year = datetime.today().year
def get_git_user_name():
try:
result = subprocess.run(['git', 'config', 'user.name'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode == 0:
return result.stdout.strip()
else:
return "Unknown Author"
except Exception as e:
return "Unknown Author"
# 获取 Git 用户名
author_name = get_git_user_name()
# 头部注释
header_comment = f"""
# Copyright (c) {current_year}, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
# Change Logs:
# Date Author Notes
# {today_date} {author_name} the first version
#
"""
# 将 output.yml 和 toolchain.yml 文件保存到 tools/ci 目录下
ci_dir = os.path.join(rtt_root, 'tools', 'ci')
os.makedirs(ci_dir, exist_ok=True)
bsp_detail_file = os.path.join(ci_dir, 'bsp_detail.yml')
output_to_yaml(result_table, bsp_detail_file, header_comment)
toolchain_output_file = os.path.join(ci_dir, 'toolchain_bsp.yml')
generate_toolchain_yaml(bsp_detail_file, toolchain_output_file, header_comment)

2606
tools/ci/bsp_detail.yml Normal file

File diff suppressed because it is too large Load Diff

404
tools/ci/toolchain_bsp.yml Normal file
View File

@ -0,0 +1,404 @@
#
# Copyright (c) 2024, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
# Change Logs:
# Date Author Notes
# 2024-08-24 supperthomas the first version
#
aarch64-none-elf-gcc:
bsp:
- cvitek/cv18xx_aarch64
- phytium/aarch64
- qemu-virt64-aarch64
- raspberry-pi/raspi3-64
- raspberry-pi/raspi4-64
- rockchip/rk3568
- zynqmp-a53-dfzu2eg
arc-elf32-gcc:
bsp:
- synopsys/boards
arm-none-eabi-gcc:
bsp:
- CME_M7
- Infineon/psoc6-cy8ckit-062-BLE
- Infineon/psoc6-cy8ckit-062-WIFI-BT
- Infineon/psoc6-cy8ckit-062S2-43012
- Infineon/psoc6-cy8ckit-062s4
- Infineon/psoc6-cy8cproto-062S3-4343W
- Infineon/psoc6-evaluationkit-062S2
- Infineon/xmc7200-kit_xmc7200_evk
- Vango/v85xx
- Vango/v85xxp
- acm32/acm32f0x0-nucleo
- acm32/acm32f4xx-nucleo
- airm2m/air105
- airm2m/air32f103
- allwinner_tina
- amebaz
- apm32/apm32e103ze-evalboard
- apm32/apm32e103ze-tinyboard
- apm32/apm32f030r8-miniboard
- apm32/apm32f051r8-evalboard
- apm32/apm32f072vb-miniboard
- apm32/apm32f091vc-miniboard
- apm32/apm32f103vb-miniboard
- apm32/apm32f103xe-minibroard
- apm32/apm32f107vc-evalboard
- apm32/apm32f407ig-minibroard
- apm32/apm32f407zg-evalboard
- apm32/apm32s103vb-miniboard
- apollo2
- asm9260t
- at32/at32a403a-start
- at32/at32a423-start
- at32/at32f402-start
- at32/at32f403a-start
- at32/at32f405-start
- at32/at32f407-start
- at32/at32f413-start
- at32/at32f415-start
- at32/at32f421-start
- at32/at32f423-start
- at32/at32f425-start
- at32/at32f435-start
- at32/at32f437-start
- at91/at91sam9260
- at91/at91sam9g45
- beaglebone
- dm365
- efm32
- essemi/es32f0654
- essemi/es32f365x
- essemi/es32f369x
- fm33lc026
- frdm-k64f
- ft2004
- ft32/ft32f072xb-starter
- fujitsu/mb9x/mb9bf500r
- fujitsu/mb9x/mb9bf506r
- fujitsu/mb9x/mb9bf568r
- fujitsu/mb9x/mb9bf618s
- gd32/arm/gd32103c-eval
- gd32/arm/gd32105c-eval
- gd32/arm/gd32105r-start
- gd32/arm/gd32107c-eval
- gd32/arm/gd32205r-start
- gd32/arm/gd32207i-eval
- gd32/arm/gd32303c-start
- gd32/arm/gd32303e-eval
- gd32/arm/gd32305r-start
- gd32/arm/gd32307e-start
- gd32/arm/gd32407v-lckfb
- gd32/arm/gd32407v-start
- gd32/arm/gd32450z-eval
- gd32/arm/gd32470z-lckfb
- gd32/arm/gd32h759i-start
- hc32/ev_hc32f448_lqfp80
- hc32/ev_hc32f460_lqfp100_v2
- hc32/ev_hc32f472_lqfp100
- hc32/ev_hc32f4a0_lqfp176
- hc32/lckfb-hc32f4a0-lqfp100
- hc32l136
- hc32l196
- hk32/hk32f030c8-mini
- ht32/ht32f12366
- ht32/ht32f52352
- lm3s8962
- lm3s9b9x
- lm4f232
- maxim/max32660-evsys
- microchip/samc21
- microchip/samd51-adafruit-metro-m4
- microchip/samd51-seeed-wio-terminal
- microchip/same54
- microchip/same70
- microchip/saml10
- mini2440
- mini4020
- mm32/mm32f3270-100ask-pitaya
- mm32f103x
- mm32f327x
- mm32l07x
- mm32l3xx
- msp432e401y-LaunchPad
- n32/n32g43xcl-stb
- n32/n32g457qel-stb
- n32/n32g45xcl-stb
- n32/n32g45xml-stb
- n32/n32g45xrl-stb
- n32/n32g45xvl-stb
- n32/n32g4frml-stb
- n32/n32l40xcl-stb
- n32/n32l436-evb
- n32/n32l43xml-stb
- n32/n32l43xrl-stb
- n32/n32wb45xl-evb
- n32g452xx/n32g452xx-mini-system
- nrf5x/nrf51822
- nrf5x/nrf52832
- nrf5x/nrf52833
- nrf5x/nrf52840
- nrf5x/nrf5340
- nuvoton/ma35-rtp
- nuvoton/nk-980iot
- nuvoton/nk-n9h30
- nuvoton/nk-rtu980
- nuvoton/numaker-hmi-ma35d1
- nuvoton/numaker-iot-m467
- nuvoton/numaker-iot-m487
- nuvoton/numaker-iot-ma35d1
- nuvoton/numaker-m032ki
- nuvoton/numaker-m2354
- nuvoton/numaker-m467hj
- nuvoton/numaker-pfm-m487
- nv32f100x
- nxp/imx/imx6sx/cortex-a9
- nxp/imx/imx6ul
- nxp/imx/imx6ull-smart
- nxp/imx/imxrt/imxrt1021-nxp-evk
- nxp/imx/imxrt/imxrt1052-atk-commander
- nxp/imx/imxrt/imxrt1052-fire-pro
- nxp/imx/imxrt/imxrt1052-nxp-evk
- nxp/imx/imxrt/imxrt1052-seeed-ArchMix
- nxp/imx/imxrt/imxrt1060-nxp-evk
- nxp/imx/imxrt/imxrt1061-forlinx-OK1061-S
- nxp/imx/imxrt/imxrt1064-nxp-evk
- nxp/imx/imxrt/imxrt1170-nxp-evk/m7
- nxp/lpc/lpc1114
- nxp/lpc/lpc176x
- nxp/lpc/lpc178x
- nxp/lpc/lpc2148
- nxp/lpc/lpc2478
- nxp/lpc/lpc408x
- nxp/lpc/lpc43xx/M0
- nxp/lpc/lpc43xx/M4
- nxp/lpc/lpc5410x
- nxp/lpc/lpc54114-lite
- nxp/lpc/lpc54608-LPCXpresso
- nxp/lpc/lpc55sxx/Libraries/template/lpc55s6xxxx
- nxp/lpc/lpc55sxx/lpc55s06_nxp_evk
- nxp/lpc/lpc55sxx/lpc55s16_nxp_evk
- nxp/lpc/lpc55sxx/lpc55s28_nxp_evk
- nxp/lpc/lpc55sxx/lpc55s36_nxp_evk
- nxp/lpc/lpc55sxx/lpc55s69_nxp_evk
- nxp/lpc/lpc824
- nxp/mcx/mcxa/frdm-mcxa153
- nxp/mcx/mcxn/frdm-mcxn236
- nxp/mcx/mcxn/frdm-mcxn947
- phytium/aarch32
- qemu-vexpress-a9
- raspberry-pi/raspi2
- raspberry-pi/raspi3-32
- raspberry-pi/raspi4-32
- raspberry-pico
- renesas/ebf_qi_min_6m5
- renesas/libraries/bsp-template
- renesas/ra2l1-cpk
- renesas/ra4m2-eco
- renesas/ra6m3-ek
- renesas/ra6m3-hmi-board
- renesas/ra6m4-cpk
- renesas/ra6m4-iot
- renesas/ra8d1-ek
- renesas/ra8d1-vision-board
- renesas/ra8m1-ek
- renesas/rzt2m_rsk
- rm48x50
- rockchip/rk2108
- sam7x
- samd21
- smartfusion2
- stm32/stm32f072-st-nucleo
- stm32/stm32f091-st-nucleo
- stm32/stm32f103-100ask-mini
- stm32/stm32f103-100ask-pro
- stm32/stm32f103-atk-nano
- stm32/stm32f103-atk-warshipv3
- stm32/stm32f103-blue-pill
- stm32/stm32f103-dofly-M3S
- stm32/stm32f103-dofly-lyc8
- stm32/stm32f103-fire-arbitrary
- stm32/stm32f103-gizwits-gokitv21
- stm32/stm32f103-hw100k-ibox
- stm32/stm32f103-onenet-nbiot
- stm32/stm32f103-yf-ufun
- stm32/stm32f103-ys-f1pro
- stm32/stm32f107-uc-eval
- stm32/stm32f207-st-nucleo
- stm32/stm32f302-st-nucleo
- stm32/stm32f334-st-nucleo
- stm32/stm32f401-st-nucleo
- stm32/stm32f401-weact-blackpill
- stm32/stm32f405-smdz-breadfruit
- stm32/stm32f405zg-mini-template
- stm32/stm32f407-armfly-v5
- stm32/stm32f407-atk-explorer
- stm32/stm32f407-fk407m2-zgt6
- stm32/stm32f407-lckfb-skystar
- stm32/stm32f407-robomaster-c
- stm32/stm32f407-rt-spark
- stm32/stm32f407-st-discovery
- stm32/stm32f410-st-nucleo
- stm32/stm32f411-atk-nano
- stm32/stm32f411-st-nucleo
- stm32/stm32f411-weact-blackpill
- stm32/stm32f412-st-nucleo
- stm32/stm32f413-st-nucleo
- stm32/stm32f427-robomaster-a
- stm32/stm32f429-armfly-v6
- stm32/stm32f429-atk-apollo
- stm32/stm32f429-fire-challenger
- stm32/stm32f429-st-disco
- stm32/stm32f446-st-nucleo
- stm32/stm32f469-st-disco
- stm32/stm32f723-st-disco
- stm32/stm32f746-st-disco
- stm32/stm32f746-st-nucleo
- stm32/stm32f767-atk-apollo
- stm32/stm32f767-fire-challenger-v1
- stm32/stm32f767-st-nucleo
- stm32/stm32f769-st-disco
- stm32/stm32g070-st-nucleo
- stm32/stm32g071-st-nucleo
- stm32/stm32g431-st-nucleo
- stm32/stm32g474-st-nucleo
- stm32/stm32g491-st-nucleo
- stm32/stm32h503-st-nucleo
- stm32/stm32h563-st-nucleo
- stm32/stm32h743-armfly-v7
- stm32/stm32h743-atk-apollo
- stm32/stm32h743-openmv-h7plus
- stm32/stm32h743-st-nucleo
- stm32/stm32h747-st-discovery
- stm32/stm32h750-armfly-h7-tool
- stm32/stm32h750-artpi
- stm32/stm32h750-fk750m1-vbt6
- stm32/stm32h750-weact-ministm32h7xx
- stm32/stm32h7s7-st-disco
- stm32/stm32l010-st-nucleo
- stm32/stm32l053-st-nucleo
- stm32/stm32l412-st-nucleo
- stm32/stm32l431-BearPi
- stm32/stm32l431-tencentos-tiny-EVB_MX+
- stm32/stm32l432-st-nucleo
- stm32/stm32l433-ali-startkit
- stm32/stm32l433-st-nucleo
- stm32/stm32l452-st-nucleo
- stm32/stm32l475-atk-pandora
- stm32/stm32l475-st-discovery
- stm32/stm32l476-st-nucleo
- stm32/stm32l496-ali-developer
- stm32/stm32l496-st-discovery
- stm32/stm32l496-st-nucleo
- stm32/stm32l4r5-st-nucleo
- stm32/stm32l4r9-st-eval
- stm32/stm32l4r9-st-sensortile-box
- stm32/stm32l552-st-nucleo
- stm32/stm32mp157a-st-discovery
- stm32/stm32mp157a-st-ev1
- stm32/stm32u575-st-nucleo
- stm32/stm32u585-iot02a
- stm32/stm32wb55-st-nucleo
- stm32/stm32wl55-st-nucleo
- stm32/stm32wle5-yizhilian-lm401
- stm32/stm32wle5-yizhilian-lm402
- synwit/swm320-mini
- synwit/swm341-mini
- ti/c28x/tms320f28379d
- tkm32F499
- tm4c123bsp
- tm4c129x
- w60x
- wch/arm/ch32f103c8-core
- wch/arm/ch32f203r-evt
- wch/arm/ch579m
- xplorer4330/M0
- xplorer4330/M4
- yichip/yc3121-pos
- yichip/yc3122-pos
- zynqmp-r5-axu4ev
avr32-gcc:
bsp:
- avr32/at32uc3a0256
- avr32/at32uc3b0256
csky-abiv2-elf-gcc:
bsp:
- ck802
- essemi/es32vf2264
gcc:
bsp:
- simulator
i386-unknown-elf-gcc:
bsp:
- x86
m32c-elf-gcc:
bsp:
- m16c62p
- upd70f3454
mips-sde-elf-gcc:
bsp:
- loongson/ls1bdev
- loongson/ls1cdev
- loongson/ls2kdev
- mipssim
powerpc-eabi-gcc:
bsp:
- taihu
riscv-none-embed-gcc:
bsp:
- gd32/risc-v/gd32vf103r-start
- gd32/risc-v/gd32vf103v-eval
- hifive1
- juicevm
- k210
- rv32m1_vega/ri5cy
- wch/risc-v/ch32v103r-evt
- wch/risc-v/ch32v208w-r0
- wch/risc-v/ch32v307v-r1
- wch/risc-v/ch569w-evt
- wch/risc-v/yd-ch32v307vct6
riscv-nuclei-elf-gcc:
bsp:
- nuclei/gd32vf103_rvstar
- nuclei/nuclei_fpga_eval
riscv32-esp-elf-gcc:
bsp:
- ESP32_C3
riscv32-unknown-elf-gcc:
bsp:
- core-v-mcu/core-v-cv32e40p
- hpmicro/hpm5300evk
- hpmicro/hpm5301evklite
- hpmicro/hpm6200evk
- hpmicro/hpm6300evk
- hpmicro/hpm6750evk
- hpmicro/hpm6750evk2
- hpmicro/hpm6750evkmini
- hpmicro/hpm6800evk
riscv64-unknown-elf-gcc:
bsp:
- bluetrum/ab32vg1-ab-prougen
- bouffalo_lab/bl60x
- bouffalo_lab/bl61x
- bouffalo_lab/bl70x
- bouffalo_lab/bl808/lp
- bouffalo_lab/bl808/m0
- cvitek/c906_little
- cvitek/cv18xx_risc-v
- qemu-virt64-riscv
- sparkfun-redv
- thead-smart
riscv64-unknown-linux-musl-gcc:
bsp:
- allwinner/d1
- allwinner/d1s
- bouffalo_lab/bl808/d0
sparc-gaisler-elf-gcc:
bsp:
- bm3803
unicore32-linux-gcc:
bsp:
- sep6200