Miguel Osorio | 40caa9e | 2021-05-27 21:45:20 -0700 | [diff] [blame] | 1 | --- |
| 2 | title: "OpenTitan Software Build Instructions" |
| 3 | --- |
Miguel Young de la Sota | d258b33 | 2019-10-29 14:05:23 -0500 | [diff] [blame] | 4 | |
Tobias Wölfel | 03d1cf3 | 2020-02-26 12:47:07 +0100 | [diff] [blame] | 5 | OpenTitan 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 Sota | 8ff30b8 | 2019-11-25 12:58:34 -0600 | [diff] [blame] | 6 | |
| 7 | For example, to build the OpenTitan executable located at `sw/device/examples/hello_world` for FPGA, run the following commands: |
Miguel Osorio | 40caa9e | 2021-05-27 21:45:20 -0700 | [diff] [blame] | 8 | |
Miguel Young de la Sota | 8ff30b8 | 2019-11-25 12:58:34 -0600 | [diff] [blame] | 9 | ```console |
| 10 | $ cd "$REPO_TOP" |
| 11 | $ ./meson_init.sh |
Miguel Young de la Sota | 76526c3 | 2020-01-28 10:24:41 -0500 | [diff] [blame] | 12 | $ ninja -C build-out sw/device/examples/hello_world/hello_world_export_fpga_nexysvideo |
Miguel Young de la Sota | d258b33 | 2019-10-29 14:05:23 -0500 | [diff] [blame] | 13 | ``` |
Miguel Young de la Sota | 8ff30b8 | 2019-11-25 12:58:34 -0600 | [diff] [blame] | 14 | |
Miguel Young de la Sota | 76526c3 | 2020-01-28 10:24:41 -0500 | [diff] [blame] | 15 | The 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 Sota | 8ff30b8 | 2019-11-25 12:58:34 -0600 | [diff] [blame] | 16 | |
Greg Chadwick | c96ccaf | 2020-02-04 13:37:37 +0000 | [diff] [blame] | 17 | The location of the RISC-V toolchain is /tools/riscv by default. |
| 18 | If 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 | ``` |