Thanks for contributing! Please open an issue when
- you find a bug in the crate
- you have an idea for a feature
- something isn't clear in our documentation
The rest of this guide provides quick tips for working with these packages.
Before you get started, make sure that you have all the build dependencies.
We need whatever is required for the imxrt-ral
package. See the imxrt-ral
contributing documentation for more information.
If you'd like to work with this code, read on for development requirements and tips.
To build the package, just use cargo build
. You should be able to just
cargo build
in one of the example packages. Note that this library can
build for your host system, and also for your embedded ARM target. To build for
an embedded target, include a --target
flag, like
cargo build --target thumbv7em-none-eabihf
To run unit tests, change cargo build
to cargo test
in the above
examples. These tests run on your host system.
To debug the library, enable the internal __log
feature. The feature
enables the library's internal log
hooks.
Then, initialize your logger of choice in your program. See the Teensy 4
examples to see how you might use a UART logger to debug your program. You may
also need to configure the maximum log level as a feature on the log
crate.
To test on hardware, either
- use an existing example package, or
- contribute a new example package for your system
To test usb-device
compatibility, use the usb-device
test class
program in each example.
-
Build and flash the
test_class
example onto your hardware. See your example's documentation for build and flash instructions. Keep your board connected to your host. -
Clone and enter the
usb-device
repositorygit clone https://github.com/mvirkkunen/usb-device.git && cd usb-device
-
Run
cargo test --features=test-class-high-speed
in theusb-device
directory.
By default, examples build a high-speed USB device. To force a low / full speed
device, disable the example's default features. If you're testing a low / full
speed device with the test_class
, remove the --features=test-class-high-speed
in step 3, above, so that the test evaluates a low / full speed test class.
For design information, see the API docs. Most modules include a high-level blurb that talks about what's going on. There are also public-facing design documentation in some modules.
If you'd like references, see
- this application note. Although the AN is for a different NXP processor, the USB driver design is the same.
- the i.MX RT reference manuals, available from NXP. Go here, and select your processor. Then, go to "Documentation," and scroll down to "Reference Manual." You'll need a free NXP account to access the reference manuals.