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

Error build with fresh tools: extension `zicsr' required #19

Closed
vazhnov opened this issue Feb 27, 2023 · 2 comments
Closed

Error build with fresh tools: extension `zicsr' required #19

vazhnov opened this issue Feb 27, 2023 · 2 comments
Assignees

Comments

@vazhnov
Copy link

vazhnov commented Feb 27, 2023

Hello!
Thank you for this great project with opensource license! I don't know Forth, but I'm interesting in pure Assembly code examples for RISC-V boards.

I tried to build the code with the latest Devuan testing, and it failed:

 % make build BOARD=longan-nano
/usr/bin/riscv64-unknown-elf-as -g -march=rv32imac -I src/boards/longan-nano -I src/mcus/gd32vf103 -I src -o fiveforths.o fiveforths.s
src/03-interrupts.s: Assembler messages:
src/03-interrupts.s:15: Error: unrecognized opcode `csrc mstatus,0x08', extension `zicsr' required
src/03-interrupts.s:18: Error: unrecognized opcode `csrs mie,zero', extension `zicsr' required
src/03-interrupts.s:22: Error: unrecognized opcode `csrw mtvec,t0', extension `zicsr' required
make: *** [Makefile:27: fiveforths.o] Error 1

Then I modified Makefile: ARCH ?= rv32imac_zicsr, and the code compiled successfully:

 % make build BOARD=longan-nano
/usr/bin/riscv64-unknown-elf-as -g -march=rv32imac_zicsr -I src/boards/longan-nano -I src/mcus/gd32vf103 -I src -o fiveforths.o fiveforths.s
/usr/bin/riscv64-unknown-elf-ld -m elf32lriscv -T src/boards/longan-nano/linker.ld -o fiveforths.elf fiveforths.o
/usr/bin/riscv64-unknown-elf-objcopy -O binary fiveforths.elf fiveforths.bin
/usr/bin/riscv64-unknown-elf-objcopy -O ihex fiveforths.elf fiveforths.hex
/usr/bin/riscv64-unknown-elf-objdump -D -S fiveforths.elf > fiveforths.dump

Software versions:

 % dpkg -l|grep riscv
ii  binutils-riscv64-unknown-elf          2.39-8+4                                     amd64        GNU assembler, linker and binary utilities for Risc-V processors
ii  gcc-riscv64-unknown-elf               12.1.0-7+11                                  amd64        GCC cross compiler for Risc-V processors

Just FYI.

@aw
Copy link
Owner

aw commented Mar 2, 2023

Hi, thanks for the report.

I'll need to run some tests and figure out why this is happening. I'm not sure of the purpose of zicsr so let me research and I'll update the issue later.

@aw
Copy link
Owner

aw commented Mar 2, 2023

Then I modified Makefile: ARCH ?= rv32imac_zicsr, and the code compiled successfully:

You can also just type make ARCH=rv32imac_zicsr. That's why I defined the ARCH variable with ?=.

It seems this is caused by a breaking change in gcc/binutils, where zicsr must now be explicitly provided.

I'll fix this and publish a new release after testing it.

Thanks @vazhnov for the detailed bug report and debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants