From 08fc445e2bd23ad6493a07d69f62a5958a494b90 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Tue, 26 Nov 2024 18:47:44 +0100 Subject: [PATCH 1/6] [hw/top] Add macro to select based on top Signed-off-by: Amaury Pouly --- hw/top/defs.bzl | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/hw/top/defs.bzl b/hw/top/defs.bzl index f0131cdd56aac..2981cb56c925f 100644 --- a/hw/top/defs.bzl +++ b/hw/top/defs.bzl @@ -52,3 +52,40 @@ def opentitan_require_ip(ip): ) """ return opentitan_if_ip(ip, [], ["@platforms//:incompatible"]) + +def opentitan_select_top(values, default): + """ + Select a value based on the top. If no top matches, a default + value is returned. The values must be a dictionary where each key + is either a string, or an array of string. + + Example: + alias( + name = "my_alias", + actual = opentitan_select_top({ + "earlgrey": "//something:earlgrey", + ["english_breakfast", "darjeeling"]: "//something:else", + }, "//something:error") + ) + """ + branches = {} + for (tops, value) in values.items(): + if type(tops) == "string": + tops = [tops] + for top in tops: + branches["//hw/top:is_{}".format(top)] = value + branches["//conditions:default"] = default + return select(branches) + +def opentitan_require_top(top): + """ + Return a value that can be used with `target_compatible_with` to + express that this target only works on the requested top. + + Example: + cc_library( + name = "my_library", + target_compatible_with = opentitan_require_top("darjeeling"), + ) + """ + return opentitan_select_top({top: []}, ["@platforms//:incompatible"]) From f074e27c2e417fca3b6c7e536b34d6816fbad664 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Tue, 14 Jan 2025 16:04:36 +0100 Subject: [PATCH 2/6] [englishbreakfast] Add top description to //hw/top Signed-off-by: Amaury Pouly --- hw/top/defs.bzl | 2 ++ hw/top_englishbreakfast/ip/ast/BUILD | 1 + hw/top_englishbreakfast/ip/ast/defs.bzl | 1 + 3 files changed, 4 insertions(+) create mode 120000 hw/top_englishbreakfast/ip/ast/BUILD create mode 120000 hw/top_englishbreakfast/ip/ast/defs.bzl diff --git a/hw/top/defs.bzl b/hw/top/defs.bzl index 2981cb56c925f..834d26048825d 100644 --- a/hw/top/defs.bzl +++ b/hw/top/defs.bzl @@ -4,10 +4,12 @@ load("//rules/opentitan:hw.bzl", "opentitan_top") load("//hw/top_earlgrey/data/autogen:defs.bzl", "EARLGREY") load("//hw/top_darjeeling/data/autogen:defs.bzl", "DARJEELING") +load("//hw/top_englishbreakfast/data/autogen:defs.bzl", "ENGLISHBREAKFAST") ALL_TOPS = [ EARLGREY, DARJEELING, + ENGLISHBREAKFAST, ] ALL_TOP_NAMES = [ diff --git a/hw/top_englishbreakfast/ip/ast/BUILD b/hw/top_englishbreakfast/ip/ast/BUILD new file mode 120000 index 0000000000000..5f64280a44b08 --- /dev/null +++ b/hw/top_englishbreakfast/ip/ast/BUILD @@ -0,0 +1 @@ +../../../top_earlgrey/ip/ast/BUILD \ No newline at end of file diff --git a/hw/top_englishbreakfast/ip/ast/defs.bzl b/hw/top_englishbreakfast/ip/ast/defs.bzl new file mode 120000 index 0000000000000..60d1136b6532a --- /dev/null +++ b/hw/top_englishbreakfast/ip/ast/defs.bzl @@ -0,0 +1 @@ +../../../top_earlgrey/ip/ast/defs.bzl \ No newline at end of file From 3f8a758857c4d96991231e8169898067a970478f Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 28 Nov 2024 17:16:34 +0100 Subject: [PATCH 3/6] [rules] Add support for preprocessing linker script files With this commit, linker script files are now preprocessed. The is handled similarly to `cc_library`: if `ld_library` is used with only files in `includes`, then it simply adds them to the compilation context. If `ld_library` is used with `script` set, then the file with be preprocessed with the compilation context constructed from its dependencies. This commit also adds a `defines` attribute to the `ld_library` so that defines can be set in bazel BUILD files. Signed-off-by: Amaury Pouly --- rules/linker.bzl | 106 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 94 insertions(+), 12 deletions(-) diff --git a/rules/linker.bzl b/rules/linker.bzl index db3e35979b24a..c242f5742cde1 100644 --- a/rules/linker.bzl +++ b/rules/linker.bzl @@ -4,12 +4,73 @@ """Rules for declaring linker scripts and linker script fragments.""" +load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain") +load("@rules_cc//cc:action_names.bzl", "C_COMPILE_ACTION_NAME") + +def _preprocess_linker_file(ctx): + cc_toolchain = find_cc_toolchain(ctx) + features = cc_common.configure_features( + ctx = ctx, + cc_toolchain = cc_toolchain, + requested_features = ctx.features, + unsupported_features = ctx.disabled_features, + ) + compilation_context = cc_common.merge_compilation_contexts( + compilation_contexts = [dep[CcInfo].compilation_context for dep in ctx.attr.deps], + ) + + # FIXME could not get cc_common.compile to work because it returns no object. + cxx_compiler_path = cc_common.get_tool_for_action( + feature_configuration = features, + action_name = C_COMPILE_ACTION_NAME, + ) + c_compile_variables = cc_common.create_compile_variables( + feature_configuration = features, + cc_toolchain = cc_toolchain, + user_compile_flags = ctx.fragments.cpp.copts + ctx.fragments.cpp.conlyopts, + include_directories = compilation_context.includes, + quote_include_directories = compilation_context.quote_includes, + system_include_directories = compilation_context.system_includes, + preprocessor_defines = depset(ctx.attr.defines, transitive = [compilation_context.defines]), + ) + cmd_line = cc_common.get_memory_inefficient_command_line( + feature_configuration = features, + action_name = C_COMPILE_ACTION_NAME, + variables = c_compile_variables, + ) + env = cc_common.get_environment_variables( + feature_configuration = features, + action_name = C_COMPILE_ACTION_NAME, + variables = c_compile_variables, + ) + output_script = ctx.actions.declare_file(ctx.label.name + ".ld") + ctx.actions.run( + outputs = [output_script], + inputs = depset( + [ctx.file.script], + transitive = [compilation_context.headers, cc_toolchain.all_files], + ), + executable = cxx_compiler_path, + arguments = [ + "-E", # Preprocess only. + "-P", # Avoid line markers in output. + "-C", # Keep comments + "-xc", # Force C language. + ctx.file.script.path, + "-o", + output_script.path, + ] + cmd_line, + env = env, + ) + return output_script + def _ld_library_impl(ctx): - files = [] user_link_flags = [] + files = [] # Disable non-volatile scratch region and counters if building for english # breakfast. This should appear before the linker script. + # FIXME Get rid of this. if "-DOT_IS_ENGLISH_BREAKFAST_REDUCED_SUPPORT_FOR_INTERNAL_USE_ONLY_" in ctx.fragments.cpp.copts: user_link_flags += [ "-Wl,--defsym=no_ottf_nv_scratch=1", @@ -20,22 +81,29 @@ def _ld_library_impl(ctx): "-Wl,-nmagic", ] - if ctx.files.includes: - files += ctx.files.includes - user_link_flags += [ - "-Wl,-L,{}".format(include.dirname) - for include in ctx.files.includes - ] + files += ctx.files.includes + user_link_flags += [ + "-Wl,-L,{}".format(include.dirname) + for include in ctx.files.includes + ] if ctx.file.script: - files += ctx.files.script + output_script = _preprocess_linker_file(ctx) + files.append(output_script) + user_link_flags += [ - "-Wl,-T,{}".format(ctx.file.script.path), + "-Wl,-T,{}".format(output_script.path), ] return [ + DefaultInfo( + files = depset(files), + ), cc_common.merge_cc_infos( - direct_cc_infos = [CcInfo( + # Order is important! We list dependencies first so that any + # linker flags set by dependencies (such as -Wl,-L) appear before + # the files that depend on them. + cc_infos = [dep[CcInfo] for dep in ctx.attr.deps] + [CcInfo( linking_context = cc_common.create_linking_context( linker_inputs = depset([cc_common.create_linker_input( owner = ctx.label, @@ -43,8 +111,10 @@ def _ld_library_impl(ctx): user_link_flags = depset(user_link_flags), )]), ), + compilation_context = cc_common.create_compilation_context( + defines = depset(ctx.attr.defines), + ), )], - cc_infos = [dep[CcInfo] for dep in ctx.attr.deps], ), ] @@ -66,10 +136,21 @@ ld_library = rule( for more details. """, attrs = { - "script": attr.label(allow_single_file = True), + "script": attr.label( + allow_single_file = True, + doc = "Main linker script. This file will be preprocessed.", + ), + "defines": attr.string_list( + doc = "C preprocessor defines. These defines are subject to Make variable substitution.", + ), "includes": attr.label_list( default = [], allow_files = True, + doc = """ + Link script libraries. Those files will automatically be added + to the linker search paths and will also be available in the + preprocessing context of the main link script. + """, ), "deps": attr.label_list( default = [], @@ -79,4 +160,5 @@ ld_library = rule( default = False, ), }, + toolchains = ["@rules_cc//cc:toolchain_type"], ) From a2147f3462073c74a16c2481e15c174982a02314 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 16 Jan 2025 16:03:37 +0100 Subject: [PATCH 4/6] [topgen] Mark top lid/ld as compatible with only the expected top This avoid including by mistake the wrong file: because it is marked as incompatible, it will fail to compile. Signed-off-by: Amaury Pouly --- hw/top_darjeeling/sw/autogen/BUILD | 3 +++ hw/top_earlgrey/sw/autogen/BUILD | 3 +++ hw/top_englishbreakfast/sw/autogen/BUILD | 3 +++ util/topgen/templates/toplevel_BUILD.tpl | 3 +++ 4 files changed, 12 insertions(+) diff --git a/hw/top_darjeeling/sw/autogen/BUILD b/hw/top_darjeeling/sw/autogen/BUILD index 9ae4fb6801866..55cf1f5cf8126 100644 --- a/hw/top_darjeeling/sw/autogen/BUILD +++ b/hw/top_darjeeling/sw/autogen/BUILD @@ -8,6 +8,7 @@ # -o hw/top_darjeeling load("//rules:linker.bzl", "ld_library") +load("//hw/top:defs.bzl", "opentitan_require_top") package(default_visibility = ["//visibility:public"]) @@ -20,9 +21,11 @@ cc_library( "top_darjeeling.h", "top_darjeeling_memory.h", ], + target_compatible_with = opentitan_require_top("darjeeling"), ) ld_library( name = "top_darjeeling_memory", includes = ["top_darjeeling_memory.ld"], + target_compatible_with = opentitan_require_top("darjeeling"), ) diff --git a/hw/top_earlgrey/sw/autogen/BUILD b/hw/top_earlgrey/sw/autogen/BUILD index 3602c5adb5b68..230cec35bb565 100644 --- a/hw/top_earlgrey/sw/autogen/BUILD +++ b/hw/top_earlgrey/sw/autogen/BUILD @@ -8,6 +8,7 @@ # -o hw/top_earlgrey load("//rules:linker.bzl", "ld_library") +load("//hw/top:defs.bzl", "opentitan_require_top") package(default_visibility = ["//visibility:public"]) @@ -20,9 +21,11 @@ cc_library( "top_earlgrey.h", "top_earlgrey_memory.h", ], + target_compatible_with = opentitan_require_top("earlgrey"), ) ld_library( name = "top_earlgrey_memory", includes = ["top_earlgrey_memory.ld"], + target_compatible_with = opentitan_require_top("earlgrey"), ) diff --git a/hw/top_englishbreakfast/sw/autogen/BUILD b/hw/top_englishbreakfast/sw/autogen/BUILD index 7c1720a6e7a67..e660392876208 100644 --- a/hw/top_englishbreakfast/sw/autogen/BUILD +++ b/hw/top_englishbreakfast/sw/autogen/BUILD @@ -8,6 +8,7 @@ # -o hw/top_englishbreakfast load("//rules:linker.bzl", "ld_library") +load("//hw/top:defs.bzl", "opentitan_require_top") package(default_visibility = ["//visibility:public"]) @@ -20,9 +21,11 @@ cc_library( "top_englishbreakfast.h", "top_englishbreakfast_memory.h", ], + target_compatible_with = opentitan_require_top("englishbreakfast"), ) ld_library( name = "top_englishbreakfast_memory", includes = ["top_englishbreakfast_memory.ld"], + target_compatible_with = opentitan_require_top("englishbreakfast"), ) diff --git a/util/topgen/templates/toplevel_BUILD.tpl b/util/topgen/templates/toplevel_BUILD.tpl index 560d1f531343a..e0f040f52c5f1 100644 --- a/util/topgen/templates/toplevel_BUILD.tpl +++ b/util/topgen/templates/toplevel_BUILD.tpl @@ -7,6 +7,7 @@ ${gencmd} top_name = "top_" + top["name"] %>\ load("//rules:linker.bzl", "ld_library") +load("//hw/top:defs.bzl", "opentitan_require_top") package(default_visibility = ["//visibility:public"]) @@ -19,9 +20,11 @@ cc_library( "${top_name}.h", "${top_name}_memory.h", ], + target_compatible_with = opentitan_require_top("${top["name"]}"), ) ld_library( name = "${top_name}_memory", includes = ["${top_name}_memory.ld"], + target_compatible_with = opentitan_require_top("${top["name"]}"), ) From 18941c0087d961eeabfd5f004d1b1f9ea75364aa Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 16 Jan 2025 16:06:12 +0100 Subject: [PATCH 5/6] [topgen] Add defines to top linker script to point to the script Each top has a different top linker file name. When dependencies switch to multitop, then need to INCLUDE the correct file. This commit adds a define OPENTITAN_TOP_MEMORY_LD which is set to the file name so that user can do INCLUDE OPENTITAN_TOP_MEMORY_LD Signed-off-by: Amaury Pouly --- hw/top_darjeeling/sw/autogen/BUILD | 1 + hw/top_earlgrey/sw/autogen/BUILD | 1 + hw/top_englishbreakfast/sw/autogen/BUILD | 1 + util/topgen/templates/toplevel_BUILD.tpl | 1 + 4 files changed, 4 insertions(+) diff --git a/hw/top_darjeeling/sw/autogen/BUILD b/hw/top_darjeeling/sw/autogen/BUILD index 55cf1f5cf8126..51cfe7c20f3d1 100644 --- a/hw/top_darjeeling/sw/autogen/BUILD +++ b/hw/top_darjeeling/sw/autogen/BUILD @@ -26,6 +26,7 @@ cc_library( ld_library( name = "top_darjeeling_memory", + defines = ["OPENTITAN_TOP_MEMORY_LD=top_darjeeling_memory.ld"], includes = ["top_darjeeling_memory.ld"], target_compatible_with = opentitan_require_top("darjeeling"), ) diff --git a/hw/top_earlgrey/sw/autogen/BUILD b/hw/top_earlgrey/sw/autogen/BUILD index 230cec35bb565..021c0a4a295e3 100644 --- a/hw/top_earlgrey/sw/autogen/BUILD +++ b/hw/top_earlgrey/sw/autogen/BUILD @@ -26,6 +26,7 @@ cc_library( ld_library( name = "top_earlgrey_memory", + defines = ["OPENTITAN_TOP_MEMORY_LD=top_earlgrey_memory.ld"], includes = ["top_earlgrey_memory.ld"], target_compatible_with = opentitan_require_top("earlgrey"), ) diff --git a/hw/top_englishbreakfast/sw/autogen/BUILD b/hw/top_englishbreakfast/sw/autogen/BUILD index e660392876208..e24c59a06713c 100644 --- a/hw/top_englishbreakfast/sw/autogen/BUILD +++ b/hw/top_englishbreakfast/sw/autogen/BUILD @@ -26,6 +26,7 @@ cc_library( ld_library( name = "top_englishbreakfast_memory", + defines = ["OPENTITAN_TOP_MEMORY_LD=top_englishbreakfast_memory.ld"], includes = ["top_englishbreakfast_memory.ld"], target_compatible_with = opentitan_require_top("englishbreakfast"), ) diff --git a/util/topgen/templates/toplevel_BUILD.tpl b/util/topgen/templates/toplevel_BUILD.tpl index e0f040f52c5f1..6c30c8e053989 100644 --- a/util/topgen/templates/toplevel_BUILD.tpl +++ b/util/topgen/templates/toplevel_BUILD.tpl @@ -25,6 +25,7 @@ cc_library( ld_library( name = "${top_name}_memory", + defines = ["OPENTITAN_TOP_MEMORY_LD=${top_name}_memory.ld"], includes = ["${top_name}_memory.ld"], target_compatible_with = opentitan_require_top("${top["name"]}"), ) From 6fa9fc10ed520b3b10c9d77dc5b3c769b952dea8 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 16 Jan 2025 16:07:47 +0100 Subject: [PATCH 6/6] [ottf/test_rom] Include the correct top linker script in multitop The OPENTITAN_TOP_MEMORY_LD define is set in each top's linker library target. Signed-off-by: Amaury Pouly --- sw/device/lib/testing/test_framework/BUILD | 12 ++++++------ .../testing/test_framework/ottf_silicon_creator_a.ld | 4 +++- .../test_framework/ottf_silicon_creator_virtual.ld | 4 +++- .../testing/test_framework/ottf_silicon_owner_a.ld | 4 +++- .../testing/test_framework/ottf_silicon_owner_b.ld | 6 ++++-- .../test_framework/ottf_silicon_owner_virtual.ld | 4 +++- sw/device/lib/testing/test_rom/BUILD | 2 +- sw/device/lib/testing/test_rom/test_rom.ld | 2 +- 8 files changed, 24 insertions(+), 14 deletions(-) diff --git a/sw/device/lib/testing/test_framework/BUILD b/sw/device/lib/testing/test_framework/BUILD index df480c1539664..129b9020a035f 100644 --- a/sw/device/lib/testing/test_framework/BUILD +++ b/sw/device/lib/testing/test_framework/BUILD @@ -95,7 +95,7 @@ ld_library( script = "ottf_silicon_creator_a.ld", deps = [ ":ottf_ld_common", - "//hw/top_earlgrey/sw/autogen:top_earlgrey_memory", + "//hw/top:top_ld", ], ) @@ -104,7 +104,7 @@ ld_library( script = "ottf_silicon_creator_b.ld", deps = [ ":ottf_ld_common", - "//hw/top_earlgrey/sw/autogen:top_earlgrey_memory", + "//hw/top:top_ld", ], ) @@ -113,7 +113,7 @@ ld_library( script = "ottf_silicon_creator_virtual.ld", deps = [ ":ottf_ld_common", - "//hw/top_earlgrey/sw/autogen:top_earlgrey_memory", + "//hw/top:top_ld", ], ) @@ -122,7 +122,7 @@ ld_library( script = "ottf_silicon_owner_a.ld", deps = [ ":ottf_ld_common", - "//hw/top_earlgrey/sw/autogen:top_earlgrey_memory", + "//hw/top:top_ld", ], ) @@ -131,7 +131,7 @@ ld_library( script = "ottf_silicon_owner_b.ld", deps = [ ":ottf_ld_common", - "//hw/top_earlgrey/sw/autogen:top_earlgrey_memory", + "//hw/top:top_ld", ], ) @@ -140,7 +140,7 @@ ld_library( script = "ottf_silicon_owner_virtual.ld", deps = [ ":ottf_ld_common", - "//hw/top_earlgrey/sw/autogen:top_earlgrey_memory", + "//hw/top:top_ld", ], ) diff --git a/sw/device/lib/testing/test_framework/ottf_silicon_creator_a.ld b/sw/device/lib/testing/test_framework/ottf_silicon_creator_a.ld index 20319078379d8..f2ffe07030ffe 100644 --- a/sw/device/lib/testing/test_framework/ottf_silicon_creator_a.ld +++ b/sw/device/lib/testing/test_framework/ottf_silicon_creator_a.ld @@ -10,7 +10,9 @@ * This linker script generates a binary to run rom. */ -INCLUDE hw/top_earlgrey/sw/autogen/top_earlgrey_memory.ld +/* This linker script is preprocessed, OPENTITAN_TOP_MEMORY_LD is a define + * set by Bazel to point to the top's linker file. */ +INCLUDE OPENTITAN_TOP_MEMORY_LD /** * Symbols to be used in the setup of the address translation for the OTTF run diff --git a/sw/device/lib/testing/test_framework/ottf_silicon_creator_virtual.ld b/sw/device/lib/testing/test_framework/ottf_silicon_creator_virtual.ld index 8345c31a8aee0..94fbc6930ce83 100644 --- a/sw/device/lib/testing/test_framework/ottf_silicon_creator_virtual.ld +++ b/sw/device/lib/testing/test_framework/ottf_silicon_creator_virtual.ld @@ -10,7 +10,9 @@ * This linker script generates a binary to run rom. */ -INCLUDE hw/top_earlgrey/sw/autogen/top_earlgrey_memory.ld +/* This linker script is preprocessed, OPENTITAN_TOP_MEMORY_LD is a define + * set by Bazel to point to the top's linker file. */ +INCLUDE OPENTITAN_TOP_MEMORY_LD /** * Symbols to be used in the setup of the address translation for the OTTF run diff --git a/sw/device/lib/testing/test_framework/ottf_silicon_owner_a.ld b/sw/device/lib/testing/test_framework/ottf_silicon_owner_a.ld index f3a0d12855223..08ece9a5e247e 100644 --- a/sw/device/lib/testing/test_framework/ottf_silicon_owner_a.ld +++ b/sw/device/lib/testing/test_framework/ottf_silicon_owner_a.ld @@ -10,7 +10,9 @@ * This linker script generates a binary to run BL0 tests. */ -INCLUDE hw/top_earlgrey/sw/autogen/top_earlgrey_memory.ld +/* This linker script is preprocessed, OPENTITAN_TOP_MEMORY_LD is a define + * set by Bazel to point to the top's linker file. */ +INCLUDE OPENTITAN_TOP_MEMORY_LD /** * Symbols to be used in the setup of the address translation for the OTTF run diff --git a/sw/device/lib/testing/test_framework/ottf_silicon_owner_b.ld b/sw/device/lib/testing/test_framework/ottf_silicon_owner_b.ld index 2664ae9ea3f89..029f0579b856e 100644 --- a/sw/device/lib/testing/test_framework/ottf_silicon_owner_b.ld +++ b/sw/device/lib/testing/test_framework/ottf_silicon_owner_b.ld @@ -10,7 +10,9 @@ * This linker script generates a binary to run BL0 tests. */ -INCLUDE hw/top_earlgrey/sw/autogen/top_earlgrey_memory.ld +/* This linker script is preprocessed, OPENTITAN_TOP_MEMORY_LD is a define + * set by Bazel to point to the top's linker file. */ +INCLUDE OPENTITAN_TOP_MEMORY_LD /** * Symbols to be used in the setup of the address translation for the OTTF run @@ -22,4 +24,4 @@ _ottf_start_address = ORIGIN(eflash) + (LENGTH(eflash) / 2) + 0x10000; REGION_ALIAS("ottf_flash", eflash); -INCLUDE sw/device/lib/testing/test_framework/ottf_common.ld +INCLUDE ottf_common.ld diff --git a/sw/device/lib/testing/test_framework/ottf_silicon_owner_virtual.ld b/sw/device/lib/testing/test_framework/ottf_silicon_owner_virtual.ld index a85ecaa4c63fc..39af75f2681cc 100644 --- a/sw/device/lib/testing/test_framework/ottf_silicon_owner_virtual.ld +++ b/sw/device/lib/testing/test_framework/ottf_silicon_owner_virtual.ld @@ -10,7 +10,9 @@ * This linker script generates a binary to run BL0 tests. */ -INCLUDE hw/top_earlgrey/sw/autogen/top_earlgrey_memory.ld +/* This linker script is preprocessed, OPENTITAN_TOP_MEMORY_LD is a define + * set by Bazel to point to the top's linker file. */ +INCLUDE OPENTITAN_TOP_MEMORY_LD /** * Symbols to be used in the setup of the address translation for ROM_EXT. diff --git a/sw/device/lib/testing/test_rom/BUILD b/sw/device/lib/testing/test_rom/BUILD index 59c95cdb7cab0..b6e8235ecd360 100644 --- a/sw/device/lib/testing/test_rom/BUILD +++ b/sw/device/lib/testing/test_rom/BUILD @@ -19,7 +19,7 @@ ld_library( name = "linker_script", script = "test_rom.ld", deps = [ - "//hw/top_earlgrey/sw/autogen:top_earlgrey_memory", + "//hw/top:top_ld", "//sw/device:info_sections", "//sw/device/silicon_creator/lib/base:static_critical_sections", ], diff --git a/sw/device/lib/testing/test_rom/test_rom.ld b/sw/device/lib/testing/test_rom/test_rom.ld index fe768a8fbd0a0..2ce056a6a31fe 100644 --- a/sw/device/lib/testing/test_rom/test_rom.ld +++ b/sw/device/lib/testing/test_rom/test_rom.ld @@ -15,7 +15,7 @@ OUTPUT_ARCH(riscv) */ __DYNAMIC = 0; -INCLUDE hw/top_earlgrey/sw/autogen/top_earlgrey_memory.ld +INCLUDE OPENTITAN_TOP_MEMORY_LD /** * The boot address, which indicates the location of the initial interrupt