litex-hub / linux-on-litex-rocket

Run 64-bit Linux on LiteX + RocketChip
BSD 2-Clause "Simplified" License
181 stars 18 forks source link

zifencei + zicsr needed to build BBL #33

Closed pcotret closed 1 year ago

pcotret commented 1 year ago

Building BBL with:

../configure --host=riscv64-unknown-linux-gnu \
             --with-arch=rv64imac \
             --with-payload=../../linux/vmlinux \
             --with-dts=../../conf/nexys4ddr.dts \
             --enable-logo

zicsr and zifence extensions are needed

$ make bbl   
riscv64-unknown-linux-gnu-gcc -MMD -MP -Wall -Werror -D__NO_INLINE__ -mcmodel=medany -O2 -std=gnu99 -Wno-unused -Wno-attributes -fno-delete-null-pointer-checks -fno-PIE  -march=rv64imac -mabi=lp64 -DBBL_LOGO_FILE=\"bbl_logo_file\" -DMEM_START=0x80000000 -fno-stack-protector -U_FORTIFY_SOURCE -DBBL_PAYLOAD=\"bbl_payload\" -DCUSTOM_DTS=\"custom_dts\" -I. -I../pk -I../bbl -I../softfloat -I../dummy_payload -I../machine -I../util -c ../bbl/bbl.c
../bbl/bbl.c: Assembler messages:
../bbl/bbl.c:107: Error: unrecognized opcode `csrr a1,mhartid', extension `zicsr' required

Configured with:

../configure --host=riscv64-unknown-linux-gnu \
             --with-arch=rv64imac_zifencei_zicsr \
             --with-payload=../../linux/vmlinux \
             --with-dts=../../conf/nexys4ddr.dts \
             --enable-logo

Got me the BBL binary compiled.

However, this issue may be a part of rewriting the tutorial as discussed in PR #32

roryt12 commented 1 year ago

@pcotret you are strangling with obsolete tools and instructions. Take a look on my approach that hopefully will give you more up-to-date steps.

gsomlo commented 1 year ago

On Tue, May 23, 2023 at 12:56:28PM -0700, Ioannis Ioannou wrote:

@pcotret you are strangling with obsolete tools and instructions.

@pcotret: you might want to consider using opensbi instead of bbl, at least if you don't care about floating point emulation (and you don't if you include a current linux or full rocket core).

Instructions on how to build and use opensbi are in the slide deck at https://fosdem.org/2023/schedule/event/rv_selfhosting_all_the_way_down/

pcotret commented 1 year ago

@pcotret you are strangling with obsolete tools and instructions. Take a look on my approach that hopefully will give you more up-to-date steps.

Thanks, I'll have a look at it