Author Archives: cypher

Stellaris/TiVa Toolchain for compiling Stellarap FIrmware

Recently, someone requested that I give some more details on how to compile the stellarap firmware.    In response, I have put together this post which includes detailed instructions for setting up a toolchain for compiling the stellarap firmware.    I have done this using a virgin Linux Mint 15 virtual machine, so you should be able to follow along on any fresh Linux system.   The only modifications I made to the virtual machine after installation were to install  GIT,  VIM and possibly a few other tools.

The first thing you will need to do is to download all of the required packages.    These are listed here with a brief description:

The latest GCC Arm Embedded compiler:      gcc-arm-none-eabi-4_7-2013q3-20130916-linux.tar.bz2  This is the GCC compiler for embedded ARM processors that is maintained by ARM Inc.   There are other compilers that you might try that should work fine, such as the code sourcery compiler.

Newlib library:  newlib-2.0.0.tar.gz

This is the library that provides convenient C functions such as stdio, strings (printf), and math.h functions.

TivaWare Software library:   SW-Tm4C-1.1.exe

This is the driver libraries provided by Texas Instruments that allow you to make use of specific functions such as the ADC, timers,  PWM,  etc.. inside the TiVa series microcontrollers.   This software is convenient since it saves us from having to re-invent the wheel, and also many of the functions are stored inside a ROM in the processor meaning that every call to a ROM provided library function is one less function that you need to store in program memory.

Finally, you will need the Stellarap firmware:   https://github.com/mroy/stellarap

Once you have all of these downloaded on your Linux (virtual) machine, you can begin to install them using the following commands assuming that you have placed all of these packages in ~/Downloads/

$ cd /opt
$ sudo tar -jxvf /home/user/Downloads/gcc-arm-none-eabi-4_7-2013q3-20130916-linux.tar.bz2
$ cd ~
$ echo  "export PATH=\$PATH:/opt/gcc-arm-none-eabi-4_7-2013q3/bin" >> ~/.bashrc
$ . ~/.bashrc
$ tar -zxvf ~/Downloads/newlib-2.0.0.tar.gz
$ cd newlib-2.0.0
$ ./configure --target=arm-none-eabi --disable-newlib-supplied-syscalls --enable-interwork --enable-multilib --disable-libssp --disable-nls
$ make
$ cd ~
$ mkdir stellarisware  && cd stellarisware
$ unzip ~/Downloads/SW-TM4C-1.1.exe
$ cd driverlib
$ make
$ cd ~
$ git clone https://github.com/mroy/stellarap
$ cd stellarap
$ make

Note that if you have difficulties compiling newlib, you may be able to get away with using the packaged version of libm and liba that comes with the compiler.  Just go into the stellarap makefile and uncomment the libm/liba library lines and comment the libm/liba lines for the compiled version.

Also, it may be useful for you to also build the USB debugger OpenOCD.  This allows you to use the built in debugger on the development board which is quite nice for debugging or even just programming the board.  I actually use this interface as the primary connection for my reprap and its been working great.   OpenOCD has recently been released with built in support for the Stellaris/TiVa  ICDI.

Get the latest OpenOCD with GIT:

$ cd ~  && git clone git://git.code.sf.net/p/openocd/code && mv code openocd

Build OpenOCD like this:

$ cd ~/openocd && ./bootstrap

If, like me, you get an error from this ./bootstrap about not being able to resolve the Git host for JimTcl, then execute the following to get JimTcl from the github mirror instead:

$ rm -rf jimtcl/
$ git clone https://github.com/msteveb/jimtcl

Then continue with the regular build process:

$ ./configure --enable-ti-icdi
$ make
$ sudo make install

This should install OpenOCD in /usr/local/

To run OpenOCD with the Launchpad, it needs a configuration script.   Copy paste the following script and save it as ~/stellarap/openocd.cfg


# TI Stellaris Launchpad ek-lm4f120xl Evaluation Kits
#
# http://www.ti.com/tool/ek-lm4f120xl
#
#
# NOTE: using the bundled ICDI interface is optional!
# This interface is not ftdi based as previous board were
#
source [find interface/ti-icdi.cfg]
set WORKAREASIZE 0x4000
set CHIPNAME lm4f120h5qr
source [find target/stellaris_icdi.cfg]

 Thats it!  To debug/run your newly compiled software,  connect your stellaris to the computer via USB and start openocd from the stellarap project directory:

$ sudo openocd

Now, in a new terminal, run the following:

$ arm-none-eabi-gdb main.axf

This starts the GDB debugger that comes with the compiler and tells it to use the compiled stellarap firmware.    Once GDB is started, run the following to get started programming your board:

$ target extended-remote :3333
$ monitor reset init
$ monitor reset halt
$ load
$ run

Stellarap should now be running on the device.  You should be able to start pronterface and connect to the Launchpad through  /dev/ttyACM0 or similar.

Cheers and good luck!

[edit] For anybody who is still having difficulties compiling/running the code, please see the binary files that are now included in the github page. The files are main.bin and main.axf. I have been using main.axf with arm-none-eabi-gdb to do debugging/programming, but have not tried flashing the .bin Results may vary.

Stellaris Launchpad RepRap

2012-12-01 21.40.56

A little over a year ago, I decided to dive into the 3D printing arena.  I love the idea of being able to design and print in 3D plastic, giving me another tool in my maker arsenal.

My initial idea was to build a simple stepper driver board and heater controller board and connect it to my CNC as a new axis that would allow me to print from my CNC machine as well.   I went so far as to build both of these boards and managed to get them working, but after some difficulties and a couple blown driver chips (due to incorrectly hooking them up to my CNC controller board) I decided to try and build an actual 3D printer.

Continue reading

CakePHP Calendar Helper

Recently I began my first CakePHP project; for those of you who aren’t aware, CakePHP is a popular model-view-controller framework for creating web applications in PHP.

In my project, I had the need for a calendar in a few of my views, and after looking around a bit, I found a nice and simple calendar helper.  The helper works fine and dandy, but doesnt quite do all of the things I needed; namely, what was missing was a weekly calendar view that displays an hourly schedule one week at a time.

Continue reading

LED Desktop Clock Prototype

I made a quick little video that demonstrates the prototype of my desktop clock. In the next few days I’ll be posting a project page with schematics, the board layout, firmware, and instructions on how to build your own. Later, I may introduce a kit that can be purchased that would include all of the parts needed to build this clock.

And without any further yammering, here is the video: