Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions .github/workflows/bsp_buildings.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#
# Copyright (c) 2025, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
# Change Logs:
# Date Author Notes
# 2025-03-22 Supperthomas 添加upload 上传编译固件
#
name: RT-Thread BSP Static Build Check

# Controls when the action will run. Triggers the workflow on push or pull request
Expand Down Expand Up @@ -41,11 +50,11 @@ jobs:
RTT_TOOL_CHAIN: "sourcery-arm"
SUB_RTT_BSP:
- "stm32/stm32f407-rt-spark"
- RTT_BSP: "RTduino/Arduino Libraries (STM32F412 Nucleo)"
- RTT_BSP: "RTduino_Arduino Libraries (STM32F412 Nucleo)"
RTT_TOOL_CHAIN: "sourcery-arm"
SUB_RTT_BSP:
- "stm32/stm32f412-st-nucleo"
- RTT_BSP: "RTduino/Arduino Libraries (Raspberry Pico)"
- RTT_BSP: "RTduino_Arduino Libraries (Raspberry Pico)"
RTT_TOOL_CHAIN: "sourcery-arm"
SUB_RTT_BSP:
- "raspberry-pico"
Expand Down Expand Up @@ -433,22 +442,22 @@ jobs:
id: cache-gcc-arm
uses: actions/cache@main
with:
path: /opt/gcc-arm-none-eabi-10-2020-q4-major
key: ${{ runner.os }}-arm-none-eabi-10-2020-q4-major
path: /opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi
key: ${{ runner.os }}-arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi

- name: Download Arm ToolChains
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm' && (steps.cache-gcc-arm.outputs.cache-hit != 'true') }}
shell: bash
run: |
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
sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt
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
sudo tar -xf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz -C /opt

- name: Install Arm ToolChains2
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm'}}
shell: bash
run: |
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version
echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV
/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc --version
echo "RTT_EXEC_PATH=/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin" >> $GITHUB_ENV

- name: Install LLVM-Arm ToolChains
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'llvm-arm' && success() }}
Expand Down Expand Up @@ -536,6 +545,14 @@ jobs:
source ~/.env/env.sh
python tools/ci/bsp_buildings.py

- name: Upload output as artifact
if: ${{ success() }}
uses: actions/upload-artifact@main
with:
name: ${{ matrix.legs.RTT_BSP }}
if-no-files-found: ignore
path: output/

- name: Post failure comment
if: failure()
run: |
Expand Down
3 changes: 2 additions & 1 deletion bsp/nrf5x/nrf52833/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
CFLAGS += ' -O2'

POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'

POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'

elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
Expand Down
3 changes: 2 additions & 1 deletion bsp/nrf5x/nrf52840/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
CFLAGS += ' -O2'

POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'

POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'

elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
Expand Down
3 changes: 2 additions & 1 deletion bsp/stm32/stm32f103-blue-pill/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
CXXFLAGS = CFLAGS

POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'

POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'

elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
Expand Down
2 changes: 1 addition & 1 deletion bsp/stm32/stm32f407-rt-spark/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

CXXFLAGS = CFLAGS

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

elif PLATFORM == 'armcc':
Expand Down
3 changes: 2 additions & 1 deletion bsp/stm32/stm32h750-artpi/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
CFLAGS += ' -std=gnu99'

POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'

POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'

elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
Expand Down
1 change: 1 addition & 0 deletions bsp/stm32/stm32l496-st-nucleo/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
CXXFLAGS = CFLAGS

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

elif PLATFORM == 'armcc':
# toolchains
Expand Down
2 changes: 1 addition & 1 deletion bsp/stm32/stm32wb55-st-nucleo/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
CXXFLAGS = CFLAGS

POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'

POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
Expand Down
9 changes: 5 additions & 4 deletions bsp/yichip/yc3121-pos/Libraries/core/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ typedef signed int int32_t;
typedef signed long long int64_t;
#else
#include "stdio.h"
#include "stdint.h"
typedef unsigned char byte;
typedef unsigned short word;
#endif

/**
/**
* @brief __NOINLINE definition
*/
*/
#if defined ( __CC_ARM ) || defined ( __GNUC__ )
/* ARM & GNUCompiler
----------------
/* ARM & GNUCompiler
----------------
*/
#define __NOINLINE noinline

Expand Down
20 changes: 13 additions & 7 deletions tools/ci/bsp_buildings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def run_cmd(cmd, output_info=True):
return output_str_list, res


def build_bsp(bsp, scons_args=''):
def build_bsp(bsp, scons_args='',name='default'):
"""
build bsp.

Expand All @@ -57,6 +57,7 @@ def build_bsp(bsp, scons_args=''):
"""
success = True
os.chdir(rtt_root)
os.makedirs(f'{rtt_root}/output/bsp/{bsp}', exist_ok=True)
if os.path.exists(f"{rtt_root}/bsp/{bsp}/Kconfig"):
os.chdir(rtt_root)
run_cmd(f'scons -C bsp/{bsp} --pyconfig-silent', output_info=False)
Expand All @@ -67,18 +68,23 @@ def build_bsp(bsp, scons_args=''):

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

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

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

#pkg_dir = os.path.join(rtt_root, 'bsp', bsp, 'packages')
#shutil.rmtree(pkg_dir, ignore_errors=True)

return success


Expand Down Expand Up @@ -145,7 +151,7 @@ def build_bsp_attachconfig(bsp, attach_file):

scons_args = check_scons_args(attach_path)

res = build_bsp(bsp, scons_args)
res = build_bsp(bsp, scons_args,name=attach_file)

shutil.copyfile(config_bacakup, config_file)
os.remove(config_bacakup)
Expand Down Expand Up @@ -220,7 +226,7 @@ def build_bsp_attachconfig(bsp, attach_file):
scons_arg.append(line)
scons_arg_str=' '.join(scons_arg) if scons_arg else ' '
print(f"::group::\tCompiling yml project: =={count}==={name}=scons_arg={scons_arg_str}==")
res = build_bsp(bsp, scons_arg_str)
res = build_bsp(bsp, scons_arg_str,name=name)
if not res:
print(f"::error::build {bsp} {name} failed.")
add_summary(f'\t- ❌ build {bsp} {name} failed.')
Expand Down