opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

Building both SIM and non-SIM hello code in the same make

Open mdhayter opened this issue 7 years ago • 2 comments

Currently as I switch from verilator to FPGA and back I have to remember to rebuild the hello_world/hello_usbdev program with or without SIM=1. I keep forgetting which makes me think that things have broken.

Would be nice if we could either:

  • Build both versions in the default make $(PROGRAM) and $(PROGRAM)-sim or something.
  • Make it dynamic based on where the code is running (since we have unused gpios maybe tie one based on the verilator or nexysvideo wrapper)?

mdhayter avatar May 29 '19 08:05 mdhayter

+@mcy As this may be already be covered by the new build system.

moidx avatar Oct 23 '19 21:10 moidx

Make is going away, so I will not put any time into making Make less painful to use. I will gladly review PRs to add this functionality, but I'm not sure I will approve anything particularly complicated.

To do this under Meson, you simply run (after running ./meson_init.sh)

ninja -C build-verilator my_cool_target

(or with build-fpga for the FPGA build). I think that having to write the target name (and, the fact that targets for each platform live in build-verilator and build-fpga, respectively) should solve your issue.

FWIW, I think that the design to have the switch be called SIM=1 is pretty bad in the first place and I'm glad we're getting rid of it.

mcy avatar Oct 24 '19 15:10 mcy