Running NuttX on Teensy 3.1

The PJRC Teensy 3.1 board is a very nice and powerful board. It has a small form-factor powered by NXP/Freescale MK20DX256 ARM Cortex-M4 microcontroller at 72MHz.

Normally it is used to run Arduino compatible sketches. Since I’m not a great Arduino fan the logic thing to do is run something else on it.

Fortunately NuttX has support to this board.

These are the steps I did to get it running:

1) Download the teensy loader for your platform:

https://www.pjrc.com/teensy/loader_linux.html

$ gunzip teensy.64bit.gz 
teensy.64bit
$ mv teensy.64bit teensy_loader
$ chmod a+x teensy_loader
$ sudo cp teensy_loader /usr/local/bin/

3) Get the udev rules and copy it to right place:

$ wget https://www.pjrc.com/teensy/49-teensy.rules
Resolving www.pjrc.com (www.pjrc.com)... 67.19.59.50
Connecting to www.pjrc.com (www.pjrc.com)|67.19.59.50|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1622 (1.6K) [text/plain]
Saving to: ‘49-teensy.rules’

49-teensy.rules                100%[=================================================>]   1.58K  --.-KB/s    in 0s      

2016-04-16 15:23:31 (47.7 MB/s) - ‘49-teensy.rules’ saved [1622/1622]

$ sudo cp 49-teensy.rules /etc/udev/rules.d/

3) Clone NuttX mainline bitbucket apps and nuttx repositories.

$ mkdir nuttx_teensy
$ cd nuttx_teensy
$ git clone https://bitbucket.org/nuttx/nuttx
$ git clone https://bitbucket.org/nuttx/apps

4) Compile NuttX to Teensy 3.1:

$ cd nuttx
$ cd tools/
$ ./configure.sh teensy-3.x/nsh
$ cd ..
$ make menuconfig
  Build Setup  --->
    Build Host Platform (Linux)  --->

$ make
...
LD: nuttx
make[1]: Leaving directory '/comum/workspace/NuttX/nuttx/nuttx/arch/arm/src'
CP: nuttx.hex
CP: nuttx.bin
$

5) Plug Teensy 3.1 on USB cable and press the board’s button.

6) Now run the teensy loader:

$ teensy_loader
File ->
  Open HEX File
    Select nuttx.hex

Click on Program icon Button it will program nuttx.hex in the board

7) Connect a USB/Serial 3.3V to Teensy 3.1 board, this way:

-----------------------------
USB Serial | Teensy Board pin
-----------------------------
   GND     |       GND
   TXD     |        0
   RXD     |        1
-----------------------------

8) Run minicom or other serial console program
Configure it to use your USB/Serial port as 115200 8n1

Now in the teensy load program click on Reset icon Button, the NuttX shell will appear:

NuttShell (NSH)
nsh> ?
help usage:  help [-v] []

  [           cmp         free        mkfifo      set         unset       
  ?           dirname     help        mh          sh          usleep      
  basename    dd          hexdump     mv          sleep       xd          
  break       echo        kill        mw          test        
  cat         exec        ls          pwd         time        
  cd          exit        mb          rm          true        
  cp          false       mkdir       rmdir       uname       

Builtin Apps:
nsh> 

2 thoughts on “Running NuttX on Teensy 3.1

  1. Hello Alan !
    which compiler were you using, the one from arduino’s delivery 1.0.5 ?
    non EABI or EABI, that’s the question…
    Are you in relation with some developers currently working with Teensy 3.1 /2 ?

    Thank you very much for giving us your know-how.

    Jean-Noël

    1. Hi Jean-Noël,
      I’m using the default gnu arm toolchain available on Ubuntu:
      ||/ Name Version Architecture Description
      +++-===========================-==================-==================-============================================================
      ii gcc-arm-none-eabi 15:4.9.3+svn231177 amd64 GCC cross compiler for ARM Cortex-A/R/M processors

      You can download this same toolchain for other Linux distributions or Win/MAC OS.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s