Checking Out the Examples

There are a set of examples in the CVS repository for the Tcl-CM3 project that show how stsa and pycca are used to build an application.

Tool Chain

These examples are specifically intended to be used with the Code Sourcery Sourcery G++ Stellaris tool chain. This is not the lite edition, but the one with the integrated Eclipse IDE. The instructions here describe how to check out the examples using the Eclipse IDE and build the results. The code in the examples and the code generated by stsa depends upon specific capablities of GCC. You might be able to use another Cortex-M3 tool chain, but you will have to modify the code. After all, Tcl-CM3 is an open-source project and is geared to using open-source tools.

Overview

If you have Sourcery G++ for Stellaris installed, these are the general steps in building the examples.
Checking Out the Code

You can do an anonymous CVS check out of the example code directly from the Eclipse IDE. Bring up the CVS Repository Exploring perspective and create a new repository location. Fill it in as shown below.

There is an example directory off the top level and each example project is in one of the subdirectories found there. Now use navigate the File menu to File->New->Other to get to a wizard that will all you to create a new project by checking out an existing project via CVS. Select the repository location that you just created and navigate to the examples directory and select the desired example.

Install stsa and pycca

If you have not already done so, you need to install stsa and pycca. These applications are distributed as Tcl Starpacks. The applications are single file executables with no other external dependencies. Installation is simply copying to a convenient location and uninstalling is simply file deletion. Both Linux X-86 and Windows X-86 Starpacks are available. Download the one appropriate for your configuration. These files will need to be uncompressed and you will undoubtedly want to rename the executables to simply stsa and pycca unless you like carrying around all the version number stuff in the file names. You need to place the executable in a convenient location of your choosing. I usually create a bin directory off of my home directory and put them there. Wherever you decide to place the executable, you will need to remember the location for the next step.

Configure the Build

The example projects have stsa and pycca set up as External Tools. The External Tools setup up lists the absolute location of the tool executable. You will need to modify it to suit where you placed. So open the Project Properties, find the Builders tab and edit the two builders that generate the mechanisms and any domains in the project. Change the Location field to reflect where you installed stsa and pycca. On my system it looks like the following.

Build the Example

At this point, if you have automatic building turned on, the you should end up with a binary. There of course can be problems. Usually it revolves around integrating the stsa and pycca applications into Eclipse. Eclipse seems to want to think that you code everything by hand into a C file.

Other Considerations

The way in which the Software Architecture generated by stsa treats memory mapped peripherals is to define a structure which matches the layout of the hardware registers. Then a variable of that structure type is defined and its location is fixed in memory to match the address of the hardware registers. This gives a very natural look to the resulting code, but it does mean that you must modify the linker script to fix the variable address in memory. The examples all have linker scripts as part of them, and they are derived from the ones that CodeSourcery includes in the tool chain. Just be aware that often these linker script assume a certain memory layout that matches a particular Luminary Micro evaluation board and may well need some additional tweeking to match your particular circumstances. This is why the linker script is included as part of the project.