This repository implements an entirely manually-written, pure bare metal Blinky Project for the NXP ARM Cortex-M7 iMXRT1062 (on the Teensy 4.0 board).
Features include:
- boot through the board's standard bootloader,
- PLL frequency increased to 600 MHz,
- timebase derived from
SysTick
, - blinky LED show with adjustable frequency,
- implementation in C++20/C11 (and beyond) with absolute minimal use of assembly.
A clear and easy-to-understand build system based on GNUmake completes this fun and educational project.
This repository provides keen insight on starting up a bare metal Teensy board.
The application boots from the board's standard bootloader. Necessary inputs/user-adaptions for this boot are provided in the file bootdata.c.
Following the bootloader's low-level chip initialization,
the program jumps to our own self-written startup stub
called __my_startup()
in crt0.cpp.
After a few more initializations in __my_startup()
, control is transfered to
main()
.
Here the simple LED blinky show is executed.
The adjustable LED-phase (its half-period) can be tuned
to provide a rudimentary, visible blinky LED show.
The timebase for blinky is based on the standard SysTick
interrupt handler.
The home directory of the build system (whether on Win*
of *nix*
)
is located in the directory Build/VS
.
Several paths used in the build(s) are defined relative to this
home directory.
Build on *nix*
is easy using an installed gcc-arm-none-eabi
cd teensy-4_nxp_iMXRT1062/Build/VS
../build.sh all
If gcc-arm-none-eabi
is not present, then it can be installed (if needed).
sudo apt install gcc-arm-none-eabi
Important: When building with MSVC, it is necessary to
first unpack the gcc-arm-none-eabi toolchain. This is done by
going to Build/tools/gcc
in Windows-Explorer
and simply double-clicking on the self-extracting archive
file gcc-11.2.0-arm-none-eabi.exe
. Answer yes to
the query in the pop-up window launched from the extractor.
We will now build the target
configuration in MSVC.
(This is the configuration that runs on the Teensy board.)
Navigate to the directory Build/VS
.
Find there the MSVC solution file teensy-4_nxp_iMXRT1062.sln
and open it. Select the solution configuration target
and rebuild the solution.
The build results including ELF-file, HEX-mask, symbol-file
and assembly list file are created in the output directory
Build\Bin\target_x64
.
There are additional host configurations available.
Simulated Windows (host) project configurations
Debug
and Release
can be used for trouble-shooting the code if
needed. These run on the host system with simulated LED blinky show.
CI runs on pushes and pull-requests with simple
build(s) including result verification on both
windows-latest
as well as ubuntu-latest
using GitHub Actions.
The Teensy 4.0 is used with no modifications whatsoever straight out-of-the-box. The hardware setup in action is pictured in the image below.
This software project is licensed under BSL 1.0.