Closed ParthB96 closed 2 years ago
Why do you think that the hex file was not generated properly? I can't help when I don't know what is wrong. ] If hex file support is broken, that isn't a RISC-V bug, and should be reported upstream instead of here.
SiFive recommends use of the elf2hex program to generate hex files for verilog simulators. https://github.com/sifive/elf2hex
Hi,
While generating hex file, elf file and readelf is not getting generated.
I am using the below command to generate a hex file.
$RISCV_BIN/riscv64-unknown-elf-gcc -g hello-world.c -o hello-world.o. $RISCV_BIN/riscv32-unknown-elf-objcopy -S -O ihex fibonacci.o fibonacci.hex
Thank Thanks & Regards Prarthi Bhatt
On Thu, Nov 12, 2020 at 11:24 PM Jim Wilson notifications@github.com wrote:
Why do you think that the hex file was not generated properly? I can't help when I don't know what is wrong. ] If hex file support is broken, that isn't a RISC-V bug, and should be reported upstream instead of here.
SiFive recommends use of the elf2hex program to generate hex files for verilog simulators. https://github.com/sifive/elf2hex
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/riscv/riscv-gnu-toolchain/issues/770#issuecomment-726238293, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQYF6MAE2HI54TQHVADUW2LSPQONJANCNFSM4TTQIF3A .
It still isn't clear to me what the problem is. Can you show me an actual error?
The objcopy command only creates one output file, the hex file. It will not create an elf output file. readelf is a program which you aren't trying to use, so not clear why you are referring to readelf.
Hi,
I have attached hex file below.
Hi,
I have install riscv-gnu-toolchain using https://github.com/riscv/riscv-gnu-toolchain repository and I have install riscv 32 bit library.
After riscv-gnu-toolchain, I am trying to generate hex file. Below I have attached hex file that is getting generate by toolchain.
I also need elf file to run uvm testcase.
That looks like a valid hex file, so it isn't clear what the problem is.
Perhaps the confusion is with how to run the compiler? It appears that you are using gcc -c to create an object file, and then passing the object file through objdump to create a hex file. You haven't said what you are trying to do with this hex file, but if you are trying to pass it to a simulator I would not expect that to work. You can't execute object files in general. You need to produce a fully linked executable first, linked against start files and libraries, then create a hex file from that, and then pass that to a simulator.
I would also suggest using this: https://github.com/sifive/freedom-elf2hex.git
As i had problems generating hex files with the other elf2hex program.
No update/activity in over a year and the original question seems to be about how to use the tools as opposed to reporting an issue with the RISC-V GCC toolchain itself.
I am generating a hex file using the below command, but it is not generating the hex file properly and elf,objdump and readelf are getting generated.
$RISCV_BIN/riscv64-unknown-elf-gcc -g hello-world.c -o hello-world.o. $RISCV_BIN/riscv32-unknown-elf-objcopy -S -O ihex fibonacci.o fibonacci.hex