third_party.pigweed.src/pw_arduino_build/BUILD.gn
Anthony DiGirolamo 383be05904 pw_package: Arduino core installers and teensy presubmit
Summary of Changes
==================
1. Rename arduino build args to support cores in any location and have
   consistent naming.
2. Update docs to reflect above.
3. `pw package install teensy` working with nice status message on how
   to use ge pw_arduino_build_* args.
4. Added gn_teensy_build presubmit test step, not run by default.
   `pw presubmit --step gn_teensy_build`
5. Added missing system_rpc_server impl for //targets/arduino. This is
   just a copy of the stm32f429i one.

Build arg Change Examples
=========================

OLD:
    dir_pw_third_party_arduino = "//third_party/arduino"
    arduino_core_name = "teensy"
    arduino_package_name = "teensy/avr"
    arduino_board = "teensy41"
    arduino_menu_options = ["menu.usb.serial",
                            "menu.opt.o2std"]
NEW:
    pw_arduino_build_CORE_PATH =
      "/mnt/pigweed/pigweed/.environment/packages"
    pw_arduino_build_CORE_NAME = "teensy"
    pw_arduino_build_PACKAGE_NAME = "teensy/avr"
    pw_arduino_build_BOARD = "teensy41"
    pw_arduino_build_MENU_OPTIONS = ["menu.usb.serial",
                                     "menu.opt.o2std"]

All BUILD.gn checks for enabled arduino builds changed too:

OLD:
    if (dir_pw_third_party_arduino != "") {}
NEW:
    if (pw_arduino_build_CORE_PATH != "") {}

All gn target deps on arduino core sources changed.

OLD:
    "$dir_pw_third_party_arduino:arduino_core_sources",
NEW:
    "$dir_pw_third_party/arduino:arduino_core_sources",

Teensy package post install & status message
============================================

$ pw package status teensy

20210114 11:58:18 INF teensy is installed.
20210114 11:58:18 INF teensy currently installed in:
  /mnt/pigweed/pigweed/.environment/packages/teensy
20210114 11:58:18 INF Enable by running "gn args out" and adding
these lines:
  pw_arduino_build_CORE_PATH =
    "/mnt/pigweed/pigweed/.environment/packages"
  pw_arduino_build_CORE_NAME = "teensy"
  pw_arduino_build_PACKAGE_NAME = "teensy/avr"
  pw_arduino_build_BOARD = "BOARD_NAME"
20210114 11:58:18 INF Where BOARD_NAME is any supported board.
20210114 11:58:18 INF List available boards by running:
  arduino_builder
  --arduino-package-path
    /mnt/pigweed/pigweed/.environment/packages/teensy
  --arduino-package-name teensy/avr
  list-boards

Requires: pigweed:29490
Change-Id: Ifd0bd214777392a29af3ab24711edf2f2c1086f3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/26240
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
2021-01-22 16:28:36 +00:00

54 lines
1.5 KiB
Plaintext

# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("//build_overrides/pigweed.gni")
import("$dir_pw_arduino_build/arduino.gni")
import("$dir_pw_build/facade.gni")
import("$dir_pw_build/target_types.gni")
import("$dir_pw_docgen/docs.gni")
declare_args() {
# Backend for the pw_arduino_init module.
pw_arduino_build_INIT_BACKEND = ""
}
if (pw_arduino_build_CORE_PATH != "") {
pw_facade("arduino_init") {
backend = pw_arduino_build_INIT_BACKEND
public = [ "public/pw_arduino_build/init.h" ]
public_configs = [ ":default_config" ]
}
config("default_config") {
include_dirs = [ "public" ]
}
pw_source_set("arduino_main_wrapper") {
remove_configs = [ "$dir_pw_build:strict_warnings" ]
deps = [
":arduino_init",
"$dir_pw_sys_io",
"$dir_pw_third_party/arduino:arduino_core_sources",
]
sources = [ "arduino_main_wrapper.cc" ]
}
} else {
group("arduino_main_wrapper") {
}
}
pw_doc_group("docs") {
sources = [ "docs.rst" ]
}