Closed AEW2015 closed 1 year ago
I have the same issue, I think you need to add -march=rv32imac -mabi=ilp32
to LDFLAGS, but when I do that I get the error:
❯ make
CC boot.elf
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: /opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/rv32imac/ilp32/libgcc.a(_udivdi3.o): can't link soft-float modules with single-float modules
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file /opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/rv32imac/ilp32/libgcc.a(_udivdi3.o)
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: /opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/rv32imac/ilp32/libgcc.a(_umoddi3.o): can't link soft-float modules with single-float modules
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file /opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/rv32imac/ilp32/libgcc.a(_umoddi3.o)
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: /opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/rv32imac/ilp32/libgcc.a(_clz.o): can't link soft-float modules with single-float modules
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file /opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/rv32imac/ilp32/libgcc.a(_clz.o)
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: boot.elf has a LOAD segment with RWX permissions
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: builtins.o: in function `catalog':
builtins.c:(.text+0x2a): undefined reference to `fatfs_set_ops_spisdcard'
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: builtins.c:(.text+0xec): undefined reference to `fatfs_set_ops_spisdcard'
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: builtins.o: in function `run':
builtins.c:(.text+0x10a): undefined reference to `elf32_load'
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: main.o: in function `main':
main.c:(.text.startup+0x142): undefined reference to `fb_base'
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: main.c:(.text.startup+0x146): undefined reference to `fb_base'
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: main.c:(.text.startup+0x14a): undefined reference to `fb_off'
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: main.c:(.text.startup+0x194): undefined reference to `fb_on'
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: /Users/marko/Documents/GitHub/LiteX/litex-boards/litex_boards/targets/build/radiona_ulx3s/software/liblitedram/liblitedram.a(sdram.o): in function `init_sequence':
/Users/marko/Documents/GitHub/LiteX/litex-boards/litex_boards/targets/build/radiona_ulx3s/software/include/generated/sdram_phy.h:90: undefined reference to `memtest'
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: /Users/marko/Documents/GitHub/LiteX/litex-boards/litex_boards/targets/build/radiona_ulx3s/software/include/generated/sdram_phy.h:96: undefined reference to `memspeed'
collect2: error: ld returned 1 exit status
make: *** [boot.elf] Error 1
This is being built on MacOS but I get the same error when I replicate it on Linux.
Fixed (now LiteX uses extended RiscV extension names, which confuses the linker, fixed makefile.inc
to remove them in the flag passed to the linker)
I can compile LiteOS for the quark variant just fine, but when I try petitbateau variant, I get this error: