Sct DSP Tutorial
This Tutorial describes how to check out the SCT DSP code, set up Code Composer Studio and compile a new version of the binary under Windows, and how to setup and build the binaries under Linux.
Checking Out From CVS
At the moment the SCT CVS code is on lxplus, it would be nice to move it over to central ATLAS CVS, but this will be a bit of
a faff!
- The CVS for the old (and currently in use) SCT code is located on
lxplus
:
- CVSROOT=:ext:username@lxplus.cern.ch:/afs/cern.ch/user/s/sctpixel/private/cvsroot
- Module RodDaq
- Branch:
SCT_DSP_DEV_1
for the head of the SCT DSP code
- Or each version should also be tagged (eg
SCT_1_4_1
)
- Please tag code if you make a binary for use in the pit!! It makes it MUCH easier to track changes.
If you intend to build under Windows, it is suggested that you check the code out into the directory:
-
C:\Rod-Sct-development
- This will be in sync with the project file in CVS, or you can change the path yourself manually.
- Note that, for Linux builds, you can check out to any directory you like.
Code Composer Studio
The Digital Signal Processors (DSPs) are used on the ATLAS Silicon Read Out Drivers (ROD) to control the ROD and histogram calibration
information. The same RODs are used for both the SCT and pixels, but the firmware is different, tailored to the different hardware needs.
The DSP code is developed and compiled into a binary file using the Texas Instruments Code Composer Studio.
Licenses
As CCS is a commercial product, limited licenses are available. It is installed on various laptops scattered around the SCT group (Trevor, Tom, Peter), and more recently on the SR1 environmental machine.
SR1 Environmental
- Name of machine:
pcatlsctsr1env
- Location: SR1 (http://building.web.cern.ch/map/building?bno=SR1
)
- Username and password should be in the book on the desk, but you should be able to use any NICE login.
- NB - originally wanted to use
sctroddq
account to develop code, but CCS gives errors on startup. For the moment can use the sctdcs
account (password in book)
- Current version is Code Composer Studio version 3.3
Installation
This should have already been done on the machine. If somehow this gets reset, then the procedure is:
- Log in as sctroddq to the NICE machine you want to install to
- The install folder is: \\cern.ch\dfs\Services\caeprogs\TI_CodeComposerStudio
- Copy the folder over, and then run the intall program. (nb, this will only work as sctroddq, who has install rights)
Then follow installation instructions.
You can probably skip this if CCS has already been installed and go directly to the section
SctDSPTutorial#The_DSP_Project.
Setting up CCS for DSP Code
There are a number of obscure and magical things you will need to do get the DSP to actaully compile
on your machine.
The ti and rodts Directory
This directory contains some assemler source code files (asm) and is also needed to store obj files during compilation.
If the correct directory structure is not present, CCS will complain that it can't find the directory.
The actual directory structure is locked deep within the DSP code, so it is easier to just download this:
- ti.zip: Directory structure needed to start up the DSP code
- Then move the ti directory to C:\ so that CCS will pick it up.
You will also need a rodts directory for CCS to copy files to after compilation:
- rodts.zip: Directory structure to compile code
- Unzip this to C:\ for CCS as well.
Additional Libraries
Some additional dll files are needed to run the application used to convert the code into a binary file. This includes
cvirte.dll
. These come from National Instruments, and the run-time application can be downloaded for free. To
get hold of them:
- Google "LabWindows/CVI Runtime Engine"
- This should find the National Instruments page with relevant drivers.
- Download and install the latest version for you platform.
- NILWCVIRTE851.exe: Alternatively get Lab Windows Run-Time here.
Compiler Versions
The version of the Texas Instruments Compiler used to develop much of the code was version 5.1.0, but in Code Composer Studio (installed in SR1), version 6 is used. This is unfortunately not really compatible with the set of libraries used, and an error appears similar to:
[Linking...] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -@"ROD.lkf"
<Linking>
undefined first referenced
symbol in file
--------- ----------------
__strasgi
c:\\ti\\tf\\obj6\\masterPrimFuncts.obj
A dirty way to get round this problem is to replace the new compiler with the old version, which has been put here:
cgtools_31.zip. You need to unzip this directory and place it in the
C:\CCStudio_v3.3\C6000
directory. Ensure you make a back up of the old directory first!
The DSP Project
You should now have everything ready to run Code Composer Studio, and first you need to configure it to tell it which devices to use:
Configuring Code Composer Studio
This describes how to set up CCS to compile the DSP code.
- First, start the CCS setup.
- Either click the desktop icon, or via the start menu:
- Now select the device relevant to the DSP.
- We use the following for the ROD:
- Master: C6201 Device Simulator, Little Endian, Map 1
- Slaves: C6713 Device Simulator, Little Endian
- Select the device and add it to the project:
- Save and quit, when prompted, start CCS on exit.
Starting Code Composer Studio
- If you want to start CCS later, click the desktop icon:
- Or start it via the start menu.
- Now you will need to open the project.
- In CCS, Click on Project -> Open
- Go to the directory
C:\your\install\dir\RodDaq\Dsp\
- Open
rodRun_sct.pjt
for the master, sdsp6713_sct.pjt
for slaves.
Compiling the Code
To compile the DSP code, click on one of the compilation buttons:
- The Compile buttons in CCS:
- The make equivalent is on the left, or re build from scratch on the right.
- If all works well, you should get a box popping up asking you to press a key.
- nb - If you don't get the window popping up, you probably need Lab Windows (see Additional Libraries above)
- This will create binaries and copy them to
c:\rodts\data\dspProgram\rodRun
Building under Linux
The TI compiler is currently installed on SR1 machines at
/work/pcphsctr03/TI_tools/TI_CGT_C6000_5.1.13/
. A
README in the
TI_tools
directory also describes how to install alternate compiler versions and how to rebuild
the support libraries, but, in general, the 5.1.13 installation is ready-to-use (no additional setup, no magic libraries,
no zipfiles containing hard-coded directory structures). To compile the code:
- Check out the source. No restrictions on the directory structure (except that you need to be able see the compiler)
- cd into the
RodDaq/Dsp
directory
- The Makefile should take care of everything for you. Just type
make
. Or just make master
or make slave
if that's all you need.
Flashing the Binaries
Now you have the binaries, they need to be flashed to the ROD crates.
Master DSP
The master DSP consists of one file,
rodrun_sct.bin
, that need to be flashed to the DSP, and is stored
in memory. To do this:
- Copy the binray somewhere accessible by the DAQ crate.
- Log into the single board computer (SBC) in the DAQ crate. (
ctatsct01
in SR1)
- Source the relative setup script for the DAQ code (eg
/work/pcphsctr04/daqsoft/sct/SctRodDaqTom/setup_tdaq191_bs.sh
)
- Go to the RodUtils directory: (=$SCTPIXEL_DAQ_ROOT/RodUtils)
- Run
./MdspFlashLoad
and enter the appropriate slot and the path to your binary.
- Run
./RodReset
to reset the ROD so it is ready to go!
Slave DSP
The slave DSP code is flashed when the ROD is configured, by sending binaries to the master and writing the memory
from there.
- There are three binaries you need to copy: sdsp6701_ipram.bin, sdsp6701_idram.bin, sdsp6701_xprog.bin
- These then need to be included in your SctDaq configuration.
- For the xml configuration, you need to edit
$SCTDAQ_ROD_CONFIGURATION_PATH
- And then add or modify the following: (usually at the top of the file)
<defaults>
<slave type="F">
<ipramFile>/work/pcphsctr04/daqsoft/sct/devdsp/SlaveOct2008/sdsp6713_ipram.bin</ipramFile>
<idramFile>/work/pcphsctr04/daqsoft/sct/devdsp/SlaveOct2008/sdsp6713_idram.bin</idramFile>
<extFile>/work/pcphsctr04/daqsoft/sct/devdsp/SlaveOct2008/sdsp6713_xcode.bin</extFile>
</slave>
</defaults>
- The new firmware should load next time you start up the Daq
Troubleshooting
Here are some recent issues I have had compiling the code, add others as they come up...
Space Issues
- The MDSP has been running low on extra space (in both XPROG and IDRAM)
- To get round this you can set the compiler to optimise for space
- Lool under Project -> Build Options... -> Opt Speed vs Size
- Change the flag to make size more critical
- I found that then I get the following error:
[Linking...] "C:\Program Files\CCStudio_v3.1\C6000\cgtools\bin\cl6x" -@"ROD.lkf"
<Linking>
undefined first referenced
symbol in file
--------- ----------------
__divi c:\ti\tf\obj6\masterPrimFuncts.obj
>> error: symbol referencing errors - './sct/binary/rodrun_sct.out' not built
- To get round this, right click on masterPrimFuncts.c and select "File Specific Options..."
- For this file, change the Opt Speed vs Size back to Speed More Critical "-ms0"
- Good luck!
Major updates:
--
TomBarber - 03 Feb 2009