blob: 435781d6c81d6abd208c68b44872896d906a7156 [file] [log] [blame]
Alexei Frolov4c0428a2020-06-10 10:46:04 -07001# Copyright 2020 The Pigweed Authors
Armando Montanez5104cd62019-12-10 14:36:43 -08002#
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
Armando Montanezfb3d3fb2020-06-09 18:12:12 -070015# gn-format disable
16import("//build_overrides/pigweed.gni")
17
Armando Montanez5104cd62019-12-10 14:36:43 -080018import("$dir_pw_build/facade.gni")
19import("$dir_pw_docgen/docs.gni")
Alexei Frolov258fc1b2020-06-10 16:24:50 -070020import("backend.gni")
Armando Montanez5104cd62019-12-10 14:36:43 -080021config("default_config") {
22 include_dirs = [ "public" ]
23}
24
Armando Montanez356bf972020-06-04 10:35:55 -070025group("pw_cpu_exception") {
26 public_deps = [
27 ":entry",
28 ":handler",
29 ]
30}
31
32# This module has three facades, each of whose backends are set with a
33# different GN variable.
34#
35# - entry: This is the library that handles early exception entry and prepares
36# any CPU state that must be available to the exception handler via the
37# pw_CpuState object. The backend for this facade will be architecture-
38# specific.
39# Set this facade's backend via `pw_cpu_exception_ENTRY_BACKEND`
40#
41# - handler: This facade is backed by an application-specific handler that
42# determines what to do when an exception is encountered. This may be
43# capturing a crash report before resetting the device, or in some cases
44# handling the exception to allow execution to continue.
45# Set this facade's backend via `pw_cpu_exception_HANDLER_BACKEND`
46#
47# - support: This facade provides architecture-independent functions that may be
48# helpful for dumping CPU state in various forms. This allows an application
49# to create an application-specific handler that is portable across multiple
50# architectures.
51# Set this facade's backend via `pw_cpu_exception_SUPPORT_BACKEND`
52
53pw_facade("entry") {
54 backend = pw_cpu_exception_ENTRY_BACKEND
55 facade_name = "entry_facade"
56 public_configs = [ ":default_config" ]
57 public_deps = [ "$dir_pw_preprocessor" ]
58 deps = [ ":handler_facade" ]
59 public = [ "public/pw_cpu_exception/entry.h" ]
60}
61
62pw_facade("handler") {
63 backend = pw_cpu_exception_HANDLER_BACKEND
64 facade_name = "handler_facade"
Wyatt Hepler21192402020-01-15 15:40:51 -080065 public_configs = [ ":default_config" ]
Armando Montanez5104cd62019-12-10 14:36:43 -080066 public_deps = [
67 "$dir_pw_preprocessor",
68 "$dir_pw_span",
Armando Montanez5104cd62019-12-10 14:36:43 -080069 ]
Armando Montanez356bf972020-06-04 10:35:55 -070070 sources = [ "start_exception_handler.cc" ]
71 public = [ "public/pw_cpu_exception/handler.h" ]
72}
73
74# This library is technically optional. It is recommended to use `support` when
75# doing basic dumps of CPU state. As an alternative, projects may choose to
76# directly depend on the entry backend if they require direct access to
77# pw_CpuExceptionState members.
78pw_facade("support") {
79 backend = pw_cpu_exception_SUPPORT_BACKEND
80 facade_name = "support_facade"
81 public_configs = [ ":default_config" ]
82 public_deps = [ "$dir_pw_span" ]
83 public = [ "public/pw_cpu_exception/support.h" ]
84}
85
86pw_source_set("basic_handler") {
87 deps = [
88 ":handler_facade",
89 dir_pw_log,
90 ]
91 sources = [ "basic_handler.cc" ]
Armando Montanez5104cd62019-12-10 14:36:43 -080092}
93
94pw_doc_group("docs") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080095 sources = [ "docs.rst" ]
Armando Montanez5104cd62019-12-10 14:36:43 -080096}