1# Copyright 2024 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("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") 16load("@rules_cc//cc:cc_library.bzl", "cc_library") 17load("@rules_python//python:proto.bzl", "py_proto_library") 18load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 19load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 20load("//pw_protobuf_compiler:pw_proto_library.bzl", "pwpb_proto_library") 21 22package(default_visibility = ["//visibility:public"]) 23 24licenses(["notice"]) 25 26constraint_value( 27 name = "support_backend", 28 constraint_setting = "//pw_cpu_exception:support_constraint_setting", 29) 30 31cc_library( 32 name = "config", 33 hdrs = ["pw_cpu_exception_risc_v_private/config.h"], 34 deps = [":config_override"], 35) 36 37label_flag( 38 name = "config_override", 39 build_setting_default = "//pw_build:default_module_config", 40) 41 42cc_library( 43 name = "cpu_state", 44 hdrs = ["public/pw_cpu_exception_risc_v/cpu_state.h"], 45 strip_include_prefix = "public", 46 deps = [ 47 "//pw_preprocessor", 48 ], 49) 50 51cc_library( 52 name = "support", 53 srcs = ["support.cc"], 54 target_compatible_with = select({ 55 "@platforms//cpu:riscv32": [], 56 "@platforms//cpu:riscv64": [], 57 "//conditions:default": ["@platforms//:incompatible"], 58 }), 59 deps = [ 60 ":config", 61 ":cpu_state", 62 "//pw_cpu_exception:support.facade", 63 "//pw_log", 64 "//pw_preprocessor", 65 "//pw_string", 66 ], 67) 68 69cc_library( 70 name = "proto_dump", 71 srcs = ["proto_dump.cc"], 72 hdrs = ["public/pw_cpu_exception_risc_v/proto_dump.h"], 73 strip_include_prefix = "public", 74 deps = [ 75 ":config", 76 ":cpu_state", 77 ":cpu_state_protos_cc.pwpb", 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_risc_v_protos/cpu_state.proto"], 88 import_prefix = "pw_cpu_exception_risc_v_protos", 89 strip_import_prefix = "/pw_cpu_exception_risc_v/pw_cpu_exception_risc_v_protos", 90) 91 92py_proto_library( 93 name = "cpu_state_protos_pb2", 94 deps = [":cpu_state_protos"], 95) 96 97pwpb_proto_library( 98 name = "cpu_state_protos_pwpb", 99 deps = [":cpu_state_protos"], 100) 101 102cc_library( 103 name = "snapshot", 104 srcs = ["snapshot.cc"], 105 hdrs = ["public/pw_cpu_exception_risc_v/snapshot.h"], 106 deps = [ 107 ":config", 108 ":cpu_state", 109 ":cpu_state_protos_pwpb", 110 ":proto_dump", 111 "//pw_log", 112 "//pw_protobuf", 113 "//pw_status", 114 "//pw_thread:snapshot", 115 "//pw_thread:thread_pwpb", 116 ], 117) 118 119sphinx_docs_library( 120 name = "docs", 121 srcs = [ 122 "docs.rst", 123 ], 124 prefix = "pw_cpu_exception_risc_v/", 125 target_compatible_with = incompatible_with_mcu(), 126) 127