Crate teensy4_bsp[][src]

Expand description

A Rust board support package (BSP) for the Teensy 4. Supports the Teensy 4.0 and 4.1 boards.

Peripherals are re-exported from the imxrt-hal hardware abstraction layer. See the HAL’s documentation for more information on creating and using peripherals.

Runtime

The teensy4-bsp use the cortex-m-rt crate to provide a runtime. Enable runtime support using the "rt" feature. To properly link your program, you must link with the t4link.x linker script.

The teensy4-bsp emits a cortex-m-rt-compatible linker script. The layout supports the i.MX RT’s boot requirements and advanced memory features. Specifically, the layout includes the image vector table (IVT) and boot data that’s necessary for i.MX RT processors. Additionally, the layout specifies the FlexSPI configuration block’s (FCB) FLASH location. Finally, the linker script places all instructions in ITCM, and all data in DTCM.

The teensy4-bsp provides its own reset hander. The custom reset handler

  • initalizes TCM regions
  • copies instructions into ITCM
  • copies the vector table into DTCM, and sets VTOR
  • set’s the CCM’s low-power setting

The reset handler then calls the cortex-m-rt entrypoint to finish memory initialization and invoke your program’s main().

Features

The teensy4-bsp supports these features:

FlagDescriptionDefault?
"usb-logging"Adds support for logging over USB with the log crate
"rt"Adds runtime support using cortex-m-rt
"rtic"Adds support for using the BSP peripherals with RTIC

Proper RTIC support requires that you disable the BSP’s default features. You may combine "rtic" with either "rt" and "usb-logging".

[dependencies.teensy4-bsp]
default-features = false
features = ["rtic",  "rt"]
version = # ...

Pins

The BSP helps you convert all the i.MX RT processor pads into your Teensy 4’s pins. From these pins, you may construct peripherals and perform I/O. See the pins module for more information.

Examples

Turn on a Teensy 4.0’s LED:

use cortex_m::asm::wfi;
use teensy4_bsp as bsp;

use embedded_hal::digital::v2::OutputPin;

let peripherals = bsp::Peripherals::take().unwrap();
let pins = bsp::pins::t40::from_pads(peripherals.iomuxc);
let mut led = bsp::configure_led(pins.p13);

loop {
    led.set_high().unwrap();
    wfi();
}

See more examples in the project’s repository.

Re-exports

pub use teensy4_pins as pins;
pub use imxrt_hal as hal;

Modules

usbusb-logging

Teensy 4 USB, taken from the original Teensy 4 C libraries

Structs

Enums

Available interrupts for this device

Constants

SYSTICK external clock frequency.

Functions

Configure the board’s LED

Returns the starting location for a DTCM “heap.”

Returns the size of the heap, in bytes.

Returns a pointer to the start of the heap

Type Definitions

The LED