blob: dd1e6f7b413f2987d0840960293a559ca9132680 [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 DiGirolamo62de81b2020-10-20 17:31:36 -070024
25 # TODO(tonymd): "teensy/avr" here should match the folders in this dir:
26 # "../third_party/arduino/cores/$arduino_core_name/hardware/*")
27 # For teensy: "teensy/avr", for adafruit-samd: "samd/1.6.2"
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070028 arduino_package_name = "teensy/avr"
29 arduino_board = "teensy40"
30
31 # Menu options should be a list of strings.
32 arduino_menu_options = [
33 "menu.usb.serial",
34 "menu.keys.en-us",
35 ]
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070036}
37
38arduino_builder_script =
Anthony DiGirolamo50a196f2020-09-27 10:03:16 -070039 get_path_info("py/pw_arduino_build/__main__.py", "abspath")
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070040
Anthony DiGirolamo9147aa02020-09-22 10:41:05 -070041_arduino_core_path =
42 rebase_path("../third_party/arduino/cores/$arduino_core_name")
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070043_compiler_path_override =
44 rebase_path(getenv("_PW_ACTUAL_ENVIRONMENT_ROOT") + "/cipd/pigweed/bin")
45
46arduino_global_args = [
47 "--arduino-package-path",
48 _arduino_core_path,
49 "--arduino-package-name",
50 arduino_package_name,
51 "--compiler-path-override",
52 _compiler_path_override,
Anthony DiGirolamoc36af652020-09-29 14:34:27 -070053
54 # Save config files to "out/arduino_debug/gen/arduino_builder_config.json"
55 "--config-file",
56 rebase_path(root_gen_dir) + "/arduino_builder_config.json",
57 "--save-config",
Anthony DiGirolamo50a196f2020-09-27 10:03:16 -070058]
59
60arduino_board_args = [
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070061 "--build-path",
62 rebase_path(root_build_dir),
63 "--board",
64 arduino_board,
65 "--menu-options",
66]
Anthony DiGirolamo50a196f2020-09-27 10:03:16 -070067arduino_board_args += arduino_menu_options
68
69arduino_show_command_args = arduino_global_args + [
70 "show",
71 "--delimit-with-newlines",
72 ] + arduino_board_args
73
74arduino_run_command_args = arduino_global_args + [ "run" ] + arduino_board_args