mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-07 01:44:41 +08:00
[tools/mdk5] 如果本地设置了UV4.exe 命令,则进行MDK编译
Some checks are pending
ToolsCI / Tools (push) Waiting to run
AutoTestCI / components/cpp11 (push) Waiting to run
AutoTestCI / kernel/atomic (push) Waiting to run
AutoTestCI / kernel/atomic/riscv64 (push) Waiting to run
AutoTestCI / kernel/atomic_c11 (push) Waiting to run
AutoTestCI / kernel/atomic_c11/riscv64 (push) Waiting to run
AutoTestCI / kernel/device (push) Waiting to run
AutoTestCI / kernel/ipc (push) Waiting to run
AutoTestCI / kernel/irq (push) Waiting to run
AutoTestCI / kernel/mem (push) Waiting to run
AutoTestCI / kernel/mem/riscv64 (push) Waiting to run
AutoTestCI / kernel/thread (push) Waiting to run
AutoTestCI / kernel/timer (push) Waiting to run
AutoTestCI / rtsmart/aarch64 (push) Waiting to run
AutoTestCI / rtsmart/arm (push) Waiting to run
AutoTestCI / rtsmart/riscv64 (push) Waiting to run
AutoTestCI / components/utest (push) Waiting to run
RT-Thread BSP Static Build Check / ESP32C3 (push) Waiting to run
RT-Thread BSP Static Build Check / Infineon_TI_microchip (push) Waiting to run
RT-Thread BSP Static Build Check / RT-Thread Online Packages (STM32F407 RT-Spark) (push) Waiting to run
RT-Thread BSP Static Build Check / RTduino/Arduino Libraries (Raspberry Pico) (push) Waiting to run
RT-Thread BSP Static Build Check / RTduino/Arduino Libraries (STM32F412 Nucleo) (push) Waiting to run
RT-Thread BSP Static Build Check / aarch64 (push) Waiting to run
RT-Thread BSP Static Build Check / gd32_n32_apm32 (push) Waiting to run
RT-Thread BSP Static Build Check / hpmicro (push) Waiting to run
RT-Thread BSP Static Build Check / i386-unknown (push) Waiting to run
RT-Thread BSP Static Build Check / llvm-arm (push) Waiting to run
RT-Thread BSP Static Build Check / mips (push) Waiting to run
RT-Thread BSP Static Build Check / nordic(yml) (push) Waiting to run
RT-Thread BSP Static Build Check / nuvoton (push) Waiting to run
RT-Thread BSP Static Build Check / nxp_renesas (push) Waiting to run
RT-Thread BSP Static Build Check / others_at32_hc32_ht32 (push) Waiting to run
RT-Thread BSP Static Build Check / riscv-none (push) Waiting to run
RT-Thread BSP Static Build Check / riscv64-unknown (push) Waiting to run
RT-Thread BSP Static Build Check / simulator (push) Waiting to run
RT-Thread BSP Static Build Check / stm32_f2_f4 (push) Waiting to run
RT-Thread BSP Static Build Check / stm32_f7_g0_h7_mp15_u5_h5_wb5 (push) Waiting to run
RT-Thread BSP Static Build Check / stm32l4_f0_f1 (push) Waiting to run
BSP compilation with more drivers / BSP Compilation with More Drivers (push) Waiting to run
pkgs_test / change (push) Waiting to run
Some checks are pending
ToolsCI / Tools (push) Waiting to run
AutoTestCI / components/cpp11 (push) Waiting to run
AutoTestCI / kernel/atomic (push) Waiting to run
AutoTestCI / kernel/atomic/riscv64 (push) Waiting to run
AutoTestCI / kernel/atomic_c11 (push) Waiting to run
AutoTestCI / kernel/atomic_c11/riscv64 (push) Waiting to run
AutoTestCI / kernel/device (push) Waiting to run
AutoTestCI / kernel/ipc (push) Waiting to run
AutoTestCI / kernel/irq (push) Waiting to run
AutoTestCI / kernel/mem (push) Waiting to run
AutoTestCI / kernel/mem/riscv64 (push) Waiting to run
AutoTestCI / kernel/thread (push) Waiting to run
AutoTestCI / kernel/timer (push) Waiting to run
AutoTestCI / rtsmart/aarch64 (push) Waiting to run
AutoTestCI / rtsmart/arm (push) Waiting to run
AutoTestCI / rtsmart/riscv64 (push) Waiting to run
AutoTestCI / components/utest (push) Waiting to run
RT-Thread BSP Static Build Check / ESP32C3 (push) Waiting to run
RT-Thread BSP Static Build Check / Infineon_TI_microchip (push) Waiting to run
RT-Thread BSP Static Build Check / RT-Thread Online Packages (STM32F407 RT-Spark) (push) Waiting to run
RT-Thread BSP Static Build Check / RTduino/Arduino Libraries (Raspberry Pico) (push) Waiting to run
RT-Thread BSP Static Build Check / RTduino/Arduino Libraries (STM32F412 Nucleo) (push) Waiting to run
RT-Thread BSP Static Build Check / aarch64 (push) Waiting to run
RT-Thread BSP Static Build Check / gd32_n32_apm32 (push) Waiting to run
RT-Thread BSP Static Build Check / hpmicro (push) Waiting to run
RT-Thread BSP Static Build Check / i386-unknown (push) Waiting to run
RT-Thread BSP Static Build Check / llvm-arm (push) Waiting to run
RT-Thread BSP Static Build Check / mips (push) Waiting to run
RT-Thread BSP Static Build Check / nordic(yml) (push) Waiting to run
RT-Thread BSP Static Build Check / nuvoton (push) Waiting to run
RT-Thread BSP Static Build Check / nxp_renesas (push) Waiting to run
RT-Thread BSP Static Build Check / others_at32_hc32_ht32 (push) Waiting to run
RT-Thread BSP Static Build Check / riscv-none (push) Waiting to run
RT-Thread BSP Static Build Check / riscv64-unknown (push) Waiting to run
RT-Thread BSP Static Build Check / simulator (push) Waiting to run
RT-Thread BSP Static Build Check / stm32_f2_f4 (push) Waiting to run
RT-Thread BSP Static Build Check / stm32_f7_g0_h7_mp15_u5_h5_wb5 (push) Waiting to run
RT-Thread BSP Static Build Check / stm32l4_f0_f1 (push) Waiting to run
BSP compilation with more drivers / BSP Compilation with More Drivers (push) Waiting to run
pkgs_test / change (push) Waiting to run
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
import os
|
||||
import sys
|
||||
import string
|
||||
import shutil
|
||||
|
||||
import xml.etree.ElementTree as etree
|
||||
from xml.etree.ElementTree import SubElement
|
||||
@@ -337,7 +338,26 @@ def MDK4Project(target, script):
|
||||
if os.path.exists('template.uvopt'):
|
||||
import shutil
|
||||
shutil.copy2('template.uvopt', '{}.uvopt'.format(os.path.splitext(target)[0]))
|
||||
|
||||
import threading
|
||||
import time
|
||||
def monitor_log_file(log_file_path):
|
||||
if not os.path.exists(log_file_path):
|
||||
open(log_file_path, 'w').close()
|
||||
empty_line_count = 0
|
||||
with open(log_file_path, 'r') as log_file:
|
||||
while True:
|
||||
line = log_file.readline()
|
||||
if line:
|
||||
print(line.strip())
|
||||
if 'Build Time Elapsed' in line:
|
||||
break
|
||||
empty_line_count = 0
|
||||
else:
|
||||
empty_line_count += 1
|
||||
time.sleep(1)
|
||||
if empty_line_count > 30:
|
||||
print("Timeout reached or too many empty lines, exiting log monitoring thread.")
|
||||
break
|
||||
def MDK5Project(target, script):
|
||||
|
||||
if os.path.isfile('template.uvprojx') is False:
|
||||
@@ -356,6 +376,22 @@ def MDK5Project(target, script):
|
||||
if os.path.exists('template.uvoptx'):
|
||||
import shutil
|
||||
shutil.copy2('template.uvoptx', '{}.uvoptx'.format(os.path.splitext(target)[0]))
|
||||
# build with UV4.exe
|
||||
|
||||
if shutil.which('UV4.exe') is not None:
|
||||
target_name = template_tree.find('Targets/Target/TargetName')
|
||||
print('target_name:', target_name.text)
|
||||
log_file_path = 'keil.log'
|
||||
if os.path.exists(log_file_path):
|
||||
os.remove(log_file_path)
|
||||
log_thread = threading.Thread(target=monitor_log_file, args=(log_file_path,))
|
||||
log_thread.start()
|
||||
cmd = 'UV4.exe -b project.uvprojx -q -j0 -t '+ target_name.text +' -o '+log_file_path
|
||||
print('Start to build keil project')
|
||||
print(cmd)
|
||||
os.system(cmd)
|
||||
else:
|
||||
print('UV4.exe is not available, please check your keil installation')
|
||||
|
||||
def MDK2Project(target, script):
|
||||
template = open('template.Uv2', "r")
|
||||
|
||||
Reference in New Issue
Block a user