• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_facade",
18    "pw_cc_library",
19)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"])
24
25pw_cc_facade(
26    name = "context_facade",
27    hdrs = [
28        "public/pw_interrupt/context.h",
29    ],
30    includes = ["public"],
31)
32
33pw_cc_library(
34    name = "context",
35    deps = [
36        ":context_facade",
37        "@pigweed_config//:pw_interrupt_backend",
38    ],
39)
40
41pw_cc_library(
42    name = "backend_multiplexer",
43    # Normally this would be done in the backend packages but because there is
44    # no host implementation we have to define this here.
45    target_compatible_with = select({
46        "@platforms//cpu:armv7-m": [],
47        "@platforms//cpu:armv7e-m": [],
48        "@platforms//cpu:armv8-m": [],
49        "//conditions:default": ["@platforms//:incompatible"],
50    }),
51    visibility = ["@pigweed_config//:__pkg__"],
52    deps = select({
53        "@platforms//cpu:armv7-m": ["//pw_interrupt_cortex_m:context_armv7m"],
54        "@platforms//cpu:armv7e-m": ["//pw_interrupt_cortex_m:context_armv7m"],
55        "@platforms//cpu:armv8-m": ["//pw_interrupt_cortex_m:context_armv8m"],
56        # This is required for this to be a valid select when building for the
57        # host i.e. 'bazel build //pw_interrupt/...'. The
58        # target_compatible_with attribute is used to skip this target when
59        # built with a wildcard. If explicitly depended on for a host build
60        # the build will fail.
61        "//conditions:default": [],
62    }),
63)
64