1541ultimate icon indicating copy to clipboard operation
1541ultimate copied to clipboard

Add "zicsr" to fix build issue

Open scjody opened this issue 1 year ago • 7 comments

Fixes https://github.com/GideonZ/1541ultimate/issues/379, tested on a U2+L with rv32i-131023 (GCC 13.2.0) from https://github.com/stnolting/riscv-gcc-prebuilt

scjody avatar Nov 09 '23 23:11 scjody

You shouldn't need that patch. Just use a proper toolchain.

git clone https://github.com/riscv/riscv-gnu-toolchainriscv-gnu-toolchain-rv32i cd riscv-gnu-toolchain-rv32i git submoduleupdate --init --recursive mkdir build; cd build ../configure--with-arch=rv32i_zicsr --with-abi=ilp32 --prefix=/opt/riscv32i_ilp32

( note that the "prefix"on the configure command is just a directory, not to confuse with the prefixof the cross compiling toolchain ) make

Using that toolchain, the option in the makefile isn't necessary at all.

markusC64 avatar Nov 10 '23 15:11 markusC64

IMHO I think that the change request is reasonable The change would enable use of pre-built riscv gcc toolchain packages - many linux distributions already ship these...

With the current source I believe that it is possible to supply make MARCH=rv32i_zicsr and thereby overload the contents of the existing Makefile (this is an untested claim)

UffeJakobsen avatar Nov 10 '23 15:11 UffeJakobsen

Probably correct. On the other hand, in order to create merge requests with improvements, its better to have a toolchain that works with current sources.

markusC64 avatar Nov 10 '23 16:11 markusC64

its better to have a toolchain that works with current sources.

I'm currently unable to test if if the change breaks anything on a custom-built (home made) toolchain

UffeJakobsen avatar Nov 10 '23 16:11 UffeJakobsen

Well, in this case it is progress made on the definition of the RiscV infrastructure. zicsr is no longer part of the RV32I definition, so in fact, it is correct to add it to the MARCH.

Message ID: @.***>

GideonZ avatar Nov 11 '23 10:11 GideonZ

I tested this with my version of the compiler (riscv32-unknown-elf-gcc (GCC) 10.2.0), and this architecture specification does not work yet. So I'll leave it like this for now.

GideonZ avatar Dec 28 '23 13:12 GideonZ

I am using a tool chain which needs this "fix" but I don't need to change the Makefiles. I have declared in my .profile (or .bashrc if you prefer) the line :

export MARCH=rv32i_zicsr_zifencei

This way the Makefile will use the env variable instead of the default value (that's the meaning of ?= in the Makefile)

rgc2000 avatar Dec 29 '23 00:12 rgc2000