darklife / darkriscv

opensouce RISC-V cpu core implemented in Verilog from scratch in one night!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with sample firmware

monideepbora opened this issue · comments

Dear author(s),

I tried to do a fresh compilation by removing all the .o and .s files from the src directory but no other changes. The compilation is successful but the simulation does not run (blank output, no banner etc). The error seems to be with one particular file io.s.

Everything works if I use the io.s supplied in the repository but nothing woks if I compile io.s from io.c locally. I have done a meld compare for the io.s from the repo and the one that I have compiled. The error seems to be with the location and type of the "io" symbol but I cant figure out exactly whats wrong.

My aim is to run the riscv-tests on the core keeping the existing firmware worflow (using darkuart.v for console output in simulation).

Using gcc version 10.2.0 (GCC)

Please let me know if you can share some insight on what could be done.

Thanks,
Monideep

Try adding the "-fcommon" option in the Makefile CCFLAGS

More info at kingsumos@54e2527
Please let me know if this fix works for you so I can propose a merge request

@kingsumos The "-fcommon" flag seems to fix the problem.

However, in your fork, the version of the codebase seems to be little older than the current HEAD at the original repository. The Makefile in the src folder contains a lot more options in the current HEAD at master. Please let me know if my observations are correct.

Thanks,
Monideep

Hi Colleagues,

I tested the -fcommon in my environment (GCC 9.0.0) and found no problems with my environment (GCC 9.0.0). Another possibility is that the gp register (global pointer) is not initialized to the correct area. Anyway, I will include the -fcommon and some improvements in the linker script in the future updates.

Thanks,
Marcelo

Ty @samsoniuk !
@monideepbora I have rebased the repo, check kingsumos@ba5a287

The update with the -fcommon is available, but the other improvements in the linker script will need additional tests and will be released further! :)

I included lots of changes regarding the linker script and the boot code (ported from C to asm), resulting in a better control regarding the global pointer and stack pointer. I hope the changes are compatible with GCC 10+...