Armando Montanez | a9ca999 | 2021-01-26 17:06:10 -0800 | [diff] [blame] | 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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_binary", |
| 18 | "pw_cc_library", |
| 19 | "pw_cc_test", |
| 20 | ) |
| 21 | |
| 22 | package(default_visibility = ["//visibility:public"]) |
| 23 | |
| 24 | licenses(["notice"]) # Apache License 2.0 |
| 25 | |
| 26 | pw_cc_library( |
| 27 | name = "support_armv7m", |
Armando Montanez | a9ca999 | 2021-01-26 17:06:10 -0800 | [diff] [blame] | 28 | srcs = [ |
| 29 | "cpu_state.cc", |
| 30 | "pw_cpu_exception_cortex_m_private/cortex_m_constants.h", |
| 31 | ], |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 32 | 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 Montanez | a9ca999 | 2021-01-26 17:06:10 -0800 | [diff] [blame] | 39 | ) |
| 40 | |
| 41 | pw_cc_library( |
| 42 | name = "proto_dump_armv7m", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 43 | srcs = ["proto_dump.cc"], |
| 44 | hdrs = ["public/pw_cpu_exception_cortex_m/proto_dump.h"], |
Armando Montanez | a9ca999 | 2021-01-26 17:06:10 -0800 | [diff] [blame] | 45 | deps = [ |
Armando Montanez | a9ca999 | 2021-01-26 17:06:10 -0800 | [diff] [blame] | 46 | ":cpu_state_protos", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 47 | ":support_armv7m", |
Armando Montanez | a9ca999 | 2021-01-26 17:06:10 -0800 | [diff] [blame] | 48 | "//pw_protobuf", |
| 49 | "//pw_status", |
| 50 | "//pw_stream", |
| 51 | ], |
Armando Montanez | a9ca999 | 2021-01-26 17:06:10 -0800 | [diff] [blame] | 52 | ) |
| 53 | |
| 54 | proto_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. |
| 62 | pw_cc_library( |
| 63 | name = "cpu_exception_armv7m", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 64 | srcs = [ |
| 65 | "entry.cc", |
| 66 | "pw_cpu_exception_cortex_m_private/cortex_m_constants.h", |
| 67 | ], |
Armando Montanez | a9ca999 | 2021-01-26 17:06:10 -0800 | [diff] [blame] | 68 | 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 Montanez | a9ca999 | 2021-01-26 17:06:10 -0800 | [diff] [blame] | 75 | ) |
| 76 | |
| 77 | pw_cc_test( |
| 78 | name = "cpu_exception_entry_test", |
| 79 | srcs = [ |
| 80 | "exception_entry_test.cc", |
| 81 | ], |
| 82 | deps = [ |
| 83 | ":cpu_exception_armv7m", |
| 84 | ], |
| 85 | ) |