| 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 | 62de81b | 2020-10-20 17:31:36 -0700 | [diff] [blame^] | 24 | |
| 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 DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 28 | 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 DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | arduino_builder_script = |
| Anthony DiGirolamo | 50a196f | 2020-09-27 10:03:16 -0700 | [diff] [blame] | 39 | get_path_info("py/pw_arduino_build/__main__.py", "abspath") |
| Anthony DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 40 | |
| Anthony DiGirolamo | 9147aa0 | 2020-09-22 10:41:05 -0700 | [diff] [blame] | 41 | _arduino_core_path = |
| 42 | rebase_path("../third_party/arduino/cores/$arduino_core_name") |
| Anthony DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 43 | _compiler_path_override = |
| 44 | rebase_path(getenv("_PW_ACTUAL_ENVIRONMENT_ROOT") + "/cipd/pigweed/bin") |
| 45 | |
| 46 | arduino_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 DiGirolamo | c36af65 | 2020-09-29 14:34:27 -0700 | [diff] [blame] | 53 | |
| 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 DiGirolamo | 50a196f | 2020-09-27 10:03:16 -0700 | [diff] [blame] | 58 | ] |
| 59 | |
| 60 | arduino_board_args = [ |
| Anthony DiGirolamo | eea0d77 | 2020-08-06 12:00:36 -0700 | [diff] [blame] | 61 | "--build-path", |
| 62 | rebase_path(root_build_dir), |
| 63 | "--board", |
| 64 | arduino_board, |
| 65 | "--menu-options", |
| 66 | ] |
| Anthony DiGirolamo | 50a196f | 2020-09-27 10:03:16 -0700 | [diff] [blame] | 67 | arduino_board_args += arduino_menu_options |
| 68 | |
| 69 | arduino_show_command_args = arduino_global_args + [ |
| 70 | "show", |
| 71 | "--delimit-with-newlines", |
| 72 | ] + arduino_board_args |
| 73 | |
| 74 | arduino_run_command_args = arduino_global_args + [ "run" ] + arduino_board_args |