blob: 0fd4c3cdfdaefe4a800aab3e7777793f92cdc780 [file] [log] [blame]
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -07001# Copyright 2020 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
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070015import("//build_overrides/pigweed.gni")
Wyatt Heplerd49f8fe2020-10-15 10:13:47 -070016
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070017declare_args() {
Anthony DiGirolamoc36af652020-09-29 14:34:27 -070018 # Enable/disable Arduino builds via group("arduino").
19 # Set to the full path of ./third_party/arduino
20 dir_pw_third_party_arduino = ""
21
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070022 # Expected args for an Arduino build:
Anthony DiGirolamo9147aa02020-09-22 10:41:05 -070023 arduino_core_name = "teensy"
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070024 arduino_package_name = "teensy/avr"
25 arduino_board = "teensy40"
26
27 # Menu options should be a list of strings.
28 arduino_menu_options = [
29 "menu.usb.serial",
30 "menu.keys.en-us",
31 ]
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070032}
33
34arduino_builder_script =
Anthony DiGirolamo50a196f2020-09-27 10:03:16 -070035 get_path_info("py/pw_arduino_build/__main__.py", "abspath")
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070036
Anthony DiGirolamo9147aa02020-09-22 10:41:05 -070037_arduino_core_path =
38 rebase_path("../third_party/arduino/cores/$arduino_core_name")
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070039_compiler_path_override =
40 rebase_path(getenv("_PW_ACTUAL_ENVIRONMENT_ROOT") + "/cipd/pigweed/bin")
41
42arduino_global_args = [
43 "--arduino-package-path",
44 _arduino_core_path,
45 "--arduino-package-name",
46 arduino_package_name,
47 "--compiler-path-override",
48 _compiler_path_override,
Anthony DiGirolamoc36af652020-09-29 14:34:27 -070049
50 # Save config files to "out/arduino_debug/gen/arduino_builder_config.json"
51 "--config-file",
52 rebase_path(root_gen_dir) + "/arduino_builder_config.json",
53 "--save-config",
Anthony DiGirolamo50a196f2020-09-27 10:03:16 -070054]
55
56arduino_board_args = [
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070057 "--build-path",
58 rebase_path(root_build_dir),
59 "--board",
60 arduino_board,
61 "--menu-options",
62]
Anthony DiGirolamo50a196f2020-09-27 10:03:16 -070063arduino_board_args += arduino_menu_options
64
65arduino_show_command_args = arduino_global_args + [
66 "show",
67 "--delimit-with-newlines",
68 ] + arduino_board_args
69
70arduino_run_command_args = arduino_global_args + [ "run" ] + arduino_board_args