Commit Graph

8 Commits

Author SHA1 Message Date
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
Anthony DiGirolamo
00e773eafb pw_arduino_build: Arduino library searching support
- Adds commands to return arduino library source files and include dirs.
- Example GN rule in targets/arduino/target_docs.rst
- Show error if a .elf doesn't exist in the unit_test_runner

Change-Id: Ic317c5c061799a7e02fdad834c685d8cb37ba9ce
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/23460
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: David Rogers <davidrogers@google.com>
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
2020-11-06 01:16:45 +00:00
Anthony DiGirolamo
62de81b268 pw_arduino_build: Fix Windows related issues
- Launch teensy installer with admin rights.
  subprocess.open doesn't exec with admin rights on windows
  which causes the TeensyduinoInstaller.exe to fail.

- Fix include path directory separator using pathlib.

Change-Id: I3fac7915a640ef66c0c3bdb4729e69cb250d5444
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22004
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2020-10-21 17:02:13 +00:00
Anthony DiGirolamo
c36af656df Arduino: unit_test_runner
- New unit test scripts
  - arduino_unit_test_runner
  - arduino_test_server
  - arduino_test_client
  - teensy_detector

- arduino_builder changes
  - '--config-file' loading and '--save-config' options
  - '--set-variable' option to set arduino recipe vars. This is used
    for passing vars to the teensyloader flash recipe.

- GN changes
  - exec_script(arduino_builder) calls will save config files to:
    ./out/arduino_debug/gen/arduino_builder_config.json
  - 'pw_arduino_use_test_server' gn build arg

The test_runner and test_server both require a options to
run properly, see targets/arduino/target_docs.rst for usage.

Change-Id: I118498c291d2fbb034faa372b9250f6a0783a478
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19220
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
2020-10-12 19:02:19 +00:00
Anthony DiGirolamo
50a196f8db Arduino: python cleanup
- Move code in arduinobuilder.py to their own modules:
  - __main__.py
  - builder.py
  - core_installer.py
  - file_operations.py
- New log.py module
- os.system -> subprocess.run
- Move --run-* args in the 'show' subcommand under the 'run' subcommand.
  This allows running multiple steps in the same invocation. For
  example, this will execute 3 steps:

  arduino_builder run \
                  --run-objcopy \
                  --run-postbuild \
                  --run-upload-command teensyloader

Change-Id: Ibe5493689f39aa6e6aaeecf5bc7065929111499d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19143
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
2020-10-06 19:50:35 +00:00
Wyatt Hepler
f9fb90f299 docs: Make labels consistent; remove boilerplate
- Update labels so they use consistent naming. Instead of the
  copy-and-pasted `chapter` prefix, name labels with a prefix consistent
  with what they point to:
  - "module-" for module
  - "target-" for targets
  - "docs-" for general documentation
- Remove the unnecessary highlight and default-domain directives.
  Neither is necessary since the Pigweed docs always specify the
  language in code snippets and other directives.

Change-Id: I55c34e9ec919f6f4670e5d3d008e0edf5fecf05b
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19328
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
2020-10-01 21:47:35 +00:00
Anthony DiGirolamo
9147aa0128 Arduino: main function wrapper
- Remove simple_printing_main_arduino.cc which used loop() and setup()
- Rename main() in arduino core sources to ArduinoMain()
- Define setup() and loop() in arduino_main_wrapper.cc and call pigweed
  main() in setup() after pw_arduino_Init();
- Switch to pw_unit_test_MAIN = "$dir_pw_unit_test:simple_printing_main"
  in //targets/arduino/target_toolchains.gni
- Add pw_arduino_build/public/pw_arduino_build/init.h facade
- Documentation!
- Fix bug in arduinobuilder.py when using an arduino core which uses
  only one sub-core folder.

Change-Id: I94630b25f6c914ef46bdb9c32e6ddb5154690045
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/18640
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
2020-09-25 23:05:41 +00:00
Anthony DiGirolamo
eea0d771a7 Arduino Pigweed Target
- New arduino pigweed target that uses gn build args to set arduino
  target board and specific build options.
- Add arduinobuilder.py (includes core installer for Linux/Mac/Windows)
- Working builds for Teensy 4.1, 4.0, 3.6, 3.5, 3.2

Change-Id: Ib751b5f92352ac3ec7fa649f444dc13efd080d12
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/18001
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
2020-09-21 20:28:18 +00:00