Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2200: Add Teensy 4 board r=bradjc a=mciantyre ### Pull Request Overview The PR proposes Tock support for the Teensy 4. As of this PR, the Tock kernel, and a variety of small examples, can run on [Teensy 4.0][teensy40] and [Teensy 4.1][teensy41] development boards. The PR builds on the i.MX RT chip foundation added in #1918. [teensy40]: https://www.pjrc.com/store/teensy40.html [teensy41]: https://www.pjrc.com/store/teensy41.html The board makes use of - the LED on pin 13 - UART2 on pins 14 and 15 - GPT1 as an alarm The Teensy 4 boards use i.MX RT **1062** chips. Given our current chip features, the 1060 chip family is identical to the 1050 chip family. Before integrating the Teensy 4 board, I *renamed `chips/imxrt1050` to `chips/imxrt10xx`*. I updated the `imxrt1050-evkb` board to use the renamed crate. Additional changes to the i.MX RT chip crate include - adding a LPUART2 peripheral - renaming the `gpt1` module to `gpt`, and adding `GPT2` - supporting periodic clock selection, allowing a user to select the static crystal oscillator as the GPT clock source Changes to the chip crate should be backwards compatible for `imxrt1050-evkb` users. Let me know if we see an issue. ### Testing Strategy I tested the PR by running `blink` and `console` libtock-c examples on both a Teensy 4.0 and 4.1 board. I repackaged the examples [here](https://github.com/mciantyre/tock-teensy4-apps). The PR was **not** tested on an NXP i.MX RT 1050 evaluation board; I don't have that hardware. ### TODO or Help Wanted This pull request may be tested on a 1050 evaluation board. @valexandru, if you have an opportunity to test this work and review these changes, I'd appreciate it! This PR does not address any of the TODOs noted in #1918. In particular, the `imxrt10xx` chip still does not use the new peripheral instantiation approach (#2069). If this is still TODO and not urgent, I'm happy to support that cleanup in a separate PR. This Teensy 4 support was based on a different chip implementation. That chip implementation supported DMA, and a UART driver that used DMA. If we see value in a DMA driver for i.MX RT chips, I'm happy to contribute the driver. ### Documentation Updated - [x] ~~Updated the relevant files in `/docs`~~, or **no updates are required** I've added documentation in `boards/teensy4`. The documentation - lists the tools that you need to program a Teensy 4 - how to build the kernel and apps - how to convert the program to a HEX file, which is necessary to program a board ### Formatting - [x] Ran `make prepush`. ### New Platform Checklist - [x] Hardware is widely available. - [x] I can support the platform, which includes release testing for the platform, at least initially. - Basic features are implemented: - [x] `Console`, including `debug!()` and userspace `printf()`. - [x] Timers. - [x] GPIO with interrupts. I assume the basic chip features were provided by #1918. Let me know if we need to make all three features available through the board. As of this writing, the Teensy 4 board does not expose an input GPIO that responds to an interrupt. 2216: add 15.4 and ble to nano33ble r=bradjc a=hudson-ayers ### Pull Request Overview This pull request adds the 15.4 and BLE drivers to the nano33ble, rather than leaving support as commented out, as the comments had already fallen out-of-date. ### Testing Strategy BLE was tested using the `ble_advertising` and `ble_passive_scanning` apps in `libtock-c`. 15.4 was tested using the `radio_tx` and `radio_rx` apps in `libtock-c` and sending messages back and forth with an nrf52840-dk. ### TODO or Help Wanted N/A ### Documentation Updated - [x] No updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Ian McIntyre <ianpmcintyre@gmail.com> Co-authored-by: Hudson Ayers <hayers@stanford.edu> Co-authored-by: Hudson Ayers <32688905+hudson-ayers@users.noreply.github.com>
- Loading branch information
Showing
29 changed files
with
1,360 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "teensy40" | ||
version = "0.1.0" | ||
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"] | ||
build = "build.rs" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
components = { path = "../components" } | ||
cortexm7 = { path = "../../arch/cortex-m7" } | ||
capsules = { path = "../../capsules" } | ||
kernel = { path = "../../kernel" } | ||
imxrt10xx = { path = "../../chips/imxrt10xx" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Makefile for building the tock kernel for the Teensy 4 | ||
|
||
TARGET=thumbv7em-none-eabi | ||
PLATFORM=teensy40 | ||
|
||
include ../Makefile.common | ||
|
||
%.hex: %.elf | ||
$(Q)$(OBJCOPY) -O ihex $< $@ | ||
|
||
kernel: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).elf | ||
|
||
.PHONY: program | ||
program: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).hex | ||
$(Q)teensy_loader_cli --mcu=TEENSY40 -w -v $< | ||
|
||
# Unsupported; there's no easily-accessible JTAG interface | ||
.PHONY: flash | ||
flash: | ||
echo "Use 'make program' to program the Teensy 4" | ||
exit 1 | ||
|
||
# For testing with a blinky LED | ||
BLINK=../../../libtock-c/examples/blink/build/cortex-m7/cortex-m7.tbf | ||
app.elf: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).elf | ||
$(Q)arm-none-eabi-objcopy --update-section .apps=$(BLINK) $< $@ | ||
|
||
app: app.elf | ||
$(Q)$(OBJCOPY) -O ihex $< $@ | ||
teensy_loader_cli --mcu=TEENSY40 -w -v $@ | ||
$(Q)rm $@ $< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
Teensy 4.0 Development Board | ||
============================ | ||
|
||
The `teensy40` board supports the Teensy **4.0** development board. | ||
For more information, visit the | ||
[Teensy 4.0 Development Board](https://www.pjrc.com/store/teensy40.html) | ||
product page. | ||
|
||
The board may suffice for the [Teensy **4.1** development board](t41), which | ||
shares common pins and a larger amount of flash memory. However, the board | ||
will not contain features that are only available on the Teensy 4.1 development | ||
board, such as extended flash memory and RAM, an on-board SD card, or ethernet. | ||
|
||
[t41]: https://www.pjrc.com/store/teensy41.html | ||
|
||
Programming Dependencies | ||
------------------------ | ||
|
||
Before attempting to program your Teensy 4.0 with Tock and Tock apps, make sure | ||
that you have either | ||
|
||
- a build of [`teensy_loader_cli`](https://github.com/PaulStoffregen/teensy_loader_cli), or | ||
- the [Teensy Loader Application](https://www.pjrc.com/teensy/loader.html) | ||
|
||
If you're already familiar with programming the Teensy with Arduino tools, | ||
the Teensy Loader Application is already bundled with the Teensyduino add-ons | ||
that you may already be using. | ||
|
||
Programming | ||
----------- | ||
|
||
From this directory, build the Tock kernel for the Teensy 4: | ||
|
||
```bash | ||
$ make | ||
``` | ||
|
||
Build Tock apps out of tree. Once you've built an app, use | ||
`arm-none-eabi-objcopy` with `--update-section` to create an ELF image that | ||
includes your app(s). The example below combines a prebuilt `blink` example | ||
with the Teensy 4 Tock kernel. | ||
|
||
```bash | ||
$ arm-none-eabi-objcopy \ | ||
--update-section .apps=../../../libtock-c/examples/blink/build/cortex-m7/cortex-m7.tbf \ | ||
../../target/thumbv7em-none-eabi/release/teensy40.elf \ | ||
../../target/thumbv7em-none-eabi/release/teensy40-app.elf | ||
``` | ||
|
||
Once you've created a single ELF image, use `arm-none-eabi-objcopy` to turn | ||
that into HEX: | ||
|
||
```bash | ||
$ arm-none-eabi-objcopy -O ihex \ | ||
../../target/thumbv7em-none-eabi/release/teensy40-app.elf \ | ||
../../target/thumbv7em-none-eabi/release/teensy40-app.hex | ||
``` | ||
|
||
Finally, use a Teensy programmer to flash `teensy40-app.hex` to your board! | ||
|
||
```bash | ||
$ teensy_loader_cli -w -v --mcu=TEENSY40 target/thumbv7em-none-eabi/release/teensy40-app.hex | ||
``` | ||
|
||
Use the example `Makefile` below to create a build and flash workflow: | ||
|
||
```Makefile | ||
APP=../../../libtock-c/examples/blink/build/cortex-m7/cortex-m7.tbf | ||
KERNEL=$(TOCK_ROOT_DIRECTORY)/target/teensy40/release/teensy40.elf | ||
KERNEL_WITH_APP=$(TOCK_ROOT_DIRECTORY)/target/teensy40/release/teensy40-app.elf | ||
KERNEL_WITH_APP_HEX=$(TOCK_ROOT_DIRECTORY)/target/teensy40/release/teensy40-app.hex | ||
|
||
.PHONY: program | ||
program: target/thumbv7em-none-eabi/release/teensy40.elf | ||
arm-none-eabi-objcopy --update-section .apps=$(APP) $(KERNEL) $(KERNEL_WITH_APP) | ||
arm-none-eabi-objcopy -O ihex $(KENERL_WITH_APP) $(KERNEL_WITH_APP_HEX) | ||
teensy_loader_cli -w -v --mcu=TEENSY40 $(KERNEL_WITH_APP_HEX) | ||
``` | ||
|
||
For another example, see [`Makefile`](./Makefile). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fn main() { | ||
println!("cargo:rerun-if-changed=layout.ld"); | ||
println!("cargo:rerun-if-changed=../kernel_layout.ld"); | ||
} |
Oops, something went wrong.