Skip to content

Commit

Permalink
[topgen] Mark top_lib as compatible with only the expected top
Browse files Browse the repository at this point in the history
This avoid including by mistake the wrong file: because it is
marked as incompatible, it will fail to compile.

Signed-off-by: Amaury Pouly <[email protected]>
  • Loading branch information
pamaury committed Jan 8, 2025
1 parent 644dc1c commit 95af076
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hw/top_darjeeling/sw/autogen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand All @@ -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"),
)
3 changes: 3 additions & 0 deletions hw/top_earlgrey/sw/autogen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand All @@ -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"),
)
3 changes: 3 additions & 0 deletions util/topgen/templates/toplevel_BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand All @@ -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"]}"),
)

0 comments on commit 95af076

Please sign in to comment.