blob: ace1574805375afe53092fc8ff1d5005fce6491e [file] [log] [blame]
Armando Montaneza9ca9992021-01-26 17:06:10 -08001# 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",
Armando Montaneza9ca9992021-01-26 17:06:10 -080028 srcs = [
29 "cpu_state.cc",
30 "pw_cpu_exception_cortex_m_private/cortex_m_constants.h",
31 ],
Nathaniel Brougha1113be2021-03-07 09:05:41 +080032 hdrs = ["public/pw_cpu_exception_cortex_m/cpu_state.h"],
33 includes = ["public"],
34 deps = [
35 "//pw_log",
36 "//pw_preprocessor",
37 "//pw_string",
38 ],
Armando Montaneza9ca9992021-01-26 17:06:10 -080039)
40
41pw_cc_library(
42 name = "proto_dump_armv7m",
Nathaniel Brougha1113be2021-03-07 09:05:41 +080043 srcs = ["proto_dump.cc"],
44 hdrs = ["public/pw_cpu_exception_cortex_m/proto_dump.h"],
Armando Montaneza9ca9992021-01-26 17:06:10 -080045 deps = [
Armando Montaneza9ca9992021-01-26 17:06:10 -080046 ":cpu_state_protos",
Nathaniel Brougha1113be2021-03-07 09:05:41 +080047 ":support_armv7m",
Armando Montaneza9ca9992021-01-26 17:06:10 -080048 "//pw_protobuf",
49 "//pw_status",
50 "//pw_stream",
51 ],
Armando Montaneza9ca9992021-01-26 17:06:10 -080052)
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",
Nathaniel Brougha1113be2021-03-07 09:05:41 +080064 srcs = [
65 "entry.cc",
66 "pw_cpu_exception_cortex_m_private/cortex_m_constants.h",
67 ],
Armando Montaneza9ca9992021-01-26 17:06:10 -080068 deps = [
69 ":proto_dump_armv7m",
70 ":support_armv7m",
71 # TODO(pwbug/101): Need to add support for facades/backends to Bazel.
72 "//pw_cpu_exception",
73 "//pw_preprocessor",
74 ],
Armando Montaneza9ca9992021-01-26 17:06:10 -080075)
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)