blob: a0a9096f0d46d290a322e7d01a14a1f7954ae067 [file] [log] [blame]
Armando Montaneza9ca9992021-01-26 17:06:10 -08001# Copyright 2019 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
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/target_types.gni")
18import("$dir_pw_cpu_exception/backend.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_protobuf_compiler/proto.gni")
21import("$dir_pw_unit_test/test.gni")
22
23config("default_config") {
24 include_dirs = [ "public" ]
25 visibility = [ ":*" ]
26}
27
28pw_source_set("support_armv7m") {
29 public_configs = [ ":default_config" ]
30 public_deps = [
31 "$dir_pw_cpu_exception:support.facade",
32 dir_pw_preprocessor,
33 dir_pw_string,
34 ]
35 deps = [ dir_pw_log ]
36 public = [ "public/pw_cpu_exception_cortex_m/cpu_state.h" ]
37 sources = [
38 "cpu_state.cc",
39 "pw_cpu_exception_cortex_m_private/cortex_m_constants.h",
40 ]
41}
42
43pw_source_set("proto_dump_armv7m") {
44 public_deps = [
45 ":support_armv7m",
46 dir_pw_protobuf,
47 dir_pw_status,
48 dir_pw_stream,
49 ]
50 public = [ "public/pw_cpu_exception_cortex_m/proto_dump.h" ]
51 deps = [ ":cpu_state_protos.pwpb" ]
52 sources = [ "proto_dump.cc" ]
53}
54
55pw_proto_library("cpu_state_protos") {
56 sources = [ "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_source_set("cpu_exception_armv7m") {
63 public_configs = [ ":default_config" ]
64 public_deps = [
65 ":proto_dump_armv7m",
66 ":support_armv7m",
67 "$dir_pw_cpu_exception:entry.facade",
68 "$dir_pw_cpu_exception:handler",
69 "$dir_pw_preprocessor",
70 ]
71 sources = [
72 "entry.cc",
73 "pw_cpu_exception_cortex_m_private/cortex_m_constants.h",
74 ]
75}
76
77pw_test_group("tests") {
78 enable_if = pw_cpu_exception_ENTRY_BACKEND ==
79 "$dir_pw_cpu_exception_cortex_m:cpu_exception_armv7m"
80 tests = [ ":cpu_exception_entry_test" ]
81}
82
83pw_test("cpu_exception_entry_test") {
84 deps = [ ":cpu_exception_armv7m" ]
85 sources = [ "exception_entry_test.cc" ]
86}
87
88pw_doc_group("docs") {
89 sources = [ "docs.rst" ]
90}