Anthony DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 1 | # 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 DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 15 | import("//build_overrides/pigweed.gni") |
Wyatt Hepler | d49f8fe | 2020-10-15 10:13:47 -0700 | [diff] [blame] | 16 | |
Anthony DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 17 | declare_args() { |
Anthony DiGirolamo | c36af65 | 2020-09-29 14:34:27 -0700 | [diff] [blame] | 18 | # 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 DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 22 | # Expected args for an Arduino build: |
Anthony DiGirolamo | 9147aa0 | 2020-09-22 10:41:05 -0700 | [diff] [blame] | 23 | arduino_core_name = "teensy" |
Anthony DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 24 | 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 DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | arduino_builder_script = |
Anthony DiGirolamo | 50a196f | 2020-09-27 10:03:16 -0700 | [diff] [blame] | 35 | get_path_info("py/pw_arduino_build/__main__.py", "abspath") |
Anthony DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 36 | |
Anthony DiGirolamo | 9147aa0 | 2020-09-22 10:41:05 -0700 | [diff] [blame] | 37 | _arduino_core_path = |
| 38 | rebase_path("../third_party/arduino/cores/$arduino_core_name") |
Anthony DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 39 | _compiler_path_override = |
| 40 | rebase_path(getenv("_PW_ACTUAL_ENVIRONMENT_ROOT") + "/cipd/pigweed/bin") |
| 41 | |
| 42 | arduino_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 DiGirolamo | c36af65 | 2020-09-29 14:34:27 -0700 | [diff] [blame] | 49 | |
| 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 DiGirolamo | 50a196f | 2020-09-27 10:03:16 -0700 | [diff] [blame] | 54 | ] |
| 55 | |
| 56 | arduino_board_args = [ |
Anthony DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 57 | "--build-path", |
| 58 | rebase_path(root_build_dir), |
| 59 | "--board", |
| 60 | arduino_board, |
| 61 | "--menu-options", |
| 62 | ] |
Anthony DiGirolamo | 50a196f | 2020-09-27 10:03:16 -0700 | [diff] [blame] | 63 | arduino_board_args += arduino_menu_options |
| 64 | |
| 65 | arduino_show_command_args = arduino_global_args + [ |
| 66 | "show", |
| 67 | "--delimit-with-newlines", |
| 68 | ] + arduino_board_args |
| 69 | |
| 70 | arduino_run_command_args = arduino_global_args + [ "run" ] + arduino_board_args |