TinyUSB#

Pigweed AI summary: The TinyUSB module in the Pigweed build contains the necessary build files to integrate TinyUSB. The GN Build Support module provides support to compile TinyUSB with GN, but does not include the source code of the TinyUSB project. To use this, certain variables need to be configured from the TinyUSB.gni file. Multiple pw_source_set entries for different parts of the TinyUSB library are created after configuration. TinyUSB library is split into a device side and host side, with a few common sources

The $dir_pw_third_party/tinyusb/ module contains the build files needed to integrate TinyUSB into a Pigweed build.

GN Build Support#

Pigweed AI summary: The GN Build Support module provides support for compiling TinyUSB with GN, but does not include the source code of the TinyUSB project. To use this module, certain variables must be configured from the tinyusb.gni file. These variables include setting the GN pw_third_party_tinyusb_SOURCE to the path of the TinyUSB source code directory, setting pw_third_party_tinyusb_CONFIG to a pw_source_set which provides the TinyUSB tusb_config.h config header, and setting pw_third_party_t

This module provides support to compile TinyUSB with GN, however it doesn’t include the source code of the tinyusb project.

In order to use this you are expected to configure the following variables from $dir_pw_third_party/tinyusb:tinyusb.gni:

  1. Set the GN pw_third_party_tinyusb_SOURCE to the path of the TinyUSB source code directory. This is the directory that contains the src/ sub-directory.

  2. Set pw_third_party_tinyusb_CONFIG to a pw_source_set which provides the TinyUSB tusb_config.h config header. While it is possible to provide public definitions in this pw_source_set the configuration header file is still required by TinyUSB.

  3. Set pw_third_party_tinyusb_PORT to a pw_source_set which provides the TinyUSB port sources for the specific MCU. Several MCUs are supported by the upstream TinyUSB project, check the src/portable/ path for your MCU.

After this is done multiple pw_source_set entries for the different parts of TinyUSB library are created at $dir_pw_third_party/tinyusb.

Adding TinyUSB dependency#

Pigweed AI summary: The TinyUSB library has a device side and a host side, with some shared sources. It is possible to depend on both at compile time but only initialize one side. The device and host both offer classes such as CDC or MSC, which can be included in the build by depending on the respective GN targets.

TinyUSB library is split into a device side and host side, with a few common sources between the two. It is possible to depend on both at compile time, but initialize only one side. Device and host both provide classes on top such as Communications Device Class (CDC) or Mass Storage Class (MSC) which can be selectively included in the build by depending on the respective GN targets.