Skip to content

Commit 151c7a6

Browse files
authored
[action/ci] 把每次编译结果上传到github (#10135)
* [action/ci] 把每次编译结果上传到github * [fix] * add output * fix * fixthe attach_file_name * fix * fix name * [action] 更新一下toolchain的版本号 * [bsp/stm32] hex 生成 * Update type.h
1 parent cdb5ce8 commit 151c7a6

File tree

10 files changed

+54
-25
lines changed

10 files changed

+54
-25
lines changed

.github/workflows/bsp_buildings.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
#
2+
# Copyright (c) 2025, RT-Thread Development Team
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Change Logs:
7+
# Date Author Notes
8+
# 2025-03-22 Supperthomas 添加upload 上传编译固件
9+
#
110
name: RT-Thread BSP Static Build Check
211

312
# Controls when the action will run. Triggers the workflow on push or pull request
@@ -41,11 +50,11 @@ jobs:
4150
RTT_TOOL_CHAIN: "sourcery-arm"
4251
SUB_RTT_BSP:
4352
- "stm32/stm32f407-rt-spark"
44-
- RTT_BSP: "RTduino/Arduino Libraries (STM32F412 Nucleo)"
53+
- RTT_BSP: "RTduino_Arduino Libraries (STM32F412 Nucleo)"
4554
RTT_TOOL_CHAIN: "sourcery-arm"
4655
SUB_RTT_BSP:
4756
- "stm32/stm32f412-st-nucleo"
48-
- RTT_BSP: "RTduino/Arduino Libraries (Raspberry Pico)"
57+
- RTT_BSP: "RTduino_Arduino Libraries (Raspberry Pico)"
4958
RTT_TOOL_CHAIN: "sourcery-arm"
5059
SUB_RTT_BSP:
5160
- "raspberry-pico"
@@ -433,22 +442,22 @@ jobs:
433442
id: cache-gcc-arm
434443
uses: actions/cache@main
435444
with:
436-
path: /opt/gcc-arm-none-eabi-10-2020-q4-major
437-
key: ${{ runner.os }}-arm-none-eabi-10-2020-q4-major
445+
path: /opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi
446+
key: ${{ runner.os }}-arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi
438447

439448
- name: Download Arm ToolChains
440449
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm' && (steps.cache-gcc-arm.outputs.cache-hit != 'true') }}
441450
shell: bash
442451
run: |
443-
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.3/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
444-
sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt
452+
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.8/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
453+
sudo tar -xf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz -C /opt
445454
446455
- name: Install Arm ToolChains2
447456
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm'}}
448457
shell: bash
449458
run: |
450-
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version
451-
echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV
459+
/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc --version
460+
echo "RTT_EXEC_PATH=/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin" >> $GITHUB_ENV
452461
453462
- name: Install LLVM-Arm ToolChains
454463
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'llvm-arm' && success() }}
@@ -536,6 +545,14 @@ jobs:
536545
source ~/.env/env.sh
537546
python tools/ci/bsp_buildings.py
538547
548+
- name: Upload output as artifact
549+
if: ${{ success() }}
550+
uses: actions/upload-artifact@main
551+
with:
552+
name: ${{ matrix.legs.RTT_BSP }}
553+
if-no-files-found: ignore
554+
path: output/
555+
539556
- name: Post failure comment
540557
if: failure()
541558
run: |

bsp/nrf5x/nrf52833/rtconfig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
CFLAGS += ' -O2'
5656

5757
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
58-
58+
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
59+
5960
elif PLATFORM == 'armcc':
6061
# toolchains
6162
CC = 'armcc'

bsp/nrf5x/nrf52840/rtconfig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
CFLAGS += ' -O2'
5656

5757
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
58-
58+
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
59+
5960
elif PLATFORM == 'armcc':
6061
# toolchains
6162
CC = 'armcc'

bsp/stm32/stm32f103-blue-pill/rtconfig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
CXXFLAGS = CFLAGS
6161

6262
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
63-
63+
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
64+
6465
elif PLATFORM == 'armcc':
6566
# toolchains
6667
CC = 'armcc'

bsp/stm32/stm32f407-rt-spark/rtconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
CXXFLAGS = CFLAGS
6565

66-
POST_ACTION = OBJCPY + ' -O ihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n'
66+
POST_ACTION = OBJCPY + ' -O ihex $TARGET rtthread.hex\n'
6767
POST_ACTION += OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
6868

6969
elif PLATFORM == 'armcc':

bsp/stm32/stm32h750-artpi/rtconfig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
CFLAGS += ' -std=gnu99'
6262

6363
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
64-
64+
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
65+
6566
elif PLATFORM == 'armcc':
6667
# toolchains
6768
CC = 'armcc'

bsp/stm32/stm32l496-st-nucleo/rtconfig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
CXXFLAGS = CFLAGS
6262

6363
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
64+
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
6465

6566
elif PLATFORM == 'armcc':
6667
# toolchains

bsp/stm32/stm32wb55-st-nucleo/rtconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
CXXFLAGS = CFLAGS
6161

6262
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
63-
63+
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
6464
elif PLATFORM == 'armcc':
6565
# toolchains
6666
CC = 'armcc'

bsp/yichip/yc3121-pos/Libraries/core/type.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@ typedef signed int int32_t;
2323
typedef signed long long int64_t;
2424
#else
2525
#include "stdio.h"
26+
#include "stdint.h"
2627
typedef unsigned char byte;
2728
typedef unsigned short word;
2829
#endif
2930

30-
/**
31+
/**
3132
* @brief __NOINLINE definition
32-
*/
33+
*/
3334
#if defined ( __CC_ARM ) || defined ( __GNUC__ )
34-
/* ARM & GNUCompiler
35-
----------------
35+
/* ARM & GNUCompiler
36+
----------------
3637
*/
3738
#define __NOINLINE noinline
3839

tools/ci/bsp_buildings.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def run_cmd(cmd, output_info=True):
3636
return output_str_list, res
3737

3838

39-
def build_bsp(bsp, scons_args=''):
39+
def build_bsp(bsp, scons_args='',name='default'):
4040
"""
4141
build bsp.
4242
@@ -57,6 +57,7 @@ def build_bsp(bsp, scons_args=''):
5757
"""
5858
success = True
5959
os.chdir(rtt_root)
60+
os.makedirs(f'{rtt_root}/output/bsp/{bsp}', exist_ok=True)
6061
if os.path.exists(f"{rtt_root}/bsp/{bsp}/Kconfig"):
6162
os.chdir(rtt_root)
6263
run_cmd(f'scons -C bsp/{bsp} --pyconfig-silent', output_info=False)
@@ -67,18 +68,23 @@ def build_bsp(bsp, scons_args=''):
6768

6869
nproc = multiprocessing.cpu_count()
6970
os.chdir(rtt_root)
70-
cmd = f'scons -C bsp/{bsp} -j{nproc} {scons_args} --debug=time'
71+
cmd = f'scons -C bsp/{bsp} -j{nproc} {scons_args}' # --debug=time for debug time
7172
__, res = run_cmd(cmd, output_info=True)
7273

7374
if res != 0:
7475
success = False
76+
else:
77+
#拷贝当前的文件夹下面的所有以elf结尾的文件拷贝到rt-thread/output文件夹下
78+
import glob
79+
# 拷贝编译生成的文件到output目录,文件拓展为 elf,bin,hex
80+
for file_type in ['*.elf', '*.bin', '*.hex']:
81+
files = glob.glob(f'{rtt_root}/bsp/{bsp}/{file_type}')
82+
for file in files:
83+
shutil.copy(file, f'{rtt_root}/output/bsp/{bsp}/{name.replace("/", "_")}.{file_type[2:]}')
7584

7685
os.chdir(f'{rtt_root}/bsp/{bsp}')
7786
run_cmd('scons -c', output_info=False)
7887

79-
#pkg_dir = os.path.join(rtt_root, 'bsp', bsp, 'packages')
80-
#shutil.rmtree(pkg_dir, ignore_errors=True)
81-
8288
return success
8389

8490

@@ -145,7 +151,7 @@ def build_bsp_attachconfig(bsp, attach_file):
145151

146152
scons_args = check_scons_args(attach_path)
147153

148-
res = build_bsp(bsp, scons_args)
154+
res = build_bsp(bsp, scons_args,name=attach_file)
149155

150156
shutil.copyfile(config_bacakup, config_file)
151157
os.remove(config_bacakup)
@@ -220,7 +226,7 @@ def build_bsp_attachconfig(bsp, attach_file):
220226
scons_arg.append(line)
221227
scons_arg_str=' '.join(scons_arg) if scons_arg else ' '
222228
print(f"::group::\tCompiling yml project: =={count}==={name}=scons_arg={scons_arg_str}==")
223-
res = build_bsp(bsp, scons_arg_str)
229+
res = build_bsp(bsp, scons_arg_str,name=name)
224230
if not res:
225231
print(f"::error::build {bsp} {name} failed.")
226232
add_summary(f'\t- ❌ build {bsp} {name} failed.')

0 commit comments

Comments
 (0)