aboutsummaryrefslogtreecommitdiff
path: root/targets/arduino/target_docs.rst
diff options
context:
space:
mode:
Diffstat (limited to 'targets/arduino/target_docs.rst')
-rw-r--r--targets/arduino/target_docs.rst149
1 files changed, 75 insertions, 74 deletions
diff --git a/targets/arduino/target_docs.rst b/targets/arduino/target_docs.rst
index 379da1b5a..1735e6789 100644
--- a/targets/arduino/target_docs.rst
+++ b/targets/arduino/target_docs.rst
@@ -51,100 +51,101 @@ Installing Arduino Cores
The ``arduino_builder`` utility can install Arduino cores automatically. It's
recommended to install them to into ``third_party/arduino/cores/``.
-.. code:: sh
+.. code-block:: sh
- # Setup pigweed environment.
- source activate.sh
- # Install an arduino core
- arduino_builder install-core --prefix ./third_party/arduino/cores/ --core-name teensy
+ # Setup pigweed environment.
+ . ./activate.sh
+ # Install an arduino core, only teensy is supported
+ pw package install teensy
Building
========
To build for this Pigweed target, simply build the top-level "arduino" Ninja
target. You can set Arduino build options using ``gn args out`` or by running:
-.. code:: sh
+.. code-block:: sh
- gn gen out --args='
- pw_arduino_build_CORE_PATH="//third_party/arduino/cores"
- pw_arduino_build_CORE_NAME="teensy"
- pw_arduino_build_PACKAGE_NAME="teensy/avr"
- pw_arduino_build_BOARD="teensy40"
- pw_arduino_build_MENU_OPTIONS=["menu.usb.serial", "menu.keys.en-us"]'
+ gn gen out --args='
+ pw_arduino_build_CORE_PATH = "//environment/packages"
+ pw_arduino_build_CORE_NAME = "teensy"
+ pw_arduino_build_PACKAGE_NAME = "avr/1.58.1"
+ pw_arduino_build_BOARD = "teensy40"
+ pw_arduino_build_MENU_OPTIONS=["menu.usb.serial", "menu.keys.en-us"]'
On a Windows machine it's easier to run:
-.. code:: sh
+.. code-block:: sh
- gn args out
+ gn args out
That will open a text file where you can paste the args in:
-.. code:: text
+.. code-block:: text
- pw_arduino_build_CORE_PATH = "//third_party/arduino/cores"
- pw_arduino_build_CORE_NAME = "teensy"
- pw_arduino_build_PACKAGE_NAME="teensy/avr"
- pw_arduino_build_BOARD = "teensy40"
- pw_arduino_build_MENU_OPTIONS = ["menu.usb.serial", "menu.keys.en-us"]
+ pw_arduino_build_CORE_PATH = "//environment/packages"
+ pw_arduino_build_CORE_NAME = "teensy"
+ pw_arduino_build_PACKAGE_NAME = "avr/1.58.1"
+ pw_arduino_build_BOARD = "teensy40"
+ pw_arduino_build_MENU_OPTIONS = ["menu.usb.serial", "menu.keys.en-us"]
Save the file and close the text editor.
Then build with:
-.. code:: sh
+.. code-block:: sh
ninja -C out arduino
To see supported boards and Arduino menu options for a given core:
-.. code:: sh
+.. code-block:: sh
- arduino_builder --arduino-package-path ./third_party/arduino/cores/teensy \
- --arduino-package-name teensy/avr \
- list-boards
+ arduino_builder --arduino-package-path ./environment/packages/teensy \
+ --arduino-package-name avr/1.58.1 \
+ list-boards
-.. code:: text
+.. code-block:: text
- Board Name Description
- teensy41 Teensy 4.1
- teensy40 Teensy 4.0
- teensy36 Teensy 3.6
- teensy35 Teensy 3.5
- teensy31 Teensy 3.2 / 3.1
+ Board Name Description
+ teensy41 Teensy 4.1
+ teensy40 Teensy 4.0
+ teensy36 Teensy 3.6
+ teensy35 Teensy 3.5
+ teensy31 Teensy 3.2 / 3.1
You may wish to set different arduino build options in
``pw_arduino_build_MENU_OPTIONS``. Run this to see what's available for your core:
-.. code:: sh
+.. code-block:: sh
- arduino_builder --arduino-package-path ./third_party/arduino/cores/teensy \
- --arduino-package-name teensy/avr \
- list-menu-options --board teensy40
+ arduino_builder --arduino-package-path ./environment/packages/teensy \
+ --arduino-package-name avr/1.58.1 \
+ list-menu-options \
+ --board teensy40
That will show all menu options that can be added to ``gn args out``.
-.. code:: text
-
- All Options
- ----------------------------------------------------------------
- menu.usb.serial Serial
- menu.usb.serial2 Dual Serial
- menu.usb.serial3 Triple Serial
- menu.usb.keyboard Keyboard
- menu.usb.touch Keyboard + Touch Screen
- menu.usb.hidtouch Keyboard + Mouse + Touch Screen
- menu.usb.hid Keyboard + Mouse + Joystick
- menu.usb.serialhid Serial + Keyboard + Mouse + Joystick
- menu.usb.midi MIDI
- ...
-
- Default Options
- --------------------------------------
- menu.usb.serial Serial
- menu.speed.600 600 MHz
- menu.opt.o2std Faster
- menu.keys.en-us US English
+.. code-block:: text
+
+ All Options
+ ----------------------------------------------------------------
+ menu.usb.serial Serial
+ menu.usb.serial2 Dual Serial
+ menu.usb.serial3 Triple Serial
+ menu.usb.keyboard Keyboard
+ menu.usb.touch Keyboard + Touch Screen
+ menu.usb.hidtouch Keyboard + Mouse + Touch Screen
+ menu.usb.hid Keyboard + Mouse + Joystick
+ menu.usb.serialhid Serial + Keyboard + Mouse + Joystick
+ menu.usb.midi MIDI
+ ...
+
+ Default Options
+ --------------------------------------
+ menu.usb.serial Serial
+ menu.speed.600 600 MHz
+ menu.opt.o2std Faster
+ menu.keys.en-us US English
Testing
=======
@@ -159,23 +160,23 @@ If using ``out`` as a build directory, tests will be located in
Tests can be flashed and run using the `arduino_unit_test_runner` tool. Here is
a sample bash script to run all tests on a Linux machine.
-.. code:: sh
+.. code-block:: sh
- #!/bin/bash
- gn gen out --export-compile-commands \
- --args='pw_arduino_build_CORE_PATH="//third_party/arduino/cores"
- pw_arduino_build_CORE_NAME="teensy"
- pw_arduino_build_PACKAGE_NAME="teensy/avr"
- pw_arduino_build_BOARD="teensy40"
- pw_arduino_build_MENU_OPTIONS=["menu.usb.serial", "menu.keys.en-us"]' && \
- ninja -C out arduino
+ #!/bin/bash
+ gn gen out --export-compile-commands \
+ --args='pw_arduino_build_CORE_PATH="environment/packages"
+ pw_arduino_build_CORE_NAME="teensy"
+ pw_arduino_build_PACKAGE_NAME="avr/1.58.1"
+ pw_arduino_build_BOARD="teensy40"
+ pw_arduino_build_MENU_OPTIONS=["menu.usb.serial", "menu.keys.en-us"]' && \
+ ninja -C out arduino
- for f in $(find out/arduino_debug/obj/ -iname "*.elf"); do
- arduino_unit_test_runner --verbose \
- --config-file ./out/arduino_debug/gen/arduino_builder_config.json \
- --upload-tool teensyloader \
- out/arduino_debug/obj/pw_string/test/format_test.elf
- done
+ for f in $(find out/arduino_debug/obj/ -iname "*.elf"); do
+ arduino_unit_test_runner --verbose \
+ --config-file ./out/arduino_debug/gen/arduino_builder_config.json \
+ --upload-tool teensyloader \
+ $f
+ done
Using the test server
---------------------
@@ -184,7 +185,7 @@ Tests may also be run using the `pw_arduino_use_test_server = true` GN arg.
The server must be run with an `arduino_builder` config file so it can locate
the correct Arduino core, compiler path, and Arduino board used.
-.. code:: sh
+.. code-block:: sh
arduino_test_server --verbose \
--config-file ./out/arduino_debug/gen/arduino_builder_config.json
@@ -209,7 +210,7 @@ GN Target Example
Here is an example `pw_executable` gn rule that includes some Teensyduino
libraries.
-.. code:: text
+.. code-block:: text
import("//build_overrides/pigweed.gni")
import("$dir_pw_arduino_build/arduino.gni")