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:
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.
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://svn.berlios.de/openocd/trunk
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.
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 ft2232in your current directory you should get something like:
ft2232_vid_pid 0x0403 0xbcd9
If it doesn't work you can use the OpenOCD support Forum or email me from the link at the end of this page.Open On-Chip Debugger 1.0 (2008-11-19-21:56) svn:1177 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ 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 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 descriptionThis 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.
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.
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
FromAt 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.
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
to a lower number such as 10
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.