FreeRTOS Stellaris Setup under Linux

This page documents how to get the Stellaris web server demo running under Linux. These instructions are for Fedora Core 7 (FC7) but should work for other distributions.

For the least difficulty use the eclipse package from the eclipse site. I tried to use the Fedora-provided eclipse package eclipse-cdt but it would not work. I got the error "The managed make project file for project RTOSDemo is missing" which I was unable to solve. Switching to the normal eclipse version solved that problem.

If you are using a LuminaryMicro Stellaris LM3S6965 evaluation board revision C (look on back of board) you will need to apply these updates to the FreeRTOS V4.7.2 source.

Change to the directory which contains the FreeRTOS sub directory and enter the command:

patch -p0 < rev_c_patch.txt

You will need the following software:


For Eclipse extract the archive file to a directory (tar -xzf filename). It does not need any installation, just run the Eclipse binary from the eclipse directory created.

OpenOCD is the interface to the on-board USB jtag interface on the Luminary Stellaris evaluation board. It supports two libraries for USB communication to the FTDI chip. Libftdi is an open source library and the libftd2xx is a closed source binary driver. I started with libftdi but switched to libftd2xx since inspecting memory didn't work reliably under libftdi.


To build libftdi download the tar file and extract to a directory and cd to that directory. Then execute the following commands.
  1. csh shell and relatives
    (setenv LIBS -lusb ; ./configure --prefix=/usr )
    or bash and relatives
    LIBS=-lusb ./configure --prefix=/usr
  2. make
  3. make install
I found I needed to set LIBS since it wasn't finding my libusb without. I also put the files in /usr instead of /usr/local to make the OpenOCD build easier.


Extract the tar file to a directory and copy static_lib/libftd2xx.a.0.4.15 to /usr/lib. then ln -s /usr/lib/libftd2xx.a.0.4.15 /usr/lib/libftd2xx.a


Current version of openocd doesn't work with the FreeRTOS scripts. To checkout the version I am using that does work use:
svn checkout -r 309 svn://

OpenOCD will need to be built from source. Follow the instructions on the page linked to above. If you don't have the svn command on your system install the subversion package using your favorite package manager. I used yum install subversion. Then execute the following commands in the OpenOCD trunk directory. Modify the ./configure command with the directory you extracted libftd2xx to.

  1. ./bootstrap
  2. ( setenv LIBS "-lusb -lrt -ldl" ; ./configure --enable-ft2232_ftd2xx --with-ftd2xx=/home/djg/luminary/openocd/libftd2xx --prefix=/usr )
  3. make
  4. make install
To use the libftdi library use this command instead:
./configure --enable-ft2232_libftdi --prefix=/usr

If you run openocd as root with this config file. The config file was created by adding to the openocd provided config file src/target/target/lm3s6965.cfg

interface ft2232
ft2232_layout evb_lm3s811
ft2232_vid_pid 0x0403 0xbcd9
in your current directory you should get something like:
Open On-Chip Debugger 1.0 (2008-11-19-21:56) svn:1177

BUGS? Read

$URL: svn:// $
500 kHz
Info:   JTAG device found: 0x3ba00477 (Manufacturer: 0x23b, Part: 0xba00, Version: 0x3)
Warning:no telnet port specified, using default port 4444
Warning:no gdb port specified, using default port 3333
Warning:no tcl port specified, using default port 6666
If it doesn't work you can use the OpenOCD support Forum or email me from the link at the end of this page.

If you run as a non-root user you will likely get the following error:

Error: 3 1203871166 ft2232.c:1473 ft2232_init_libftdi(): unable to open ftdi device: unable to fetch product description
This is because the USB devices aren't normally accessible to non-root users. This can be changed but how is likely to be distribution specific.

For libftd2xx which uses the older /proc/bus/usb devices I changed the device permissions by putting 45-ft2232-libftd2xx.rules in /etc/udev/rules.d and setmode in /etc/udev then chmod +x /etc/udev/setmode.

For libftdi which uses /dev/bus/usb I changed the device permissions by putting 45-ft2232-libftdi.rules in /etc/udev/rules.d

then unplugging and plugging back in the board. You should then be able to run openocd as a user. If it doesn't work you can look in /proc/bus/usb/devices for "Stellaris Evaluation Board" or use lsusb and look for "Future Technology Devices International, Ltd." Verify that the vendor and prodid match the values in 45-ft2232.rules. The udev rule should change the /dev/bus/usb/###/### file to crw-rw-rw- The ### is system dependent and can be determined by lsusb or the devices file.

CodeSourcery ARM Tools and Java

I used their .bin installer and followed the instructions. It should set up your path. In not you will need to set the path. If you are running a csh variant put in your home directory's .cshrc the correct path such as
setenv PATH "/usr/java/jre1.6.0_03/bin:/usr/local/CodeSourcery/Sourcery_G++_Lite/bin:$PATH"
for bash derivatives put in your home directory's .bashrc
export PATH="/usr/java/jre1.6.0_03/bin:/usr/local/CodeSourcery/Sourcery_G++_Lite/bin:$PATH"
Exit shell or logout and then verify java and arm-none-eabi-gcc can be executed.

FreeRTOS & Eclipse Project Configuration

Download the zip file and extract to a directory (unzip filename). Unzip is in the unzip package if it's not installed in your system.

Now follow the Eclipse setup instructions from the FreeRTOS site. The link is for Europa release. If you are using the current release Ganymede you need to select the hardware debugger from the Help menu item software updates then install as shown below.

Since the project is configured for windows you will need to do a couple more configuration steps to get it working. Start Eclipse with working directory for the FreeRTOS demo, example /home/djg/luminary/FreeRTOSV5.1.0/FreeRTOS/Demo/CORTEX_LM3Sxxxx_Eclipse

Note that sometimes dialog boxes will come up the wrong size. You may need to manually expand the window to see all the content.

From the 'Project' menu, select 'Properties'. If Properties is grayed out click on RTOSDemo on the left side of the main window. The menu selection will bring up a dialog. Under 'C/C++ Build' check 'Use default build command'

Next expand 'C/C++ General' item and then select 'Paths and symbols'. Under 'Languages' for each of 'Assembly', 'GNU C', and 'GNU C++' use the 'Delete' button to remove the c:/devtools entries.

Next expand 'C/C++ Build' item and then select 'Discovery options'. Under 'Compiler invocation command' remove the .exe from 'arm-none-eabi-gcc' then select the OK button.

From 'Run' menu, select 'External Tools' then 'Open External Tools Dialog'. The menu selection will bring up a dialog. In it change the 'Location' to the full path of the openocd binary. Do this for both 'OpenOCD Programmer' and 'OpenOCD Server' by selecting them on the left. Then select the Close button.

The Stellaris port is developed under windows which is not case sensitive for file names but Linux is. For FreeRTOS version 4.7.2 you will need to change in emac.c #include "Semphr.h" to #include "semphr.h".

Next use your favorite editor to edit in

ft2232_device_desc "Stellaris Evaluation Board A"
ft2232_device_desc "Stellaris Evaluation Board"

After everything has been working for a while you can also see if you can improve performance by changing
jtag_speed 40
to a lower number such as 10

At this point you should be able to build the project with F7 or from 'Project' menu, select 'Build All'. You should also be able to program the board with menu 'Run' 'External Tools' 'OpenOCD Programmer'. Occasionally the jtag interface will get confused. Resetting the board or unplugging it normally gets it working again. I get an error at the end of programming "configuration_output_handler(): Timed out waiting for reset" which does not seem to cause any problems. We are almost done. For debugging one more change is needed. In the upper right select the '>>' then 'Debug' to switch to the debug view.

From debug view 'Run' menu, select 'Open Debug Dialog' which will open the debug dialog. In it select the circled filter button and then unselect 'Apply window working set(s)'.

Next expand 'GDB Hardware Debugging' then select the 'Debugger' tag and remove .exe from 'GDB Command'

Now you should be able to start the OpenOCD server and run the debugger as documented in Embedded software development using Eclipse and FreeRTOS

If you find any mistakes please email so I can correct them. If you have trouble you can email me using the address below or use the support list for the particular program that's giving you trouble.

Feel free to contact me, David Gesswein with any questions, comments on the web site, or if you have related equipment, documentation, software etc. you are willing to part with.  I am interested in anything PDP-8 related, computers, peripherals used with them, DEC or third party, or documentation. 

PDP-8 Home Page   PDP-8 Site Map   PDP-8 Site Search