- Can be compiled and unit tested on host without a board
- Run unit tests with
cargo test - Generate test coverage with
cargo llvm-cov --html - See docs: https://crates.io/crates/cargo-llvm-cov
- Run unit tests with
- Located under
demos/directory- Can be compiled and run on host
- Run
cargo run -- --helpfrom demos directory to get a list of arguments - The same demo modules are used in
featherdemos that useembedded-nal
- Located in the
feather/directory- Board notes:
- The Adafruit board has a factory-programmed SAMD bootloader.
- Erasing the bootloader is not required, as demos can be flashed either through the bootloader using
bossa/bossacor via a JTAG programmer (J-Link or equivalent). - JTAG connection instructions are in the bootloader updating guide.
- In case you want to erase the default bootloader, before or after erasing it, make sure the NVM control fuse for the bootloader (BOOTPROT) is set to
0x00; otherwise, the board’s flash will remain locked. See the instructions on the Adafruit blog.
- Development setup:
- Install the thumb target:
rustup target add thumbv6m-none-eabi - Install
probe-rs - Install
cargo-binutils - Install
BOSSA v1.9to flash the binary via the SAMD bootloader. - With JTAG/SWD
- Verify the JTAG connection with
probe-rs list. - Bootloader Erased: Run examples with:
cargo run --example blinky- To run the release version (faster download, smaller binary):
cargo run --release --example blinky
- Bootloader Not Erased: Run examples with the
bootloader-enabledfeature:cargo run --example blinky --features="bootloader-enabled"- To run the release version:
cargo run --release --example blinky --features="bootloader-enabled"
- The
cargo runcommand uses the configuration in.cargo/config.toml. - There is a hardcoded
probe-rs run --speed 1100in the config. - That speed may need tweaking, depending on your JTAG speed.
- It can also be set with the
PROBE_RS_SPEEDenvironment variable.
- Verify the JTAG connection with
- With Bossa/Bossac
- Build the example with the
bootloader-enabledfeature flag and generate its binary file. Both steps can be done using thecargo objcopycommand:- Debug version:
cargo objcopy --example blinky --features="bootloader-enabled" --no-default-features -- -O binary blinky.bin - Release version:
cargo objcopy --release --example blinky --features="bootloader-enabled" --no-default-features -- -O binary blinky.bin
- Debug version:
- Flashing:
- Enter bootloader mode.
- Use Bossac/Bossa to flash the binary:
bossac --port={port} -e -w -v -R --offset=0x2000 blinky.bin- Replace
{port}with the serial port your device is connected to. For example:- Linux:
/dev/ttyACM0 - Mac:
/dev/cu.usbmodem14301 - Windows:
COM32
- Linux:
- Replace
- For flashing the binary using
bossaversionsv1.7orv1.8, see the instructions on the Adafruit blog.
- For logging, see USB Serial Logging.
- Build the example with the
- Configure defmt logging with DEFMT_LOG environment variable
- Bash:
export DEFMT_LOG=debug - PowerShell:
$env:DEFMT_LOG="debug"
- Bash:
- Install the thumb target:
- Most examples use environment variables to set up test parameters. Set them
before building and running, these get compiled into the binary
- To connect the module to access point:
export TEST_SSID=mywifiexport TEST_PASSWORD=mywifipassword- Look for
option_env!in test code to see what other parameters to change
- Build all examples with
cargo build --examples --all-features - Complex demos that require more dependencies are feature gated
- Optional features:
iperf3,telnet,oled, andasync
- Board notes:
- USB serial and log output can be enabled with
logandusbfeatures - This enables Arduino-style development without requiring JTAG/probe-rs
- The default logging output is sent to
defmt, and it's mutually exclusive withlog - Features:
usb: Enables USB CDC serial device functionalitylog: Enables log crate integration with USB output
- To run an example with USB output:
cargo run --no-default-features --features="usb,log" --example http_speed_test - Connect to USB serial port (usually
/dev/ttyACM0on Linux,COMxon Windows) - Use any serial terminal:
screen /dev/ttyACM0, Arduino IDE Serial Monitor, etc.
- USB logging level is controlled by
FEATHER_USB_LOGenvironment variable (compile-time) - Supports standard logging levels:
error,warn,info(default),debug,trace - Example:
FEATHER_USB_LOG=warn cargo run --no-default-features --features="usb,log" --example myapp
- defmt (default): Uses JTAG/RTT for logging, requires probe-rs
- USB serial logging: Uses USB serial, slower but works without JTAG hardware
- Uses
pre-commit- Install on your system
- Run
pre-commit installin your local checkout - Automatically runs formatting and tests on staged files
- Same checks run on pull requests
Common variables used in examples (set before building):
TEST_SSID=mywifi- WiFi network nameTEST_PASSWORD=mywifipassword- WiFi password
DEFMT_LOG=debug- defmt logging level (trace/debug/info/warn/error)FEATHER_USB_LOG=info- USB serial logging level (trace/debug/info/warn/error)
TEST_IP=192.168.1.1- Target IP for ping/connection testsTEST_PORT=8080- Target port for TCP/UDP testsTEST_HOST=httpbin.org- Target hostname for HTTP/DNS testsTEST_TTL=200- Ping TTL valueTEST_COUNT=4- Number of ping attempts
TEST_AP_SSID=provision_ssid- Access point SSID for provisioningTEST_AP_PASSWORD=provision_pass- Access point password for provisioningTEST_AP_DNS=provision.local- DNS hostname for provisioningTEST_FILE=/test-file-1mb.json- HTTP download test file pathTEST_IPERF_IP=192.168.1.100- iPerf3 server IPTEST_IPERF_PORT=5201- iPerf3 server portTEST_IPERF_UDP=false- Use UDP for iPerf3 (true/false)NUM_BYTES=1048576- Number of bytes for iPerf3 testBLOCK_LEN=1024- Block size for iPerf3 testLOOP_FOREVER=false- Run server examples indefinitely (true/false)
PROBE_RS_SPEED=1100- JTAG probe speed
See option_env! calls in example source code for complete parameter lists.