• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 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_binary",
18    "pw_cc_library",
19    "pw_cc_test",
20)
21
22package(default_visibility = ["//visibility:public"])
23
24licenses(["notice"])  # Apache License 2.0
25
26pw_cc_library(
27    name = "support_armv7m",
28    includes = ["public"],
29    deps = [
30        "//pw_preprocessor",
31        "//pw_string",
32        "//pw_log",
33    ],
34    hdrs = [ "public/pw_cpu_exception_cortex_m/cpu_state.h" ],
35    srcs = [
36        "cpu_state.cc",
37        "pw_cpu_exception_cortex_m_private/cortex_m_constants.h",
38    ],
39)
40
41pw_cc_library(
42    name = "proto_dump_armv7m",
43    deps = [
44        ":support_armv7m",
45        ":cpu_state_protos",
46        "//pw_protobuf",
47        "//pw_status",
48        "//pw_stream",
49    ],
50    hdrs = ["public/pw_cpu_exception_cortex_m/proto_dump.h"],
51    srcs = ["proto_dump.cc"],
52)
53
54proto_library(
55    name = "cpu_state_protos",
56    srcs = ["pw_cpu_exception_cortex_m_protos/cpu_state.proto"],
57)
58
59# TODO(pwbug/296): The *_armv7m libraries work on ARMv8-M, but needs some minor
60# patches for complete correctness. Add *_armv8m targets that use the same files
61# but provide preprocessor defines to enable/disable architecture specific code.
62pw_cc_library(
63    name = "cpu_exception_armv7m",
64    deps = [
65        ":proto_dump_armv7m",
66        ":support_armv7m",
67        # TODO(pwbug/101): Need to add support for facades/backends to Bazel.
68        "//pw_cpu_exception",
69        "//pw_preprocessor",
70    ],
71    srcs = [
72        "entry.cc",
73        "pw_cpu_exception_cortex_m_private/cortex_m_constants.h",
74    ],
75)
76
77pw_cc_test(
78    name = "cpu_exception_entry_test",
79    srcs = [
80        "exception_entry_test.cc",
81    ],
82    deps = [
83        ":cpu_exception_armv7m",
84    ],
85)
86