| # Copyright 2023 Google LLC. |
| # Copyright lowRISC contributors. |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| load("@lowrisc_opentitan//rules:linker.bzl", "ld_library") |
| load("//rules:matcha.bzl", "OPENTITAN_CPU") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| ld_library( |
| name = "linker_script", |
| script = "ottf_sc.ld", |
| deps = [ |
| "//hw/top_matcha/sw/autogen:top_matcha_memory", |
| "@lowrisc_opentitan//sw/device:info_sections", |
| "@lowrisc_opentitan//sw/device/silicon_creator/lib/base:static_critical_sections", |
| ], |
| ) |
| |
| ld_library( |
| name = "linker_script_smc", |
| script = "ottf_smc.ld", |
| deps = [ |
| "//hw/top_matcha/sw/autogen:top_matcha_memory", |
| "@lowrisc_opentitan//sw/device:info_sections", |
| ], |
| ) |
| |
| # This target provides start files without providing the full OTTF, and can be used |
| # to bootstrap post-ROM execution without pulling in the full OTTF. |
| # |
| # The binary target must provide a `noreturn void _ottf_main(void)` function that |
| # this library will call. |
| cc_library( |
| name = "ottf_start", |
| srcs = [ |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_isrs.S", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_isrs.c", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_start.S", |
| ], |
| hdrs = [ |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_isrs.h", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_macros.h", |
| ], |
| target_compatible_with = [OPENTITAN_CPU], |
| deps = [ |
| ":linker_script", |
| "//hw/top_matcha/sw/autogen:top_matcha", |
| "//sw/device/lib/dif:rv_plic_sec", |
| "@lowrisc_opentitan//sw/device/lib/base:csr", |
| "@lowrisc_opentitan//sw/device/lib/base:macros", |
| "@lowrisc_opentitan//sw/device/lib/crt", |
| "@lowrisc_opentitan//sw/device/lib/runtime:hart", |
| "@lowrisc_opentitan//sw/device/lib/runtime:ibex", |
| "@lowrisc_opentitan//sw/device/lib/runtime:log", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:check", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:test_framework_manifest_def", |
| "@lowrisc_opentitan//sw/device/silicon_creator/lib/base:static_critical_boot_measurements", |
| "@lowrisc_opentitan//sw/device/silicon_creator/lib/base:static_critical_epmp_state", |
| "@lowrisc_opentitan//sw/device/silicon_creator/lib/base:static_critical_sec_mmio", |
| ], |
| ) |
| |
| cc_library( |
| name = "ottf_start_smc", |
| srcs = [ |
| "//sw/device/lib/testing/test_framework:ottf_isrs_smc.S", |
| "//sw/device/lib/testing/test_framework:ottf_isrs_smc.c", |
| "//sw/device/lib/testing/test_framework:ottf_start_smc.S", |
| ], |
| hdrs = [ |
| "//sw/device/lib/testing/test_framework:ottf_isrs_smc.h", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_macros.h", |
| ], |
| target_compatible_with = [OPENTITAN_CPU], |
| deps = [ |
| ":linker_script_smc", |
| "//hw/top_matcha/sw/autogen:top_matcha", |
| "//sw/device/lib/dif:rv_plic_smc", |
| "@lowrisc_opentitan//sw/device/lib/base:csr", |
| "@lowrisc_opentitan//sw/device/lib/base:macros", |
| "@lowrisc_opentitan//sw/device/lib/crt", |
| "@lowrisc_opentitan//sw/device/lib/runtime:hart", |
| "@lowrisc_opentitan//sw/device/lib/runtime:ibex", |
| "@lowrisc_opentitan//sw/device/lib/runtime:log", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:check", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:test_framework_manifest_def", |
| "@lowrisc_opentitan//sw/device/silicon_creator/lib/base:static_critical_boot_measurements", |
| "@lowrisc_opentitan//sw/device/silicon_creator/lib/base:static_critical_epmp_state", |
| "@lowrisc_opentitan//sw/device/silicon_creator/lib/base:static_critical_sec_mmio", |
| ], |
| ) |
| |
| cc_library( |
| name = "test_util", |
| srcs = ["test_util.c"], |
| hdrs = ["test_util.h"], |
| target_compatible_with = [OPENTITAN_CPU], |
| deps = [ |
| "//sw/device/lib/arch:device", |
| "@lowrisc_opentitan//sw/device/lib/dif:uart", |
| "@lowrisc_opentitan//sw/device/lib/runtime:print", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:check", |
| ], |
| ) |
| |
| cc_library( |
| name = "ottf_main", |
| srcs = [ |
| "ottf_main.c", |
| "test_hooks_default.c", |
| ], |
| hdrs = ["@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_main.h"], |
| target_compatible_with = [OPENTITAN_CPU], |
| deps = [ |
| ":freertos_port", |
| ":ottf_start", |
| "//hw/top_matcha/sw/autogen:top_matcha", |
| "//sw/device/lib/arch:device", |
| "@lowrisc_opentitan//sw/device/lib/base:macros", |
| "@lowrisc_opentitan//sw/device/lib/dif:rv_core_ibex", |
| "@lowrisc_opentitan//sw/device/lib/dif:uart", |
| "@lowrisc_opentitan//sw/device/lib/runtime:hart", |
| "@lowrisc_opentitan//sw/device/lib/runtime:log", |
| "@lowrisc_opentitan//sw/device/lib/runtime:print", |
| "@lowrisc_opentitan//sw/device/lib/testing:rand_testutils", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:check", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:coverage_none", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_flow_control", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_start", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_test_config", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:status", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:test_framework_manifest_def", |
| "@lowrisc_opentitan//third_party/freertos", |
| ], |
| # `:ottf` depends on `:ottf_start`, but `:ottf_start` gets its main function from |
| # `:ottf`. Thus we need to include all of the objects in `:ottf` unconditionally |
| # so that the linker can find the symbol later. |
| alwayslink = True, |
| ) |
| |
| cc_library( |
| name = "freertos_port", |
| srcs = [ |
| "freertos_port.c", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:freertos_hooks.c", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:freertos_port.S", |
| ], |
| deps = [ |
| ":ottf_start", |
| "//hw/top_matcha/sw/autogen:top_matcha", |
| "@lowrisc_opentitan//sw/device/lib/dif:rv_timer", |
| "@lowrisc_opentitan//sw/device/lib/dif:uart", |
| "@lowrisc_opentitan//sw/device/lib/runtime:hart", |
| "@lowrisc_opentitan//sw/device/lib/runtime:irq", |
| "@lowrisc_opentitan//sw/device/lib/runtime:log", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:check", |
| "@lowrisc_opentitan//sw/device/lib/testing/test_framework:freertos_config", |
| "@lowrisc_opentitan//third_party/freertos", |
| ], |
| # This library provides FreeRTOS hooks that are required for FreeRTOS to link, |
| # but FreeRTOS (currently) does not depend on this target. Therefore, we need |
| # to include all of the symbols from this object in the link so that they are |
| # found during linking. |
| alwayslink = True, |
| ) |
| |
| # Exports the kelvin files to be used by the kelvin_binary() |
| exports_files([ |
| "kelvin.ld", |
| "kelvin_gloss.c", |
| "kelvin_start.S", |
| ]) |