1.. _module-pw_third_party_tinyusb: 2 3======= 4TinyUSB 5======= 6 7The ``$dir_pw_third_party/tinyusb/`` module contains the build files needed to 8integrate TinyUSB into a Pigweed build. 9 10---------------- 11GN Build Support 12---------------- 13This module provides support to compile TinyUSB with GN, however it doesn't 14include the source code of the `tinyusb <https://github.com/hathach/tinyusb>`_ 15project. 16 17In order to use this you are expected to configure the following variables from 18``$dir_pw_third_party/tinyusb:tinyusb.gni``: 19 20#. Set the GN ``pw_third_party_tinyusb_SOURCE`` to the path of the TinyUSB 21 source code directory. This is the directory that contains the ``src/`` 22 sub-directory. 23#. Set ``pw_third_party_tinyusb_CONFIG`` to a ``pw_source_set`` which provides 24 the TinyUSB ``tusb_config.h`` config header. While it is possible to provide 25 public definitions in this ``pw_source_set`` the configuration header file is 26 still required by TinyUSB. 27#. Set ``pw_third_party_tinyusb_PORT`` to a ``pw_source_set`` which provides 28 the TinyUSB port sources for the specific MCU. Several MCUs are supported by 29 the upstream TinyUSB project, check the ``src/portable/`` path for your MCU. 30 31After this is done multiple ``pw_source_set`` entries for the different parts of 32TinyUSB library are created at ``$dir_pw_third_party/tinyusb``. 33 34.. _third_party-tinyusb_classes: 35 36Adding TinyUSB dependency 37========================= 38TinyUSB library is split into a device side and host side, with a few common 39sources between the two. It is possible to depend on both at compile time, but 40initialize only one side. Device and host both provide classes on top such as 41Communications Device Class (CDC) or Mass Storage Class (MSC) which can be 42selectively included in the build by depending on the respective GN targets. 43