openrisc / orpsoc-cores

Core description files for FuseSoC
123 stars 78 forks source link

Verilator build errors #115

Closed lucasasselli closed 7 years ago

lucasasselli commented 7 years ago

I've tried to run the or1200-generic simulation on Verilator but I kept stumbling on this error:

../src/elf-loader_0/elf-loader.c: In function ‘uint8_t* dump_program_data(Elf*, int*)’:
../src/elf-loader_0/elf-loader.c:61:20: error: invalid conversion from ‘void*’ to ‘uint8_t* {aka unsigned char*}’ [-fpermissive]
    buffer = realloc(buffer, max_paddr);
             ~~~~~~~^~~~~~~~~~~~~~~~~~~
../src/elf-loader_0/elf-loader.c: In function ‘uint8_t* dump_section_data(Elf*, int*)’:
../src/elf-loader_0/elf-loader.c:117:21: error: invalid conversion from ‘void*’ to ‘uint8_t* {aka unsigned char*}’ [-fpermissive]
     buffer = realloc(buffer, max_saddr);

This can be fixed with a cast to uint8_t. Also after that g++ wasn't able to link to the functions defined in elf-loader in "verilator_tb_utils": I've noticed that the "elf-loader.h" include is missing in "elf-loader.c". Now everything is working fine.

Currently I'm using gcc 7.1.1 and Verilator 3.902.

olofk commented 7 years ago

Thanks for the patch. I think however that this is already fixed in elf-loader-1.0.2 which is in the fusesoc-cores library. Do you use the fusesoc-cores library, or only orpsoc-cores? Your fusesoc.conf should look something like cores_root = ~/.local/share/fusesoc/orpsoc-cores ~/.local/share/fusesoc/fusesoc-cores That way, cores in the fusesoc-cores library will have priority over those in orpsoc-cores

lucasasselli commented 7 years ago

Okay, I just checked the code there, and it works fine. I forgot to mention that in "verilator_tb_utils" the elf-loader include doesn't work.

olofk commented 7 years ago

Yes, you are right regarding the #include statement in verilator_tb_utils. I had even fixed that locally, but forgot to push the fix. Done that now

lucasasselli commented 7 years ago

Perfect!