[sw] Add Meson as software build system
Overview:
This commit adds the following changes:
* Meson build files for sw/ targets. There are two supported build
configurations:
* build-fpga: Nexys FPGA
* build-sim: Verilator
* RISCV crosstool support via toolchain.txt
* Add util/embedded_target.py to generate additional objects per
embedded_target.
* Breakdown sw/lib/ot_lib.a intp per IP libraries. Each target now
includes the dependencies it needs, e.g. sw_lib_uart_ot can be used to
include the UART device library.
New build system requirements:
```console
$ pip3 install --user meson
$ apt-get install ninja-build
```
Steps for using Meson:
```console
$ cd ${REPO_TOP}
$ ./meson_init.sh
$ ninja -C build-fpga
$ ninja -C build-verilator
```
To build an individual target:
In the following example, just build the flash_test.bin
target:
```console
$ ninja -C build-fpga sw/tests/flash_ctrl/flash_test.bin
```
meson_init.sh configuration options:
* `-f`: Delete build directories before calling meson.
* `-r`: Call Meson with `--reconfigure` flag. Requires valid build
directories.
diff --git a/sw/examples/hello_usbdev/meson.build b/sw/examples/hello_usbdev/meson.build
new file mode 100644
index 0000000..7482181
--- /dev/null
+++ b/sw/examples/hello_usbdev/meson.build
@@ -0,0 +1,23 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+
+custom_target(
+ 'hello_usbdev',
+ output: embedded_target_output,
+ input: executable(
+ 'hello_usbdev',
+ ['hello_usbdev.c', startup_files],
+ name_suffix: 'elf',
+ link_args: riscv_link_args,
+ link_depends: riscv_link_deps,
+ dependencies: [
+ sw_lib_gpio,
+ sw_lib_irq,
+ sw_lib_uart,
+ sw_lib_usb,
+ ],
+ ),
+ command: embedded_target_args,
+ build_by_default: true,
+)