[mask_rom] Mask ROM Initial Commit

This is the initial framework which we will continue to develop the Mask
ROM upon. The Mask ROM is the first stage of the Secure Boot process. The
aim of the Mask ROM code is to have as few dependencies as possible, and
for all the code to be as simple as possible, so we re-implement some
structures in other parts of the `sw` tree, rather than pull them in
entirely.

This code is based on the implementations in `sw/device/boot_rom` and
`sw/device/exts/common`.

The Mask ROM currently does not do anything, and certainly cannot load
a flash image to execute yet. These are future additions that will be
made.

Signed-off-by: Sam Elliott <selliott@lowrisc.org>
diff --git a/sw/device/mask_rom/meson.build b/sw/device/mask_rom/meson.build
new file mode 100644
index 0000000..56ff423
--- /dev/null
+++ b/sw/device/mask_rom/meson.build
@@ -0,0 +1,49 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+
+# Mask ROM Linker Parameters
+#
+# See sw/device/exts/common/flash_link.ld for additional info about these
+# parameters.
+rom_linkfile = files(['mask_rom.ld'])
+rom_link_args = [
+  '-Wl,-L,@0@'.format(meson.source_root()),
+  '-Wl,-T,@0@/@1@'.format(meson.source_root(), rom_linkfile[0]),
+  '-Wl,--build-id=none',
+]
+rom_link_deps = [rom_linkfile]
+
+foreach device_name, device_lib : sw_lib_arch_core_devices
+  mask_rom_elf = executable(
+    'mask_rom_' + device_name,
+    sources: [
+      'mask_rom_start.S',
+      'mask_rom.c',
+    ],
+    name_suffix: 'elf',
+    link_args: rom_link_args,
+    link_depends: rom_link_deps,
+    dependencies: [
+      chip_info_h,
+      device_lib,
+    ],
+  )
+
+  mask_rom_embedded = custom_target(
+    'mask_rom_' + device_name,
+    command: make_embedded_target,
+    input: mask_rom_elf,
+    output: make_embedded_target_outputs,
+    build_by_default: true,
+  )
+
+  custom_target(
+    'mask_rom_export_' + device_name,
+    command: export_embedded_target,
+    input: [mask_rom_elf, mask_rom_embedded],
+    output: 'mask_rom_export_' + device_name,
+    build_always_stale: true,
+    build_by_default: true,
+  )
+endforeach