2015-06-09 15:03:25 +02:00
|
|
|
README
|
|
|
|
======
|
|
|
|
|
|
|
|
This is a README file for the port of NuttX to the Teensy-3.1 from PJRC
|
|
|
|
(https://www.pjrc.com/). The Teensy-3.1 features the Freescale
|
2015-06-11 17:07:35 +02:00
|
|
|
MK20DX256VLH7 chip (now NXP). The MK20DX256VLH7 is a 64-pin Cortex-M4
|
2015-06-09 15:03:25 +02:00
|
|
|
running at 72MHz. It has 256KiB of program FLASH memory and 64KiB of
|
|
|
|
SRAM. For more information about the Teensy 3.1, see
|
2015-06-09 23:54:04 +02:00
|
|
|
|
2015-06-09 15:03:25 +02:00
|
|
|
https://www.pjrc.com/teensy/teensy31.html
|
|
|
|
https://www.pjrc.com/store/teensy31.html
|
|
|
|
|
2015-06-09 23:54:04 +02:00
|
|
|
This board configuration can also be used with the older Teensy-3.0. The
|
|
|
|
Teensy-3.0 has the same schematic (although some pins are not used on the
|
2015-06-10 02:01:32 +02:00
|
|
|
Teensy-3.0). The primary difference is that the Teensy 3.0 has a
|
2015-06-10 19:45:53 +02:00
|
|
|
MK20DX128VLH5 with slightly less capability. There are many difference
|
2015-06-11 17:07:35 +02:00
|
|
|
between the MK20DX256VLH7 and the MK20DX128VLH5 but the basic differences
|
2015-06-10 02:01:32 +02:00
|
|
|
that effect how you configure NuttX are:
|
|
|
|
|
|
|
|
--------------- -------------- -------------- ---------------------------
|
|
|
|
Feature Teensy 3.0 Teensy 3.1 CONFIGURATION
|
|
|
|
--------------- -------------- -------------- ---------------------------
|
|
|
|
Processor
|
2015-06-10 19:45:53 +02:00
|
|
|
Core MK20DX128VLH5 MK20DX256VLH7 CONFIG_ARCH_CHIP_MK20DX128VLH5
|
2015-06-10 02:01:32 +02:00
|
|
|
Rated Speed 48 MHz 72 MHz Settings in include/board.h
|
2015-06-10 19:45:53 +02:00
|
|
|
Overclockable 96 MHz 96 MHz CONFIG_TEENSY_3X_OVERCLOCK
|
2015-06-10 02:01:32 +02:00
|
|
|
Flash Memory 128 KB 256 KB See scripts/flash.ld
|
|
|
|
SRAM 16 KB 64 KB See scripts/flash.ld and
|
|
|
|
set CONFIG_RAM_SIZE=???
|
|
|
|
--------------- -------------- -------------- ---------------------------
|
2015-06-09 23:54:04 +02:00
|
|
|
|
2015-06-10 23:19:29 +02:00
|
|
|
The initial Teensy-3.1 port is largely the effort of Jakob Odersky.
|
|
|
|
https://github.com/jodersky/nuttx/tree/teensy31-7.6
|
|
|
|
|
2015-06-09 15:03:25 +02:00
|
|
|
Contents
|
|
|
|
========
|
|
|
|
|
|
|
|
o STATUS
|
|
|
|
o Pin Configuration
|
|
|
|
o Serial Console
|
|
|
|
o LEDs
|
|
|
|
o Using the Halfkey Loader
|
2015-06-11 17:07:35 +02:00
|
|
|
o Debugging
|
2015-06-09 15:03:25 +02:00
|
|
|
o Teensy-3.1 Configuration settings
|
|
|
|
o Configurations
|
|
|
|
|
|
|
|
STATUS
|
|
|
|
======
|
|
|
|
|
2015-06-11 17:07:35 +02:00
|
|
|
2005-06-11:
|
|
|
|
After some extended tinkering with the PLL setup, the Teensy-3.1 is
|
|
|
|
fully functional using the basic NSH configuration.
|
2015-06-09 15:03:25 +02:00
|
|
|
|
|
|
|
Pin Configuration
|
|
|
|
=================
|
|
|
|
|
|
|
|
Nearly all pins are available to the user. The few port pins used on
|
|
|
|
board are listed below:
|
|
|
|
|
|
|
|
----- --------------------------------------
|
|
|
|
P0RT BOARD USAGE
|
|
|
|
----- --------------------------------------
|
|
|
|
PTA0 MINI54TAN / Bootloader
|
|
|
|
PTA1 MINI54TAN / Bootloader
|
|
|
|
PTA2 MINI54TAN / Bootloader
|
|
|
|
PTA3 MINI54TAN / Bootloader
|
|
|
|
PTA18 16MHz XTAL (XTAL32 is not populated).
|
|
|
|
PTA19 16MHz XTAL
|
|
|
|
PTB1 MINI54TAN / Bootloader
|
|
|
|
PTB2 MINI54TAN / Bootloader
|
|
|
|
PTC5 LED
|
|
|
|
----- --------------------------------------
|
|
|
|
|
|
|
|
Serial Console
|
|
|
|
==============
|
|
|
|
|
|
|
|
The K20 has three UARTs with pin availability as follows:
|
|
|
|
|
|
|
|
--------- ------ ----------- -------------------------
|
|
|
|
UART PORT BOARD PJRC PINOUT DESCRIPTION
|
|
|
|
FUNCTION LABEL
|
|
|
|
--------- ------ ----------- -------------------------
|
|
|
|
UART0_RX PTA1 (See above) MINI54TAN / Bootloader
|
|
|
|
PTB16 Pin 0 RX1 / Touch
|
|
|
|
PTD6 Pin 21 / A7 RX1 / CS / PWM
|
|
|
|
UART0_TX PTA2 (See above) MINI54TAN / Bootloader
|
|
|
|
PTB17 Pin 1 TX1 / Touch
|
|
|
|
PTD7 Pin 5 TX1 / PWM
|
|
|
|
--------- ------ ----------- -------------------------
|
|
|
|
UART1_RX PTC3 Pin 9 RX2 / CS / PWM
|
|
|
|
PTE1 Pad 26 (Pad on back of board)
|
|
|
|
UART1_TX PTC4 Pin 10 TX2 / CS / PWM
|
|
|
|
PTE0 Pad 31 (Pad on back of board)
|
|
|
|
--------- ------ ----------- -------------------------
|
|
|
|
UART2_RX PTD2 Pin 7 RX3 / DOUT
|
|
|
|
UART2_TX PTD3 Pin 8 TX3 / DIN
|
|
|
|
--------- ------ ----------- -------------------------
|
|
|
|
|
|
|
|
The default serial console is UART0 on pins 0 (RX) and 1 (TX).
|
|
|
|
|
|
|
|
LEDs
|
|
|
|
====
|
|
|
|
|
|
|
|
A single LED is available driven by PTC5. The LED is grounded
|
|
|
|
so bringing PTC5 high will illuminate the LED.
|
|
|
|
|
|
|
|
When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
|
|
|
|
control the LED as follows:
|
|
|
|
|
|
|
|
SYMBOL Meaning LED
|
|
|
|
------------------- ----------------------- ------
|
|
|
|
LED_STARTED NuttX has been started OFF
|
|
|
|
LED_HEAPALLOCATE Heap has been allocated OFF
|
|
|
|
LED_IRQSENABLED Interrupts enabled OFF
|
|
|
|
LED_STACKCREATED Idle stack created ON
|
|
|
|
LED_INIRQ In an interrupt N/C
|
|
|
|
LED_SIGNAL In a signal handler N/C
|
|
|
|
LED_ASSERTION An assertion failed N/C
|
|
|
|
LED_PANIC The system has crashed FLASH
|
|
|
|
|
|
|
|
Thus is LED is statically on, NuttX has successfully booted and is,
|
|
|
|
apparently, running normally. If LED is flashing at approximately
|
|
|
|
2Hz, then a fatal error has been detected and the system has halted.
|
|
|
|
|
|
|
|
Using the Halfkey Loader
|
|
|
|
========================
|
|
|
|
|
|
|
|
See https://www.pjrc.com/teensy/first_use.html
|
|
|
|
https://www.pjrc.com/teensy/loader_cli.html
|
|
|
|
|
2015-06-11 17:07:35 +02:00
|
|
|
Debugging
|
|
|
|
=========
|
|
|
|
|
|
|
|
And, at this point, I don't know how to debug the board. There is no
|
|
|
|
way to connect a JTAG SWD debuggger, at least not without cutting leads
|
|
|
|
to the the MINI54TAN device:
|
|
|
|
|
|
|
|
See: http://mcuoneclipse.com/2014/08/09/hacking-the-teensy-v3-1-for-swd-debugging/
|
|
|
|
|
2015-06-09 15:03:25 +02:00
|
|
|
Teensy-3.1 Configuration settings
|
|
|
|
=================================
|
|
|
|
|
|
|
|
CONFIG_ARCH - Identifies the arch/ subdirectory. This should
|
|
|
|
be set to:
|
|
|
|
|
|
|
|
CONFIG_ARCH=arm
|
|
|
|
|
|
|
|
CONFIG_ARCH_family - For use in C code:
|
|
|
|
|
|
|
|
CONFIG_ARCH_ARM=y
|
|
|
|
|
|
|
|
CONFIG_ARCH_architecture - For use in C code:
|
|
|
|
|
|
|
|
CONFIG_ARCH_CORTEXM4=y
|
|
|
|
|
|
|
|
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
|
|
|
|
|
|
|
|
CONFIG_ARCH_CHIP="kinetis"
|
|
|
|
|
|
|
|
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
|
|
|
|
chip:
|
|
|
|
|
|
|
|
CONFIG_ARCH_CHIP_MK20DX256VLH7=y
|
|
|
|
|
|
|
|
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
|
|
|
|
hence, the board that supports the particular chip or SoC.
|
|
|
|
|
2015-06-09 23:54:04 +02:00
|
|
|
CONFIG_ARCH_BOARD="teensy-3.x"
|
2015-06-09 15:03:25 +02:00
|
|
|
|
|
|
|
CONFIG_ARCH_BOARD_name - For use in C code
|
|
|
|
|
2015-06-09 23:54:04 +02:00
|
|
|
CONFIG_ARCH_BOARD_TEENSY_3X=y
|
2015-06-09 15:03:25 +02:00
|
|
|
|
|
|
|
CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
|
|
|
|
of delay loops
|
|
|
|
|
|
|
|
CONFIG_ENDIAN_BIG - define if big endian (default is little
|
|
|
|
endian)
|
|
|
|
|
|
|
|
CONFIG_RAM_SIZE - Describes the installed DRAM (SRAM in this case):
|
|
|
|
|
|
|
|
CONFIG_RAM_SIZE=0x00008000 (32Kb)
|
|
|
|
|
|
|
|
CONFIG_RAM_START - The start address of installed DRAM
|
|
|
|
|
|
|
|
CONFIG_RAM_START=0x20000000
|
|
|
|
|
|
|
|
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
|
|
|
|
have LEDs
|
|
|
|
|
|
|
|
CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
|
|
|
|
stack. If defined, this symbol is the size of the interrupt
|
|
|
|
stack in bytes. If not defined, the user task stacks will be
|
|
|
|
used during interrupt handling.
|
|
|
|
|
|
|
|
CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
|
|
|
|
|
|
|
|
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
|
|
|
|
cause a 100 second delay during boot-up. This 100 second delay
|
|
|
|
serves no purpose other than it allows you to calibrate
|
|
|
|
CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
|
|
|
|
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
|
|
|
|
the delay actually is 100 seconds.
|
|
|
|
|
|
|
|
Individual subsystems can be enabled:
|
|
|
|
|
|
|
|
To be provided
|
|
|
|
|
|
|
|
Configurations
|
|
|
|
==============
|
|
|
|
|
|
|
|
Common Configuration Information
|
|
|
|
--------------------------------
|
2015-06-09 23:54:04 +02:00
|
|
|
Each Teensy-3.x configurations are maintained in sub-directories and
|
2015-06-09 15:03:25 +02:00
|
|
|
can be selected as follow:
|
|
|
|
|
|
|
|
cd tools
|
2015-06-09 23:54:04 +02:00
|
|
|
./configure.sh teensy-3.x/<subdir>
|
2015-06-09 15:03:25 +02:00
|
|
|
cd -
|
|
|
|
make oldconfig
|
|
|
|
. ./setenv.sh
|
|
|
|
|
|
|
|
Before sourcing the setenv.sh file above, you should examine it and
|
|
|
|
perform edits as necessary so that TOOLCHAIN_BIN is the correct path to
|
|
|
|
the directory than holds your toolchain binaries.
|
|
|
|
|
|
|
|
If this is a Windows native build, then configure.bat should be used
|
|
|
|
instead of configure.sh:
|
|
|
|
|
2015-06-09 23:54:04 +02:00
|
|
|
configure.bat teensy-3.x\<subdir>
|
2015-06-09 15:03:25 +02:00
|
|
|
|
|
|
|
And then build NuttX by simply typing the following. At the conclusion of
|
|
|
|
the make, the nuttx binary will reside in an ELF file called, simply,
|
|
|
|
nuttx.
|
|
|
|
|
|
|
|
make oldconfig
|
|
|
|
make
|
|
|
|
|
|
|
|
The <subdir> that is provided above as an argument to the
|
|
|
|
tools/configure.sh must be is one of the directories listed below.
|
|
|
|
|
|
|
|
NOTES:
|
|
|
|
|
|
|
|
1. These configurations use the mconf-based configuration tool. To
|
|
|
|
change any of these configurations using that tool, you should:
|
|
|
|
|
|
|
|
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
|
|
|
and misc/tools/
|
|
|
|
|
|
|
|
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
|
|
|
reconfiguration process.
|
|
|
|
|
|
|
|
2. Unless stated otherwise, all configurations generate console
|
|
|
|
output on [To be provided].
|
|
|
|
|
|
|
|
3. All of these configurations are set up to build under Windows using the
|
|
|
|
"GNU Tools for ARM Embedded Processors" that is maintained by ARM
|
|
|
|
(unless stated otherwise in the description of the configuration).
|
|
|
|
|
|
|
|
https://launchpad.net/gcc-arm-embedded
|
|
|
|
|
|
|
|
As of this writing (2015-03-11), full support is difficult to find
|
|
|
|
for the Cortex-M&, but is supported by at least this realeasse of
|
|
|
|
the ARM GNU tools:
|
|
|
|
|
|
|
|
https://launchpadlibrarian.net/192228215/release.txt
|
|
|
|
|
|
|
|
That toolchain selection can easily be reconfigured using
|
|
|
|
'make menuconfig'. Here are the relevant current settings:
|
|
|
|
|
|
|
|
Build Setup:
|
|
|
|
CONFIG_HOST_WINDOWS=y : Window environment
|
|
|
|
CONFIG_WINDOWS_CYGWIN=y : Cywin under Windows
|
|
|
|
|
|
|
|
System Type -> Toolchain:
|
|
|
|
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : GNU ARM EABI toolchain
|
|
|
|
|
|
|
|
NOTE: As of this writing, there are issues with using this tool at
|
|
|
|
the -Os level of optimization. This has not been proven to be a
|
|
|
|
compiler issue (as least not one that might not be fixed with a
|
|
|
|
well placed volatile qualifier). However, in any event, it is
|
|
|
|
recommend that you use not more that -O2 optimization.
|
|
|
|
|
|
|
|
Configuration sub-directories
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
nsh:
|
|
|
|
|
|
|
|
Configures the NuttShell (nsh) located at apps/examples/nsh.
|
|
|
|
|
|
|
|
NOTES:
|
|
|
|
|
|
|
|
1. This configuration uses the mconf-based configuration tool. To
|
|
|
|
change this configuration using that tool, you should:
|
|
|
|
|
|
|
|
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
|
|
|
and misc/tools/
|
|
|
|
|
|
|
|
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
|
|
|
reconfiguration process.
|
|
|
|
|
|
|
|
2. By default, this configuration uses the CodeSourcery toolchain
|
|
|
|
for Windows and builds under Cygwin (or probably MSYS). That
|
|
|
|
can easily be reconfigured, of course.
|
|
|
|
|
|
|
|
CONFIG_HOST_WINDOWS=y : Builds under Windows
|
|
|
|
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
|
|
|
|
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
|
|
|
|
|
|
|
Support
|
|
|
|
for builtin applications is enabled, but in the base configuration
|
|
|
|
no builtin applications are selected (see NOTES below).
|