• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2022 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/pi_pico.gni")
16import("//build_overrides/pigweed.gni")
17
18import("$dir_pw_build/target_types.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_toolchain/arm_gcc/toolchains.gni")
21import("$dir_pw_toolchain/generate_toolchain.gni")
22
23if (current_toolchain != default_toolchain) {
24  pw_source_set("pico_logging_test_main") {
25    # Required because the pico SDK can't properly propagate -Wno-undef and
26    # -Wno-unused-function because of Pigweed's very unusual default_configs
27    # behavior.
28    remove_configs = [ "$dir_pw_build:strict_warnings" ]
29    deps = [
30      "$PICO_ROOT/src/common/pico_base",
31      "$PICO_ROOT/src/common/pico_stdlib",
32      "$dir_pw_unit_test:logging_event_handler",
33      "$dir_pw_unit_test:pw_unit_test",
34    ]
35    sources = [ "pico_logging_test_main.cc" ]
36  }
37}
38
39generate_toolchain("rp2040") {
40  _excluded_members = [
41    "defaults",
42    "name",
43  ]
44  _toolchain_base = pw_toolchain_arm_gcc.cortex_m0plus_size_optimized
45  forward_variables_from(_toolchain_base, "*", _excluded_members)
46  final_binary_extension = ".elf"
47
48  # For now, no Pigweed configurations set up.
49  defaults = {
50    forward_variables_from(_toolchain_base.defaults, "*")
51
52    pw_build_EXECUTABLE_TARGET_TYPE = "pico_executable"
53    pw_build_EXECUTABLE_TARGET_TYPE_FILE =
54        get_path_info("pico_executable.gni", "abspath")
55    pw_unit_test_MAIN = "$dir_pigweed/targets/rp2040:pico_logging_test_main"
56    pw_assert_BACKEND = dir_pw_assert_basic
57    pw_log_BACKEND = dir_pw_log_basic
58    pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio"
59
60    pw_sync_INTERRUPT_SPIN_LOCK_BACKEND =
61        "$dir_pw_sync_baremetal:interrupt_spin_lock"
62    pw_sync_MUTEX_BACKEND = "$dir_pw_sync_baremetal:mutex"
63
64    # Silence GN variable overwrite warning.
65    pw_build_LINK_DEPS = []
66
67    pw_build_LINK_DEPS = [
68      "$dir_pw_assert:impl",
69      "$dir_pw_log:impl",
70    ]
71
72    current_cpu = "arm"
73    current_os = ""
74  }
75}
76
77pw_doc_group("target_docs") {
78  sources = [ "target_docs.rst" ]
79}
80