There has been massive growth in real‐time applications demanding real‐time processing power, and this has led DSP manufacturers to produce advanced chips and advanced development tools which not only allow engineers to develop complex algorithms with ease but also speed up time‐to‐market. Development tools can be divided into hardware and software development tools (see Figure 3.1). Development tools are very important and tend to shorten significantly the development time, which is itself the most time‐consuming part of the production of a device.
Texas Instruments (TI) provides an advanced integrated software and hardware development toolset. On the software side, it provides the Multicore Software Development Kit (MCSDK) that provides foundational software for the KeyStone devices as shown in Figure 3.2. On the host side, the main part in the MCSDK is the Code Composer StudioTM (CCS) Integrated Development Environment (IDE) which is based on Eclipse, an open‐source software framework used by many embedded software vendors. Included in CCS are a full suite of compilers (which support OpenMP) [1], a source code editor, a project building environment, a debugger, a profiler, an analyser suite, and many other code development capabilities (see video in Ref. [2]). On the target side, it includes mainly the instrument and trace, symmetric multiprocessing (SMP) Linux for ARM and other libraries.
CCS has been developed in such a way that its functionality can be extended by plug‐ins. There are two types of plug‐ins: ones written by TI and ones written by a third party. Some plug‐ins are very useful as they provide graphical development tools which are intuitive and abstract device APIs (application programming interfaces) and hardware details. For instance, with a few clicks of the mouse, one can configure some interrupts, a peripheral or a debugging procedure.
It is essential for a developer to fully understand the use and capabilities of the tools. This chapter is divided into three main parts: the first part describes the development tools, the second part describes the evaluation module (EVM) and finally the third part describes provided laboratory exercises demonstrating the capabilities of the CCS and EVMs.
The software development tools consist of the following modules: the C‐compiler, assembler, linker, simulator and code converter (see Figure 3.3).
If the source code is written in C language, the code should be compiled using the optimising C compiler provided by TI [4]. This compiler will translate the C source code into an assembly code. The assembly code generated by either the programmer, the compiler or the linear assembler (see Chapter 5) is then passed through the assembler that translates the code into object code. The resultant object files, any library code and a command file are all combined by the linker which produces a single executable file. The command file mainly provides the target hardware information to the linker and is described in Section 3.2.3.1.
The C code is not executable code and therefore needs to be translated to a language that the DSP understands. In general, programs are written in C language because of its portability, ease of use and popularity. Although for time‐critical applications assembly is the most efficient language, the optimising C compiler for the TMS320C66x processors can achieve performances exceeding 70% compared with code written in assembly. This has the advantage of reducing the time‐to‐market and hence cost.
To evoke the compiler, use the CL6x command as shown here:
Note: The CL6x command is not case sensitive for Windows.
The compiler uses options supplied by the user. These options provide information about the program and the system to the compiler. The most common options are described in Chapter 5. However, for a complete description of the compiler options, the reader is referred to the optimising C compiler manual [4].
The options shown in Table 3.1 can be inserted between the CL6x command and the file name as shown here:
Table 3.1 Common compiler options
Option | Description |
‐mv6600 | Tells the compiler that the code is for the TMS320C66x processor |
‐k | Do not delete the assembly file (*.asm) created by the compiler. |
‐g | Symbolic debugging directives are generated to enable debugging. |
‐i | Specifies the directory where the #include files reside |
‐s | Interlists C and assembly source statements |
‐z | Adding the ‐z option to the command line will evoke the assembler and the linker. |
The assembler translates the assembly code into an object code that the processor can execute. To evoke the assembler, type:
The above command line assembles the FIR1.asm file and generates the FIR.obj file. If ‘FIR.obj’ is omitted from the command, the assembler automatically generates an object file with the same name as the input file but with the .obj extension, in this case FIR1.obj.
Note: The asm6x command is not case sensitive for Windows.
The assembler, as with the compiler, also has a number of ‘switches’ that the programmer can supply. The most common options are shown in Table 3.2.
Table 3.2 Common assembler options
Option | Description |
‐l | Generates an assembly listing file |
‐s | Puts labels in the symbolic table in order to be used by the debugger |
‐x | Generates a symbolic cross‐reference table in the listing file (using the ‐ax option automatically evokes the ‐l option) |
The following command line assembles the FIR1.asm file and generates an object file called fir1.obj and a listing file called fir1_lst.lst.
Note: The file names are case sensitive.
The various object files which constitute an application are all combined by the linker to produce a single executable file. The linker also takes as inputs the library files and the command file that describes the hardware. To evoke the linker, type:
The above command line links the FIR1.obj file with the file(s) contained in the command file comd.cmd. The linker options can also be contained in the command file.
The linker also has different options that are specified by the programmer. The most common options are shown in Table 3.3.
Table 3.3 Frequently used options for the linker
Options | Description |
‐o | Names an output file |
‐c | Uses auto‐initialisation at runtime |
‐l | Specifies a library file |
‐m | Produces a map file |
The following command line links the file FIR1.obj with the file(s) specified in the comd.cmd file and generates a map file (FIR1.map) and an output file (FIR1.out).
Note: The ‐m FIR1.map and the ‐o FIR1.out command could be included in the command file.
Note: The lnk6x command is not case sensitive for Windows, and if ‐o FIR1.out is omitted, then an A.out file will be generated instead.
The command file serves three main objectives: the first objective is to describe to the linker the memory map of the system to be used, and this is specified by ‘MEMORY {…}’. The second objective is to tell the linker how to bind each section of the program to a specific section as defined by the MEMORY area; this is specified by ‘SECTIONS {…}’. The third objective is to supply the linker with the input and output files, and options of the linker. An excerpt of a command file for the TMS320C6678 EVM is shown in Figure 3.4.
As with all embedded systems, the command file is indispensable for real‐time applications. The linker options specified in the CL6x command can be specified within the command file, as shown in Figure 3.4.
The command CL6x, combined with the ‐z linker option, can accomplish the compiling, assembling and linking stages all with a single command, as shown here:
By using the RTSC tools, one is able to take advantage of the higher levels of programming and performance that the RTSC can offer in addition to features that allow components to be added or modified/upgraded without the need to modify the source code. For a complete description of the RTSC, please refer to Ref. [5].
The XDCtools are the heart of the RTSC components; see Figure 3.5. These tools provide mainly efficient APIs for development and static configurations that can accelerate development to production time and ease maintenance.
In Section 3.2.3, a command file was written from scratch. With the use of the XDCtools, this can be imported as a package that is delivered by the developer (TI) and used by the consumer. This package can be in the form of a plug‐in.
In the example shown in Figure 3.6, instead of entering a linker command file, a platform file describing the memory map is supplied (see Figure 3.7). This platform can be viewed and modified by selecting (while in the CCS Debug mode) Tools → RTSC Tools → Platform → New. Figure 3.7 to Figure 3.12 are self‐explanatory on how to generate a new target platform from a seed platform. Once a platform is created, the seed platform has to be replaced by the new platform, as shown in Figure 3.13.
Add the path shown in Figure 3.12 (C:UserseendmyRepositorpackages) using the Add button shown in Figure 3.13, then select the platform myBoard.
The KeyStone System‐on‐Chip (SoC) is a very powerful and complex processor. To ease its use and reduce time‐to‐market, TI has developed foundation software called the Multicore Software Development Kit (MCSDK); see Figure 3.14 [7]. The MCSDK, with the supported EVMs, provide out‐of‐box demos with source code that can be modified, libraries and device drivers. TI also provides a platform development kit with low‐level software drivers, libraries and chip support software for peripherals supported by the KeyStone [8].
EVMs are relatively low‐cost demonstration boards. They allow one to evaluate the performance of the processors. The EVMs are platforms that contain the processor, some peripherals, expansion connectors and emulators. In the case of the TMDXEVM6678LE EVM, there are two emulators, one on‐board (XDS100) and one on a mezzanine (XDS560), that use the JTAG (Joint Test Action Group) emulator header, as shown in Figure 3.15a. The KeyStone II has a Mezzanine XDS200 emulator connected to the JTAG header, as shown in Figure 3.15b.
Note: In this book, two EVMs are used: the TMDXEVM6678LE and the K2EVM‐HK. For a complete description, please refer to Refs. [7] and [11–13].
The basic layouts of both EVMs are shown in Figure 3.16.
The key features of the TMDXEVM6678L or TMDXEVM6678LE EVM are [16]:
The key features of the KeyStone II EVM are [15]:
All laboratories experiments have been tested, and solutions are provided.
File location
Minimum | Recommended | |
Memory | 1 GB | 4 GB |
Disk space | 300 MB | 2 GB |
Processor | 1.5 GHz single core | Dual core |
Hardware features | Software features | Kit contents |
|
|
|
Follow these links to access the sites required.
For this teaching material, download the Windows version shown in Figure 3.19. You will be prompted to register with TI.com as shown in Figure 3.20. Once registered, you will be given access to download the CCS as shown in Figure 3.21.
These laboratory experiments mainly provide an introduction to the CCS, implementation of a dot product (dotp), how to use the CCS clock to benchmark code and how to download code to separate cores and run them on the TMS320C6678 EVM.
File locations for this chapter:
The aim of this laboratory exercise is to become familiar with the DSP tools and to be introduced to programming the TMS320C66xx SoC DSP.
This section shows how to use development tools, create a project and modify the compiler switches in order to achieve the best performance.
Note: You have to be logged in as an administrator if you require updates.
Note: DO NOT press ‘Finish’ until you have configured your project.
Note: If you import a project and you do not have the right compiler or XDCtools version, you can download them separately using these links:
https://www‐a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm
http://downloads.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/
However, you may have to register with TI first. Once the tools are downloaded and installed, restart the CCS so that the tools will be automatically updated.
Press ‘Finish’ to confirm the settings. The window in Figure 3.26 will then appear.
Once you have defined a project, you can add a configuration to this project using these commands:
Type a file name, and click Finish.
Select File > Save As () to record your target configuration selections.
Open the target configuration and set it for the Blackhawk XDS560v2‐USB Mezzanine Emulator and the TMS320C6678, as shown in Figure 3.29.
Select the Advanced tab and explore the CPU Properties. Then, save and close the file.
Note: You can add multiple target configurations to your projects (this is very useful if you are using different platforms). However, only one target configuration can be active at any time. You can also choose a default target so that you don’t have to add a target configuration to each project.
To add a new target configuration to the list of target configurations or to select a new configuration for a project, do the following:
By selecting one of the commands from the list, a display of the New Target Configuration dialogue will appear as shown in Figure 3.30.
You can now see all the configurations created and their locations. Now you can select the appropriate configuration. In this laboratory, you will be using the configuration that you just created.
Once the target configuration is completed and closed, it will be automatically added to your project and set to Active.
Go back to the Project Explorer. If your Project Explorer is not visible, then select Project Explorer (see Figure 3.31).
Notice that the project is highlighted and there is [Active – Debug] next to the project name. This means:
Right‐click on the project and select Build Configurations → Set Active.
Click on Release, and see Debug change to Release in the project. This is how you change build configurations (the set of build options) when you build your code.
Note: Build configurations such as Debug, Release and others that you create will not contain the same build options, like levels of optimisation and debug symbols; specify file search paths for libraries (‐l) and include search paths (‐i) for included directories.
Change the build configuration back to Debug. Near the top left‐hand corner of CCS, you will see the build Hammer and the Bug:
Select the Debug mode, and start debugging your code.
If you simply click the bug, it will build whichever configuration is set as the default (either Debug or Release). It will always do an incremental build (i.e. build only those files that have changed since the last build; it is much faster this way).
You can also specify a build type as shown in Figure 3.35.
There are three kinds of builds:
Incremental and clean builds can be done over a specific set of projects or the workspace as a whole. Specific files and folders cannot be built. There are two ways that builds can be performed:
Once you have successfully built your project, the Debug window will appear as shown in Figure 3.37.
You can observe the CDT Build Console to see the compilation feedback. If the window is not visible, choose View > Console. In fact, View lets you select a list of windows that you would like to display; see Figure 3.38.
Use the starting code given in dotp.c (Figure 3.39) to implement a dotp function (y = ∑ aixi).
Check the value of y and write it here:
The answer should be: y = 2829056 decimal.
Add another function just below the System_printf("y = %d ", y) in order to print y in hexadecimal format.
The answer should be: y = 2b2b00 hexadecimal.
This function is identical to printf except that the output is copied to the specified character buffer but followed by a terminating ‘