blob: 102d15c272fcb2dab83871cc785c86f4d4904159 [file] [log] [blame] [view]
Miguel Osorio40caa9e2021-05-27 21:45:20 -07001---
2title: "OpenTitan Software Build Instructions"
3---
Miguel Young de la Sotad258b332019-10-29 14:05:23 -05004
Tobias Wölfel03d1cf32020-02-26 12:47:07 +01005OpenTitan software is built using [Meson](https://mesonbuild.com), although OpenTitan's project structure is sufficiently idiosyncratic that we use a custom workflow.
Miguel Young de la Sota8ff30b82019-11-25 12:58:34 -06006
7For example, to build the OpenTitan executable located at `sw/device/examples/hello_world` for FPGA, run the following commands:
Miguel Osorio40caa9e2021-05-27 21:45:20 -07008
Miguel Young de la Sota8ff30b82019-11-25 12:58:34 -06009```console
10$ cd "$REPO_TOP"
11$ ./meson_init.sh
Miguel Young de la Sota76526c32020-01-28 10:24:41 -050012$ ninja -C build-out sw/device/examples/hello_world/hello_world_export_fpga_nexysvideo
Miguel Young de la Sotad258b332019-10-29 14:05:23 -050013```
Miguel Young de la Sota8ff30b82019-11-25 12:58:34 -060014
Miguel Young de la Sota76526c32020-01-28 10:24:41 -050015The resulting binaries will be located at `build-bin/sw/device/examples/hello_world`. For more information, check out [the relevant User Guide](../doc/ug/getting_started_sw.md).
Miguel Young de la Sota8ff30b82019-11-25 12:58:34 -060016
Greg Chadwickc96ccaf2020-02-04 13:37:37 +000017The location of the RISC-V toolchain is /tools/riscv by default.
18If your toolchain is located elsewhere set the `TOOLCHAIN_PATH` to that path before running `meson_init.sh`
19
20```console
21$ cd "$REPO_TOP"
22$ export TOOLCHAIN_PATH=/path/to/toolchain
23$ ./meson_init.sh
24```