• 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_library",
18    "pw_cc_test",
19)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"])
24
25pw_cc_library(
26    name = "config",
27    hdrs = ["pw_cpu_exception_cortex_m_private/config.h"],
28)
29
30pw_cc_library(
31    name = "cpu_state",
32    hdrs = ["public/pw_cpu_exception_cortex_m/cpu_state.h"],
33    includes = ["public"],
34    deps = [
35        "//pw_preprocessor",
36        "//pw_preprocessor:arch",
37    ],
38)
39
40pw_cc_library(
41    name = "util",
42    srcs = ["util.cc"],
43    hdrs = ["public/pw_cpu_exception_cortex_m/util.h"],
44    includes = ["public"],
45    deps = [
46        ":config",
47        ":cortex_m_constants",
48        ":cpu_state",
49        "//pw_log",
50        "//pw_preprocessor:arch",
51    ],
52)
53
54pw_cc_library(
55    name = "support",
56    srcs = ["support.cc"],
57    deps = [
58        ":config",
59        ":cortex_m_constants",
60        ":cpu_state",
61        ":util",
62        "//pw_log",
63        "//pw_preprocessor",
64        "//pw_preprocessor:arch",
65        "//pw_string",
66    ],
67)
68
69pw_cc_library(
70    name = "proto_dump",
71    srcs = ["proto_dump.cc"],
72    hdrs = ["public/pw_cpu_exception_cortex_m/proto_dump.h"],
73    includes = ["public"],
74    deps = [
75        ":config",
76        ":cpu_state",
77        ":cpu_state_protos",
78        ":support",
79        "//pw_protobuf",
80        "//pw_status",
81        "//pw_stream",
82    ],
83)
84
85proto_library(
86    name = "cpu_state_protos",
87    srcs = ["pw_cpu_exception_cortex_m_protos/cpu_state.proto"],
88)
89
90pw_cc_library(
91    name = "cpu_exception",
92    srcs = ["entry.cc"],
93    hdrs = [
94        "public/pw_cpu_exception_cortex_m/cpu_state.h",
95        "public_overrides/pw_cpu_exception_backend/state.h",
96    ],
97    includes = ["public"],
98    deps = [
99        ":config",
100        ":cpu_state",
101        ":cortex_m_constants",
102        ":proto_dump",
103        ":support",
104        ":util",
105        # TODO(pwbug/101): Need to add support for facades/backends to Bazel.
106        "//pw_cpu_exception",
107        "//pw_preprocessor",
108        "//pw_preprocessor:arch",
109    ],
110)
111
112pw_cc_library(
113    name = "snapshot",
114    srcs = ["snapshot.cc"],
115    hdrs = ["public/pw_cpu_exception_cortex_m/snapshot.h"],
116    deps = [
117        ":config",
118        ":cortex_m_constants",
119        ":cpu_state",
120        ":cpu_state_protos",
121        ":proto_dump",
122        ":util",
123        "//pw_log",
124        "//pw_protobuf",
125        "//pw_status",
126        "//pw_thread:protos",
127        "//pw_thread:snapshot",
128    ],
129)
130
131pw_cc_library(
132    name = "cortex_m_constants",
133    hdrs = ["pw_cpu_exception_cortex_m_private/cortex_m_constants.h"],
134    visibility = ["//visibility:private"],
135    deps = ["//pw_preprocessor:arch"],
136)
137
138pw_cc_test(
139    name = "cpu_exception_entry_test",
140    srcs = [
141        "exception_entry_test.cc",
142    ],
143    deps = [
144        ":cpu_exception",
145        ":cpu_state",
146    ],
147)
148
149pw_cc_test(
150    name = "util_test",
151    srcs = [
152        "util_test.cc",
153    ],
154    deps = [
155        ":cpu_state",
156        ":util",
157    ],
158)
159