[sw, tests] Generate rom_ext smoke tests
- Defining new set of tests for ROM_EXT without disturbing the
- existing test setup.
- To begin with only the uart smoketest has been added (self
contained).
- Only `.elf` binary is generated at this point.
To run the produced test on verilator:
```
ROM_IMAGE=mask_rom_for_testing_sim_verilator.elf
FLASH_IMAGE=dif_uart_secure_boot_smoketest_rom_ext_sim_verilator.elf
OTP_IMAGE=otp_img_sim_verilator.vmem
build/lowrisc_systems_top_earlgrey_verilator_0.1/sim-verilator/Vtop_earlgrey_verilator \
--meminit=rom,build-out/sw/device/mask_rom/$ROM_IMAGE \
--meminit=flash,build-out/sw/device/tests/$FLASH_IMAGE \
--meminit=otp,build-bin/sw/device/otp_img/$OTP_IMAGE
```
Signed-off-by: Silvestrs Timofejevs <silvestrst@lowrisc.org>
diff --git a/sw/device/tests/dif/meson.build b/sw/device/tests/dif/meson.build
index 9d78607..534d8ac 100644
--- a/sw/device/tests/dif/meson.build
+++ b/sw/device/tests/dif/meson.build
@@ -263,6 +263,11 @@
'library': dif_uart_smoketest_lib,
}
}
+sw_rom_ext_tests += {
+ 'dif_uart_smoketest': {
+ 'library': dif_uart_smoketest_lib,
+ }
+}
dif_rv_timer_smoketest_lib = declare_dependency(
link_with: static_library(
diff --git a/sw/device/tests/meson.build b/sw/device/tests/meson.build
index 58d5b19..4103ac5 100644
--- a/sw/device/tests/meson.build
+++ b/sw/device/tests/meson.build
@@ -13,6 +13,18 @@
# },
}
+# All tests added to this dictionary will result in build targets that have
+# names starting `sw/device/tests/<test_name>`. They will not contain the
+# subdirectory name, because the build targets are really declared at the bottom
+# of this file, rather than in the subdirectories.
+#
+# These tests will link against a ROM_EXT slot A image.
+sw_rom_ext_tests = {
+ # 'test_name': {
+ # 'library': test_lib,
+ # },
+}
+
subdir('dif')
subdir('rom_ext')
subdir('runtime')
@@ -229,6 +241,35 @@
endforeach
endforeach
+foreach sw_test_name, sw_test_info : sw_rom_ext_tests
+ foreach device_name, device_lib : sw_lib_arch_core_devices
+ sw_test_elf = executable(
+ sw_test_name + '_rom_ext_' + device_name,
+ name_suffix: 'elf',
+ dependencies: [
+ # Only use ROM_EXT slot A for now.
+ rom_ext_slot_libs['rom_ext_slot_a'],
+ device_lib,
+ sw_test_info['library'],
+ sw_lib_irq_handlers,
+ sw_lib_testing_test_main,
+ ],
+ )
+
+ custom_target(
+ sw_test_name + '_rom_ext_export_' + device_name,
+ command: export_target_command,
+ depend_files: [export_target_depend_files,],
+ input: [
+ sw_test_elf,
+ ],
+ output: sw_test_name + '_rom_ext_export_' + device_name,
+ build_always_stale: true,
+ build_by_default: true,
+ )
+ endforeach
+endforeach
+
# Specific custom configuration for `crt_test`
foreach device_name, device_lib : sw_lib_arch_core_devices
crt_test_elf = executable(