Skip to content

Commit 98ecb0c

Browse files
authored
Merge pull request #1 from atxhua/x86-new-cc
add x86 gcc
2 parents 5b5bd39 + 792a161 commit 98ecb0c

4 files changed

Lines changed: 35 additions & 22 deletions

File tree

.github/workflows/manual_dist.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ on:
3535
- "sourcery-riscv64-unknown-elf"
3636
- "gcc"
3737
- "sourcery-riscv32-esp32"
38+
- "i686-x86-newlib"
3839
bsp_config:
3940
description: 'Type a config you want mannual test in .config, like: CONFIG_RT_USING_DEBUG=y,CONFIG_RT_DEBUGING_COLOR=y,CONFIG_RT_DEBUGING_CONTEXT=y'
4041
required: false
@@ -127,6 +128,13 @@ jobs:
127128
run: |
128129
sudo apt-get -qq install libsdl2-dev
129130
131+
- name: Install i686 X86 Newlib ToolChains
132+
if: ${{ github.event.inputs.bsp_tool_chain == 'i686-x86-newlib' && success() }}
133+
run: |
134+
source tools/ci/toolchain.sh i686-atxhua-newlib-elf-gcc
135+
echo "RTT_EXEC_PATH=/opt/i686-atxhua-newlib-elf-gcc/bin" >> $GITHUB_ENV
136+
echo "RTT_CC_PREFIX=i686-atxhua-newlib-elf-" >> $GITHUB_ENV
137+
130138
- name: Bsp Scons Compile
131139
if: ${{ success() }}
132140
shell: bash

bsp/x86/README.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,25 @@
66

77
编译RT-Thread for x86版本,还需要一份支持newlib的工具链,可以通过以下地址获得:
88

9-
*[i386-unknown-elf_for_x86_64-pc-linux-gnu_latest.tar.bz2](http://117.143.63.254:9012/www/rt-smart/i386-unknown-elf_for_x86_64-pc-linux-gnu_latest.tar.bz2)
9+
* [i386-unknown-elf_for_x86_64-pc-linux-gnu_latest.tar.bz2](http://117.143.63.254:9012/www/rt-smart/i386-unknown-elf_for_x86_64-pc-linux-gnu_latest.tar.bz2)
10+
* [ GCC 15.2.0 w/ Newlib 4.6.0.20260123: https://github.com/atxhua/i686-atxhua-newlib-elf/releases/download/15.2.0/i686-atxhua-newlib-elf-linux.tar.gz ](https://github.com/atxhua/i686-atxhua-newlib-elf/releases/download/15.2.0/i686-atxhua-newlib-elf-linux.tar.gz)
1011

11-
下载后解压,然后在rtconfig.py中配置其中的EXEC_PATH变量
1212

13+
下载后解压,然后配置RTT_EXEC_PATH & RTT_CC_PREFIX 变量
14+
```bash
15+
export RTT_EXEC_PATH='/path/to/i686-atxhua-newlib-elf-linux/bin'
16+
export RTT_CC_PREFIX='i686-atxhua-newlib-elf-'
17+
```
18+
19+
rtconfig.py
1320
```python
1421
if CROSS_TOOL == 'gcc':
1522
PLATFORM = 'gcc'
1623
EXEC_PATH = os.getenv('RTT_EXEC_PATH') or 'E:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_IA32_ELF/bin'
1724

25+
if PLATFORM == 'gcc':
26+
# toolchains
27+
PREFIX = os.getenv('RTT_CC_PREFIX') or 'i386-unknown-elf-'
1828
```
1929

2030
然后在x86 bsp目录下执行scons命令来编译:
@@ -41,33 +51,28 @@ sudo apt install libncurses5-dev
4151
sudo apt install qemu-system-x86 grub-common xorriso
4252
```
4353

44-
然后执行`./run.sh`命令可以使用qemu来模拟执行(它也会生成可启动的iso文件)
54+
然后使用qemu来模拟执行
4555

4656
```bash
47-
~/workspace/rt-thread/bsp/x86$ ./run.sh
48-
xorriso 1.4.8 : RockRidge filesystem manipulator, libburnia project.
49-
50-
Drive current: -outdev 'stdio:bootable.iso'
51-
Media current: stdio file, overwriteable
52-
Media status : is blank
53-
Media summary: 0 sessions, 0 data blocks, 0 data, 135g free
54-
Added to ISO image: directory '/'='/tmp/grub.uLz91i'
55-
xorriso : UPDATE : 578 files added in 1 seconds
56-
Added to ISO image: directory '/'='/home/bernard/workspace/rt-thread/bsp/x86/root'
57-
xorriso : UPDATE : 582 files added in 1 seconds
58-
xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/lib/grub/i386-pc/boot_hybrid.img'
59-
ISO image produced: 6007 sectors
60-
Written to medium : 6007 sectors at LBA 0
61-
Writing to 'stdio:bootable.iso' completed successfully.
57+
$ qemu-system-i386 -M pc -kernel rtthread.elf -nographic
58+
59+
SeaBIOS (version 1.16.3-debian-1.16.3-2)
6260

6361

62+
iPXE (https://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+06FCAE00+06F0AE00 CA00
63+
64+
65+
66+
Booting from ROM..
6467
\ | /
6568
- RT - Thread Operating System
66-
/ | \ 4.0.4 build Aug 22 2021
67-
2006 - 2021 Copyright by rt-thread team
69+
/ | \ 5.3.0 build May 10 2026 21:25:36
70+
2006 - 2024 Copyright by RT-Thread team
6871
Floppy Inc : NEC765B controller Floppy Type : 2.88MB
72+
[I/DBG] root filesystem mounted.
6973
hello!
7074
msh />
75+
7176
```
7277

7378
在qemu下可以按Ctrl-A + X退出qemu。

bsp/x86/rtconfig.py

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

2020
if PLATFORM == 'gcc':
2121
# toolchains
22-
PREFIX = 'i386-unknown-elf-'
22+
PREFIX = os.getenv('RTT_CC_PREFIX') or 'i386-unknown-elf-'
2323
CC = PREFIX + 'gcc'
2424
AS = PREFIX + 'gcc'
2525
AR = PREFIX + 'ar'

tools/ci/toolchain.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ declare -A download_urls=(
99
["riscv-none-embed-gcc"]="https://github.com/RT-Thread/toolchains-ci/releases/download/v1.5/xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz"
1010
["riscv32-esp-elf-gcc"]="https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1-RC1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz"
1111
["clang"]="https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-16.0.0/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64.tar.gz"
12-
12+
["i686-atxhua-newlib-elf-gcc"]="https://github.com/atxhua/i686-atxhua-newlib-elf/releases/download/15.2.0/i686-atxhua-newlib-elf-linux.tar.gz"
1313
)
1414

1515
show_help() {

0 commit comments

Comments
 (0)