YosysHQ / picorv32

PicoRV32 - A Size-Optimized RISC-V CPU
ISC License
2.86k stars 715 forks source link

Running new Assembly Code on PicoRV32 #241

Open AshvinVaidyanathan opened 1 year ago

AshvinVaidyanathan commented 1 year ago

I have been trying to figure out how to run my own asm_test.S file during the simulation. I have tried adding the file to the firmware directory and made changes to the Makefile so that my file shows up in the FIRMWARE_OBJS variable as firmware/asm_test.o. Then I made a target for my firmware/asm_test.o with the .S file as a pre-requisite and made the command the same as that of firmware/start.o. After running I am able to see the commands show up in firmware.hex but it's obviously not being executed because it's not called anywhere in the start.S file. My question is how can I make the start.S jump to the asm_test part of the code like it does for hello.c for example?

Thanks in advance

prashant-pvip commented 7 months ago

Hi @AshvinVaidyanathan, I believe it works the same way as hello.c. In start.S you are jumping on a label/function "hello" which is define inside hello.c. same way you can create a label inside asm_test(also make it global)file and once you test is done jump/return to the PC+4 from when you have jumped to this file. rest is same.