aboutsummaryrefslogtreecommitdiff
path: root/pw_arduino_build
AgeCommit message (Collapse)Author
2021-01-25pw_package: Use CIPD packages for arduino coresAnthony DiGirolamo
Use "pigweed_internal/third_party/teensy/${platform}" CIPD packages if they are readable by the user. TEST: pw presubmit --step gn_teensy_build Change-Id: I73b9fb31e314c71c8cea357e29f7b9e788b6f894 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/30480 Commit-Queue: Anthony DiGirolamo <tonymd@google.com> Reviewed-by: Rob Mohr <mohrr@google.com>
2021-01-22pw_package: Arduino core installers and teensy presubmitAnthony DiGirolamo
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-13pw_arduino_build: Fix missing files from setup.pyAnthony DiGirolamo
Change-Id: Ie8ebbc113ee25858e3af6829b343dd0cf2c950ee Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/29484 Commit-Queue: Anthony DiGirolamo <tonymd@google.com> Reviewed-by: Keir Mierle <keir@google.com>
2021-01-13pw_arduino_build: Teensy and stm32duino fixesAnthony DiGirolamo
- Switch teensy core to 1.53 release - Add patching mechanism - Add patch to fix teensy core cpp17 compatibility. Contains these commits: - https://github.com/PaulStoffregen/cores/commit/a8046bb - https://github.com/PaulStoffregen/cores/commit/914219e - https://github.com/PaulStoffregen/cores/commit/1f3f914 - a patch to make flash_* functions non-static for teensy4 - Add delete message for downloads that fail checksums - stm32duino: Always include built-in SrcWrapper library Change-Id: Ib9e98de1bafbb81473cc7a350d8abb60a654e64f Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/27620 Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com> Pigweed-Auto-Submit: Anthony DiGirolamo <tonymd@google.com> Reviewed-by: Keir Mierle <keir@google.com>
2020-12-04pw_build: Support specifying mypy/pylint configWyatt Hepler
- Add pylintrc and mypy_ini options to the pw_python_package template. These can be used to specify configuration files to use for Pylint and Mypy. - Run pylint and mypy from the setup directory. This allows tools to find per-package configuration files (if they aren't specified by the pylintrc or mypy_ini arguments). - Fix some incorrect import ordering that Pylint detects now that it runs from package directories. PEP8 states imports should be grouped by standard library, third party, and local package imports. Change-Id: I8017341178ac5920d623ebbed4535432d69527c3 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/26700 Reviewed-by: Keir Mierle <keir@google.com> Reviewed-by: Alexei Frolov <frolv@google.com>
2020-11-17pw_arduino_build: Support Multiple Library PathsAnthony DiGirolamo
- `--library-path` can take multiple paths in order of increasing precedence similar to Arduino IDE behavior. This is useful for including the 'libraries' directory included in an Arduino core and a separate user library folder. - Remove serial wait loop from pw_sys_io_arduino - Fix raised ValueError if arduino core install prefix is not relative to os.getcwd() Change-Id: I6d68b319d2a6a4bfc6a7a599bf4c86f4bea96e39 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/24840 Reviewed-by: Keir Mierle <keir@google.com> Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
2020-11-08pw_arduino_build: fix list-boards and list-menu-optionsAnthony DiGirolamo
- was broken if library_* args are not set Change-Id: Iad987dbfe843195eef4996f075d7b2a051ee8787 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/24107 Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com> Pigweed-Auto-Submit: Anthony DiGirolamo <tonymd@google.com> Reviewed-by: Keir Mierle <keir@google.com>
2020-11-06pw_arduino_build: Arduino library searching supportAnthony DiGirolamo
- 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-05pw_arduino_build: Update Teensyduino coreAnthony DiGirolamo
- Update teensyduino core to 1.54b4. This allows compilation without a manual patch for c++17 support. - Cleanup download messages. Example: Downloading: https://downloads.arduino.cc/arduino-1.8.13-linux64.tar.xz Please wait... Downloaded: third_party/pigweed/third_party/arduino/cores/.cache/teensy/arduino-1.8.13-linux64.tar.xz Downloading: https://www.pjrc.com/teensy/td_154-beta4/TeensyduinoInstall.linux64 Please wait... Downloaded: third_party/pigweed/third_party/arduino/cores/.cache/teensy/TeensyduinoInstall.linux64 Extracting: third_party/pigweed/third_party/arduino/cores/.cache/teensy/arduino-1.8.13-linux64.tar.xz Installing into: third_party/pigweed/third_party/arduino/cores/teensy Change-Id: I925af1607700e9331d2756aabc116347d9f54516 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/23760 Reviewed-by: Keir Mierle <keir@google.com> Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
2020-11-03pw_arduino_build: Remove duplicate c-flags from asm/cppflagsAnthony DiGirolamo
Teensy cores have cflags included in the asmflag and cppflag recipes. This causes gn to effectively duplicate cflags when building asm and cpp files. This CL adds --s-only-flags and --cpp-only-flags options which remove cflags from each respectively. Add --ld-lib-names option. If --ld-libs returns: -larm_cortexM7lfsp_math -lm -lstdc++ Then --ld-lib-names returns: arm_cortexM7lfsp_math m stdc++ Add a --flash-only option to arduino_unit_test_runner. Change-Id: I1906d6f846f12ceb8ca42c498a7b216e0e3ba7e2 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/23086 Reviewed-by: Armando Montanez <amontanez@google.com> Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
2020-10-30Python: Update mypy and pylint versionsWyatt Hepler
Update mypy and pylint and fix several new warnings. Change-Id: I448eb306a1b7325ab6aae46f02622db781f8b6db Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22880 Commit-Queue: Wyatt Hepler <hepler@google.com> Reviewed-by: Rob Mohr <mohrr@google.com>
2020-10-27pw_arduino_build: Flashing fixes for Mac and WindowsAnthony DiGirolamo
- Unzip files preserving permissions - teensy_detector: If core not specified (when run manually) theck for teensy core in either third_party/arduino or third_party/pigweed/third_party/arduino - Use pathlib and absolute paths for running teensy flashing tools and the location to the binary. Relative paths on Mac did not work. - unit_test_runner: - Use pyserial.tools.list_ports to wait for a port to be ready - Remove the {serial.port} arduino recipe variable on Windows. Teensy detector reports an incorrect address and flashing seems to work without it. Filed TODOs to replace this exception when json teensy_ports parsing is working. Change-Id: Iead4a8db9048057608e3636e3f899e3e391dbd85 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22356 Commit-Queue: Anthony DiGirolamo <tonymd@google.com> Reviewed-by: Wyatt Hepler <hepler@google.com>
2020-10-22Python: Generate BUILD.gn files for Python packagesWyatt Hepler
- Generate BUILD.gn files with pw_python_packages using pw_build.generate_python_package_gn. - Add the new pw_python_package targets to the default build. - Remove the unncecessary "python_packages" group. - Fix some Windows path issues in Python tests. Change-Id: I50c9b1f650652554f0836cbdc1781a00ec7e8e56 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22203 Commit-Queue: Wyatt Hepler <hepler@google.com> Reviewed-by: Rob Mohr <mohrr@google.com>
2020-10-22Python: Add py.typed files per PEP 561Wyatt Hepler
- PEP 561 (https://www.python.org/dev/peps/pep-0561/) specifies that packages that wish to support type checking must provide a py.typed marker file. Add py.typed to all packages. - Add missing __init__.py files to pw_cli and pw_hdlc_lite. Change-Id: I32d652222e9909a5ac4a5612c2dd1683b18b2d36 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22200 Reviewed-by: Alexei Frolov <frolv@google.com> Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-10-22pw_build: pw_python_package and mypy fixesWyatt Hepler
- Use the target-relative path for pylint's stamp so it is unique when there are multiple files with the same basename (e.g. __init__.py). - Serialize pip install commands since in-parallel --editable installs do not work correctly. - Run mypy over the entire package directory rather than individual files. - Fix various mypy issues so that mypy passes without --ignore-missing-imports. Change-Id: I8129144d7c963616e5b836dd2f082c41f1dc1416 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22201 Reviewed-by: Alexei Frolov <frolv@google.com>
2020-10-21pw_build: Facade and configuration tweaks and docsWyatt Hepler
- Add documentation for facades and the pw_facade template. - Document the module config pattern. - Remove the need for the facade_name argument to pw_facade. Change-Id: I77529583967cfdb4f47ee87313982b1259ca036e Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22045 Reviewed-by: Alexei Frolov <frolv@google.com> Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-10-21pw_arduino_build: Fix Windows related issuesAnthony DiGirolamo
- 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-15BUILD.gn files: Improve import formattingWyatt Hepler
The "# gn-format disable" comments are no longer necessary. Delete these comments and reformat with a Vim macro and gn format. Change-Id: Ia62c40ad73eef91187d0d443d6e3b0fa723e5aa9 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21380 Reviewed-by: Armando Montanez <amontanez@google.com> Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-10-12Arduino: unit_test_runnerAnthony DiGirolamo
- 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-06Arduino: python cleanupAnthony DiGirolamo
- 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-01docs: Make labels consistent; remove boilerplateWyatt Hepler
- 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-09-25Arduino: main function wrapperAnthony DiGirolamo
- 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-21Arduino Pigweed TargetAnthony DiGirolamo
- 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>