tmahlburg / picoramsoc

An SoC for the PicoRV32 running completely from RAM
3 stars 1 forks source link

It does not work in my projects. #1

Open PeterYRZ opened 1 year ago

PeterYRZ commented 1 year ago

I just replace the picosoc.v with picoramsoc.v in the directory /picosoc, and remove the unused ports in hx8kdemo.v and disconnect the spiflash in hx8kdemo_tb.v before simulation. Using the same hex file, it does not work while it works well with the origin picosoc.v file.

tmahlburg commented 1 year ago

The hex file is expected to be in the same directory as the picoramsoc.v file and should be called firmware.hex. Additionally you need to change the picosoc instantiation in the hk8demo files. In line 93 it should be picoramsoc soc and not picosoc soc, because the module has a different name.

I hope that helps. If not, I would need to know a little bit more about the problems you are having.

PeterYRZ commented 1 year ago

Thanks for your reply. I did replace the picosoc with picoramsoc in the hx8kdemo files. I wonder if I should modify the sections.lds, which is one of the source files to generate firmware.hex. I am using the Makefile in .\picosoc to generate hx8kdemo_fw.hex, and I have changed the file name in $readmemh as well. Since you mentioned the file name firmware.hex, is your firmware.hex generated in the same way as mine? image In the firmware.c file, there are just few operations for reg_leds and a uart output. image While in the simulation, the mem_addr[31:0] stops at 0x00000108. Then there is no uart output or led output.

tmahlburg commented 1 year ago

Yes, I looked more into it again, and that's part of it. The address of the first instruction in RAM is expected to be at 0x100 while the hexfile usually compiles to begin at address 0x0 and is then loaded directly into RAM. The normal picosoc gets its firmware loaded directly into the flash at the right address, so no reformatting needed. I used a Basys 3 board, when I made this. The exact Makefile and sections.lds I used, can be found here: https://github.com/tmahlburg/picorv32-imt/tree/master/picoramsoc

I also remembered, that I had to reformat the hexfile, which I wrote a python script for: https://github.com/tmahlburg/picorv32-imt/blob/master/scripts/fmt_hex.py There is probably a better way to do that, but this worked.

At least the script should probably be in this repository, too. I will add it, when I get around to it. Let me know if this doesn't fix it, or you require more clarification.

PeterYRZ commented 1 year ago

Thanks again for your reply. Unfortunately it still doesn't work well. I clone your Basys 3 project https://github.com/tmahlburg/picorv32-imt to my disk and I import it to vivado. After generating the picoramsoc\basys3_fw.hex file using Makefile, I started the Behavior Simulation in vivado. It turns out that it fails to start up. image The mem_addr[31:0] remains X, which should start from 0x100. I wonder if your picorv32-imt project has been successful before. By the way, I did change the $readmemh("firmware.hex"); into the very path. Meanwhile, I noticed that in the picorv32-imt project, the picoramsoc was using picorv32-imt rather than picorv32. So I rerun the simulation using the picorv32 version of picoramsoc. image It performs similarity to my last comment. The mem_addr[31:0] stops.

I am new to picorv32, and there are not much reference on the web. I don't know what is happening since every file seems to make sence. 😭

I wonder if the start.s in your picorv32-imt project needs to be modified. In sections.lds, there are .text section, .data section, .bss section. But there is just a .text section in start.s. I am not familiar with the asm file and lds file. Just a guess.

tmahlburg commented 1 year ago

Yeah, you should use this picoramsoc, the normal picorv32 and the Makefile and so on from picorv32-imt. I don't know why exactly it doesn't work for you, but I will try to recreate what I did, when I have the time, maybe this weekend and maybe then I can help you more.

PeterYRZ commented 1 year ago

Thanks, please do recreate what you did. It will help me a lot to locate errors in my work. Looking forward to your reply.