Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 最新的 riscv musl 工具链编译生成的 helloworld 无法工作 #10028

Open
unicornx opened this issue Feb 24, 2025 · 4 comments
Open
Labels
Arch: RISC-V BSP related with risc-v RT-Smart RT-Thread Smart related PR or issues

Comments

@unicornx
Copy link
Contributor

unicornx commented Feb 24, 2025

RT-Thread Version

latest

Hardware Type/Architectures

bsp/cvitek 或者 bsp/qemu-virt64-riscv

Develop Toolchain

Other

Describe the bug

参考 https://github.com/RT-Thread/rt-thread/issues/9812#issuecomment-2664977960,

https://download.rt-thread.org/download/rt-smart/toolchains/riscv64gc-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2 这个工具链做了一个 helloworld 运行后报错

#include "stdio.h"

void main()
{
	printf("Hello world!\n");
}

静态链接:

~/ws/bin/rtt-tools-smart/riscv64gc-linux-musleabi_for_x86_64-pc-linux-gnu/bin/riscv64-unknown-linux-musl-gcc -static ./hello.c -o ./hello

bsp/cvitek 下制作 smart 版本或者 bsp/qemu-virt64-riscv 制作 smart 版本,启动后运行 hello,报错类似如下:

/ # ./hello 
[I/mm.fault] rt_aspace_fault_try_fix: varea not found at 0x0
[E/libcpu.trap] [FATAL ERROR] Exception 12:Instruction Page Fault

[E/libcpu.trap] scause:0x000000000000000c,stval:(nil),sepc:(nil)

--------------Dump Registers-----------------
Function Registers:
        ra(x1) = 0xffffffc000222710     user_sp = 0x0000000300000000
        gp(x3) = 0xffffffc0002d9760     tp(x4) = 0x0000000000107728
Temporary Registers:
        t0(x5) = 0x0000000000000020     t1(x6) = 0xffffffc00415f158
        t2(x7) = 0x000000000000003a
        t3(x28) = 0xffffffc00415f150    t4(x29) = 0x000000000000001f
        t5(x30) = 0x0000000000000002    t6(x31) = 0x0000000000000002
Saved Registers:
        s0/fp(x8) = 0xffffffc00047bdc0  s1(x9) = 0x00000003000023f0
        s2(x18) = 0x0000000300002400    s3(x19) = 0x00000003000023f0
        s4(x20) = 0xffffffffffffffff    s5(x21) = 0x00000003000023f0
        s6(x22) = 0x00000003000023d0    s7(x23) = 0x00000000000feab2
        s8(x24) = 0x00000000000dcda8    s9(x25) = 0x0000000000105aa8
        s10(x26) = 0x0000000000000008   s11(x27) = 0x0000000000000001
Function Arguments Registers:
        a0(x10) = 0x0000000300000000    a1(x11) = (nil)
        a2(x12) = 0x0000000300000000    a3(x13) = 0xffffffc00047c000
        a4(x14) = 0xffffffc000478000    a5(x15) = 0x0000000000000003
        a6(x16) = 0x0000000000000018    a7(x17) = (nil)
sstatus = 0x0000000200044020
        Supervisor Interrupt Disabled
        Last Time Supervisor Interrupt Enabled
        Last Privilege is User Mode
        Permit to Access User Page
        Not Permit to Read Executable-only Page
satp = 0x800000000008414a
        Current Page Table(Physical) = 0x000000008414a000
        Current ASID = (nil)
        Mode = Page-based 39-bit Virtual Addressing Mode
-----------------Dump OK---------------------
fp = 0xffffffc00047bdc0
please use: addr2line -e ./hello -a -f
 0x0 0xffffffc00024f9c2 0xffffffc0002002c8 0xffffffc00024f9c2 0xffffffc0002002c8 0xffffffc00024f9c2 0xffffffc0002002c8 0xffffffc00024f9c2
[E/libcpu.trap] User Fault, killing thread: hello

Other additional context

No response

@heyuanjie87
Copy link
Contributor

这个最新版可能不是真的最新版

@BernardXiong
Copy link
Member

这个后面固定一个版本吧,也就是说musl gcc正式发一个版本出来

@unicornx
Copy link
Contributor Author

这个后面固定一个版本吧,也就是说musl gcc正式发一个版本出来

怎么说呢,这个问题我去年 12 月底就报了,到现在也没有看到解决的希望。see #9812 (comment)

@BernardXiong
Copy link
Member

这个后面固定一个版本吧,也就是说musl gcc正式发一个版本出来

怎么说呢,这个问题我去年 12 月底就报了,到现在也没有看到解决的希望。see #9812 (comment)

这个是需要先验证好一个版本,然后出一个带版本的工具链出来,还是先确认好没问题的才是

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: RISC-V BSP related with risc-v RT-Smart RT-Thread Smart related PR or issues
Projects
None yet
Development

No branches or pull requests

3 participants