You are on page 1of 44

Volume 1

Getting Started
TriMedia Compilation System 5.4
February 2010

Copyright
The information presented in this document does not form part of any quotation or contract, is believed to be accurate and reliable and may be changed without notice. No liability will be accepted by the publisher for any consequence of its use. Publication thereof does not convey nor imply any license under patent or industrial or intellectual property rights. NXP Semiconductors and North American NXP Corporation reserve the right to make changes, without notice, in the products, including circuits, standard cells and/or software, described or contained herein in order to improve design and/or performance. NXP Semiconductors assumes no responsibility or liability for the use of any of these products, conveys no license or title under any patent, copyright, or mask work right to these products makes no representations or warranties that these products are free from patent copyright, or mask work right infringement, unless otherwise specified. Applications that are described herein for any of these products are for illustrative purposes only. NXP Semiconductors makes no representation or warranty that such applications will be suitable for the specified use without further testing or modification. Copyright 2010 NXP B.V. All rights reserved.

Publication Date: February 2010 Reproduction in whole or in part is prohibited without the prior written consent of the copyright owner. All other company, brand or product names are trademarks or registered trademarks of their respective companies or organizations.

Disclaimers
Right to make changes NXP Semiconductors reserves the right to make changes, without notice, in the products, including circuits, standard cells, and/or software, described or contained herein in order to improve design and/or performance. NXP Semiconductors assumes no responsibility or liability for the use of any of these products, conveys no licence or title under any patent, copyright, or mask work right to these products, and makes no representations or warranties that these products are free from patent, copyright, or mask work right infringement, unless otherwise specified. Life support These products are not designed for use in life support appliances, devices, or systems where malfunction of these products can reasonably be expected to result in personal injury. NXP Semiconductors customers using or selling these products for use in such applications do so at their own risk and agree to fully indemnify NXP Semiconductors for any damages resulting from such application. Quality assured Our quality system focuses on the continuing high quality of our components and the best possible service for our customers. We have a three-sided quality strategy: we apply a system of total quality control and assurance; we operate customer-oriented dynamic improvement programs; and we promote a partnering relationship with our customers and suppliers. For more information see the General Quality Specification for Integrated Circuits, SNW-FQ-611_PART D.

Licensing
Purchase of NXP I2C components conveys a license under the NXP I2C patent to use the components in the I2C system provided the system conforms to the specification defined by NXP. This I2C specification can be ordered using the code 9398 393 40011.

Trademarks
Windows xx are either trademarks or registered trademarks of Microsoft Corporation. Nexperia is a trademark of NXP B.V. All other company, brand or product names are trademarks or registered trademarks of their respective companies or organizations.

Chapter 1

Overview of the TriMedia System


1.1 TriMedia VLIW Architecture
TriMedias DSPCPU family delivers exceptional performance and high-level language programmability for multimedia applications through the use of its VLIW (very long instruction word) architecture. TriMedias VLIW architecture combines innovations in compiler and software design with advances in logic design. Overview of The TriMedia VLIW Architecture The TriMedia architecture is based on a three-level hierarchy of operators:

Instructions Operations RISC operations

One instruction may contain five operations. Each operation may execute multiple arithmetic operations.
Instruction

Operation 1

Operation 2

Operation 3

Operation 4

Operation 5

Cycle n

An example of one such operation is the command ifir(a,b). This command contains a total of three arithmetic operations: two multiplications and one addition (aHI bHI + aLO bLO). Up to five operations including two ifir commands can be issued in each machine cycle. The ability of TriMedias VLIW architecture to execute multiple operations in parallel gives it a big advantage over traditional RISC and CISC architectures found in current mass-market microprocessors.

1.1.1 Functional Unit Assignment


Although the VLIW architecture allows for five operations to be executed per instruction, most operations cannot use just any of the slots because each functional unit of the TriMedia CPU is assigned to specific issue slots in a TriMedia VLIW instruction. Table 1-1: gives the functional unit assignments for pnx1500 Chip.
Table 1-1: Functional Unit Assignments Functional Unit Quantity Latency[1]/ Delay[2] 1 1 3 Recovery[3] Slot Assignment 1 1 1 1
3 3

2
3 3

3
3 3

4
3 3 3

5
3 3 3

Constant Integer ALU Load/Store

5 5 2

Volume 1 Getting Started

Release 5.4 - February 2010

NXP Semiconductors
Table 1-1: Functional Unit Assignments Functional Unit Quantity Latency[1]/ Delay[2] 2 3 1 3 3 3 1 17 Recovery[3] Slot Assignment 1 1 1 1 1 1 1 1 16
3 3 3 3 3 3 3 3 3

3
3 3 3 3 3

5
3

DSP ALU DSP MUL Shifter Branch Int/Float MUL Float ALU Float Compare Float sqrt/div

2 2 2 3 2 2 1 1

3 3

[1] Clock cycles between the issuance of an operation and availability of its results [2] Clock cycles between the execution of a branch instruction and the branching taking place [3] Minimum number of clock cycles between successive operations

Because of the number of available functional units and their assignment, some operations may have to wait for one or more cycles before they are executed. This means that in some cases not all issue slots are used. Good use of issue slots is one of the purposes of software code optimization.

1.1.2 What Makes TriMedias VLIW Architecture Better


The instruction set architecture (the processor programming model) must be distinguished from implementation (the physical chip and its characteristics). VLIW microprocessors and superscalar implementations of traditional instruction sets share some characteristics such as multiple execution units and the ability to execute multiple operations simultaneously. The techniques used to achieve high performance are different between VLIW and superscalar architectures. In superscalar architecture, parallelism has to be discovered by hardware at runtime. Whereas in the case of VLIW, parallelism is explicit in instructions, paving way for a simpler hardware logic and therefore lower cost. Just as RISC architectures permit simpler, cheaper high-performance implementations than do ClSC architectures, VLIW architectures are simpler and cheaper than superscalar RlSC architectures because of hardware simplifications. However, they require more compiler support. The TriMedia VLIW architecture optimizes parallelism at compile time using its sophisticated compilation system. This makes the core less complicated (and feasible) and does not require specialized scheduling hardware at runtime. As a result, the TriMedia processors have much simpler control logic than other parallel designs and can run at higher clock speeds.

1.1.3 Performance
The best performance measurement is actual application measurement. Experience shows that complex DSP algorithms ported to TriMedia take between 0.5 and 1.0 times the number of instruction cycles as on other DSPs. However, while these algorithms are optimized in C for TriMedia, DSPs are traditionally optimized in assembly language. In some algorithms, very high peak performance can be achieved. This is one of the keys to the optimization of the MPEG decoding algorithm. Because as many as 4 RISC operations can be performed in one TM operation, and because up to five TM operations can be executed at the cycle rate of 400 MHz and above for newer TriMedia chips, peak execution rates of 2500 million operations per second are possible.

Volume 1 Getting Started

Release 5.4 - February 2010

NXP Semiconductors
The mixture of programmability in C and efficient signal processing loops makes TriMedia particularly suited for the complex signal processing required by todays multimedia applications.

1.2

TriMedia Compilation and Simulation System (TCS)


TriMedia processors are supported by a robust, TriMedia Compilation and Simulation System (TCS) that speeds up creation of highly optimized multimedia applications entirely in the C and C++ programming languages. The TCS Tools releases provide a suite of system software tools to compile and debug multimedia applications, analyze and optimize performance, and simulate execution on a TriMedia processor.
C/C++ Development VLIW Compilation System System Tools Source- and Machine-level Debugging Performance Analysis and Enhancement Execution

Code Profiling TriMedia Multimedia Libraries Independent Software Vendors (ISVs) Customer-developed Optimization Tools Reporting

C-Callable Multimedia Ops

Highly Optimized SIMD (Single Input, Multiple Data)

Simulator

Figure 1-1: TriMedia Compilation Simulation and System Components

TriMedia TCS releases feature the following:

An Integrated development Environment (IDE) based on Eclipse Platform an independent, vendor-neutral, open development platform for building software. ANSI-compliant C/C++ compilation system Source level debugging Performance analysis and enhancement tools Cycle-close machine-level simulator TriMedia core device libraries Example programs Comprehensive online documentation Includes pSOS operating systems from Wind River Systems (formerly Integrated Systems, Inc. (ISI))

Volume 1 Getting Started

Release 5.4 - February 2010

NXP Semiconductors 1.2.1 TriMedia Tools


Figure 1-2: shows TriMedia TCS tools.
tmgmonGUI utility for running TriMedia applications Execution Tools tmrunTool for downloading and running TriMedia applications

tmccC/C++ Compiler Driver tmcfeCompiler Front End System Tools VLIW ANSI C/C++ Compilation System tmccomCompiler tmipaInter-Procedural Analysis Tool tmschedInstruction Scheduler tmasAssembler TriMedia TCS Tools Source-level Debugging tmldLinker and Loader tmstripStrips symbol information from object files tmdbgSource-level Debugger

Profiling Tools

tmprofProfile Analysis Tool tmact Execution Trace Analysis Tool tmmgprofStatistics Merger

Performance Analysis & Enhancement Tools

tmarArchive Librarian Tool tmdumpDumps TriMedia object modules Reporting Tools tmnmPrints name list of TriMedia object file or library tmsizePrints TriMedia object file size

Machine-level Simulator

ttisimfunctional (ISA) Simulator tmverisim - Cycle accurate Simulator

Figure 1-2: TriMedia TCS Tools

1.2.1.1

Execution Tools Table 1-2: describes the TriMedia Execution tools.


Table 1-2: Execution Tools Tool tmgmon tmrun Description GUI utility for running TriMedia applications. Tool for downloading and running TriMedia applications.

Volume 1 Getting Started

Release 5.4 - February 2010

NXP Semiconductors
1.2.1.2 System Tools Table 1-3: describes the TriMedia VLIW ANSI C/C++ Compilation System Tools.
Table 1-3: VLIW ANSI C/C++ Compilation System Tool tmcc tmcfe tmipa tmccom tmsched Description C/C++ Compiler Driver. Processes a C/C++ source file and produces input for tmccom. Inter-Procedural Analysis (used by TriMedia compiler tmccom). The C/C++ core compiler module of the TriMedia Compilation System. The TriMedia instruction scheduler. It schedules the TriMedia intermediate code input file (.t) for the target machine specified by the machine description file (.md) and produces the TriMedia assembly code file (.s). The TriMedia assembler. TriMedia linker and loader. Links files together to produce a linked object module or executable, loading necessary modules from specified libraries Strips symbol information from object files.

tmas tmld tmstrip

Table 1-4: describes the TriMedia Source-level Debugging Tool.


Table 1-4: Source-level Debugging Tool tmdbg Description A utility for source-level debugging and execution of programs written in ANSI C for a TriMedia VLIW processor.

1.2.1.3

Performance Analysis and Enhancement Tools Table 1-5: describes the TriMedia Profiling Tools.
Table 1-5: Profiling Tools Tool tmprof tmmgprof tmact etmact Description Generate estimated execution profile. Merges the profiling statistics from specified files. Analyzes execution trace created by tmverisim, cycle accurate simulator, and produces dynamic call graph and execution profile Some TriMedia cores such as TM3271, TM3282 etc have assocaited embedded trace modules (ETMs) and these ETMs, if included in a SoC, can produce execution trace that is compressed. The tool etmact is used to decompress and recreate execution trace using the ETM trace as input.

Table 1-6: describes the TriMedia Reporting Tools.


Table 1-6: Reporting Tools Tool tmar tmdump tmnm tmsize Description Allows the user to build a library, print the contents of a library, delete or replace the modules in a library, extract modules from a library, or print modules from a library Dumps a TriMedia format object file or library in readable form. Prints the name list (symbol table) of a TriMedia format object file or library table of contents (__.SYMDEF module). Prints the sizes of sections (segments) and functions in a TriMedia object file or library.

Volume 1 Getting Started

Release 5.4 - February 2010

NXP Semiconductors
1.2.1.4 Machine-Level Simulator Table 1-7: lists a few of the TriMedia Core Simulators
Table 1-7: Simulation Tools Tool ttisim tm5250sim tm3260sim tm2270sim tm3271sim tm3282sim tm32Config1sim tm3285sim Description Functional simualtor for TriMedia cores (invokes one of the following simulators automatically) Functional Simulator for tm5250 core Functional Simulator for tm3260 core Functional Simulator for tm2270 core Functional Simulator for tm3271 core Functional Simulator for tm3282 core Functional Simulator for tm32Config1 core Functional Simulator for tm3285 core

tmverisim tm5250verisim tm3260verisim tm2270verisim tm3271verisim tm3282verisim tm32Confgi1verisim tm3285verisim

Cycle accurate simulator for TriMedia cores (invokes one of the following cycle accurate simulators automatically) Cycle-accurate core simulator for tm5250 core Cycle-accurate core simulator for tm3260 core Cycle-accurate core simulator for tm2270 core Cycle-accurate core simulator for tm3271 core Cycle-accurate core simulator for tm3282 core Cycle-accurate core simulator for tm32Config1 core Cycle-accurate core simulator for tm3285 core

1.3

Eclipse IDE for TriMedia Tools


The Eclipse IDE delivered with TCS provides many features that cover the whole software development cycle: building a software component, navigating in user written code and compiler generated intermediate files, simulating and debugging applications, analyzing and tracking performance and code size. The TriMedia specific features, which exploit and extend the rich Eclipse platform, are aimed to help users in developing high-performance applications. They provide graphical tools that help users to better understand their applications by displaying textual data (critical paths, cache trace files) in a structured graphical way and also ease execution of repetitive manual tasks (report generation, design space exploration).

1.3.1 Navigation and Visualization


When trying to optimize a TriMedia application you may need to analyze intermediate textual files generated by the compiler. These files contain very useful information which are sometimes tedious to find. Moreover, navigating between those files with a simple text editor may be fastidious and error prone.

Volume 1 Getting Started

Release 5.4 - February 2010

NXP Semiconductors
The TCS Eclipse environment provides text editors with syntax coloring for tree (.t), schedule (.s), cache trace analysis (.cta) and scheduler log (.schedlog) files. All those editors also have an outline view containing a hierarchical view of the textual file being edited. By right-clicking on the components of these views you can smoothly jump to the corresponding component in other files (e.g.: from a dtree in a tree file to the corresponding C/C++ source line, from a function in a cache trace analysis file to the corresponding schedule of this function). Those outline views also offer sorting and filtering features in order to allow available data to be displayed using the most appropriate way. To further enhance the user experience some editors also provide views that offer alternative representations of the data being edited. Finally, those editors and views are also linked to the report engine in order to generate a report corresponding to the visualized data in a few clicks.

1.3.2 Report Generation


Analyzing cycle counts or code size in textual file can be a tedious task, especially when more than two configurations are involved. The TCS Eclipse IDE provides a report engine that can generate some graphical reports (html or pdf format) to ease that task. For instance, by simply selecting multiple cache trace analysis files in the report wizard, cycle counts can be compared at function level thanks to an expressive bar graph chart. Those reports can be generated at multiple times during the development cycle of an application: just after the first successful compilation of an application such a report can provide a quick overview of where the time is spent in the application and can thus drive the optimization process; regular reports can also be used to document the progress of the project by comparing the effect of the last optimization attempts with the results of previous attempts; in case of a development distributed over multiple physical locations, such reports also provide a more insightful way to exchange information on the performance and code size status of the application. Finally, for all use cases, these reports reduce development time by providing visually attractive graphical data.

1.3.3 Design space exploration


Performance of an application may be greatly influenced by compiler flags used to compile its source files. However, due to the numerous optimization flags available, it can be a very tedious task to exercise all flags and all possible combinations of those flags. The TCS Eclipse IDE contains a Design Space Exploration wizard that greatly simplifies this task. In a few clicks you can launch the automatic generation, compilation and simulation of some new configurations based on well-known sensitive optimization flags (grafting, if-conversion, ...). Such an exploration may reveal some flag combinations that could reduce the cycle budget of even the most handoptimized applications. And finding such an optimal configuration is greatly simplified by the possibility to generate performance comparison reports on the generated configurations.

1.3.4 Automatic Updates


Beside the regular updates through Engineering Releases, the TCS Eclipse features also become available on a weekly basis. Updates can be installed through the automatic update feature of Eclipse. Depending on your location these updates may be directly available through a web server or zipped archives. Please contact your regular TCS support to find out which situation applies to your location.

1.3.5 Eclipse TriMedia target control plugins


TCS Releases from 5.2 onwards include TriMedia target control Eclipse plug-ins. These plug-ins support the following features:

Downloading an application to TriMedia Hardware. During downloading there is support for

Volume 1 Getting Started

Release 5.4 - February 2010

NXP Semiconductors

BIS creation. Download for debugging (enabling attaching through debugger).

Controlling a TriMedia target (Run, Stop, Reset, Clear BIS) Getting information from a TriMedia Target (DP Dump, BIS dump)

All the above features are supported over PCI channel. The TriMedia target control plug-ins also contain preliminary support for EJTAG. EJTAG support has been tested with PNX8550 and PNX5100. Note that the WindRiver PowerICE probe needs different firmware for PNX5100 than for PNX8550. Please ensure that you are using the correct firmware. EJTAG support has been tested with the probe.dll as distributed with TCS 5.2 onwards. Although it should be possible to use a different probe.dll as well, this is not advised. Therefore please make sure that $TCS/tmComm/bin is in your path before any other directory containing a probe.dll. When using EJTAG the Target Control Plug-ins will automatically determine values for TM32_DRAM_LO, TM32_DRAM_HI, and TM32_CLIMIT. It is currently not possible for the user to supply other values. Also note that when controlling the TriMedia and downloading over EJTAG there are currently no sanity checks done. For example, when downloading an application there is no check on whether the image will actually fit in memory or whether the application has been compiled for the correct TriMedia architecture. Specifying EJTAG targets as well as enabling and disabling of channels can be done by clicking the Configure button on that Target control view or by navigating to Window->Preferences and then selecting TriMedia Compilation System -> Target Control tab. Due to limitations of the WindRiver PowerICE drivers it is not possibly to have more than one active EJTAG target at a time.

1.3.6 Eclipse Debugger


TCS 5.1 is the first release featuring the TriMedia debugger as an Eclipse plug-in. The Eclipse debugger supports the following features:

Loading or attaching a program. Manipulating breakpoints (software, hardware, and pSOS breakpoints). Run, next, step, finish, continue, suspend. Displaying stack traces and pSOS task list. Both can be collapsed for limiting target communication bandwidth. Displaying the source file location of the selected stack frame. Displaying the local variables for the selected stack frame. Viewing memory, including the possibility to display single values as quadruples. Viewing registers including MMIO registers. Redirecting application standard I/O. Dumping the Debug Print (DP) buffer. Displaying pSOS information such as queues, semaphores, regions, objects, profiles and date.

Volume 1 Getting Started

Release 5.4 - February 2010

10

NXP Semiconductors 1.3.7 Eclipse setup


The C/C++ development environment, CDT, relies on external tools in order to provide some functionality. To properly build C/C++ projects CDT requires the following executables to be in your search path:

* The target compiler (gcc, tmcc,...) * The make utility * The echo command

On Windows the make and echo executables are provided by Cygwin (www.cygwin.com). Note that the version of make should NOT be higher than 3.80 (more recent versions, starting with 3.81, have dropped support for the (non-POSIX) Windows path notation). The Cygwin version used is 1.5.18

1.4

PNX85500 Support
TCS 5.3 Release provides support for the PNX85500 SoC and associated VPE. When compiling for the pnx85500 SOC, the tables below show the various options to be used with the compiler/ linker driver tmcc.

1.4.1 Compilation
When compiling for the actual SoC, the table below shows the TriMedia cores together with the targets and hosts to be used with tmcc command:
Table 1-8: Compilation for the actual SoC Core Instantiation avdsp nm_dsp1 nm_dsp2 Target option to tmcc command -target pnx85500_av_dsp -target pnx85500_nm_dsp1 -target pnx85500_nm_dsp2 -target pnx85500_tm3285_memc1 (default) -host option of tmcc command -host WinNT -host WinNT -host WinNT -host nohost

tmconfig tm3282 tm3282 tm3285

When compiling for the pnx85500 Emulator, the table below shows the TriMedia cores together with the targets and hosts to be used with tmcc command:
Table 1-9: Compilation for the pnx85500 Emulator Core Instantiation avdsp nm_dsp1 nm_dsp2 Target option to tmcc command -target pnx85500_av_dsp_Emulator -target pnx85500_nm_dsp1_Emulator -target pnx85500_nm_dsp2_Emulator -target pnx85500_tm3285_memc1_Emulator (default) -host option of tmcc command -host WinNT -host WinNT -host WinNT -host WinNT
(since PCI block is available in emulation)

tmconfig tm3282 tm3282 tm3285

Volume 1 Getting Started

Release 5.4 - February 2010

11

NXP Semiconductors
When compiling for ttisim / pnx85500 VPE, the table below shows the Trimedia cores together with the targets and hosts to be used with tmcc command:
Table 1-10: Compilation for ttisim / pnx85500 VPE Core Instantiation avdsp nm_dsp1 nm_dsp2 Target option to tmcc command -target pnx85500_av_dsp -target tm3282Minimal -target tm3282Minimal -target tm3285Minimal -host option of tmcc command -host ttisim (default) -host ttisim (default) -host ttisim (default) -host ttisim

tmconfig[1] tm3282[2] tm3282 tm3285

[1]For the tmconfig core present in pnx85500, the minimal target 'tm32Config1Minimal' can not be used since the tmconfig core in the minimal target has 8 interrupts, where the pnx85500 instance of the tmconfig core has 16 interrupts. Users must specify '-host ttisim' for simulation with ttisim / VPE. [2]Since coprocessors are not yet included in the pnx85500 VPE, the tm3282Minimal target suffices. Compilation of coprocessor load / stores are supported in the minimal target. Note however that coprocessor latency / recovery times for the minimal target differ 1 cycle from the coprocessor latency / recovery times of the nm_dsp1. If coprocessor latency / recovery is of importance in compiling for nm_dsp1, you can use 'tmcc -target pnx85500_nm_dsp1 -host ttisim hello.c ', just as you would use 'tmcc -target pnx8550_av_dsp -host ttisim hello.c'

To compile an application for the AV-DSP processor (the tmConfig), use the target "pnx85500_av_dsp":
> tmcc -target pnx85500_av_dsp file.c

To compile an application for the first NM-DSP processor (the tm3282 with NM coprocessor), use the target "pnx85500_nm_dsp1":
> tmcc -target pnx85500_nm_dsp1 file.c

To compile an application for the second NM-DSP processor (the tm3282 without coprocessor), use the target "pnx85500_nm_dsp2":
> tmcc -target pnx85500_nm_dsp2 file.c

1.4.2 Simulation
Functional simulation of tmconfig, tm3282, and tm3285 cores is done usin appropriate simulators. The user can select the specific variant of TriMedia core via simulator options. Below an overview of these options and their effect:
Table 1-11: Functional simulation of tmconfig and tm3282 Core Simulator tm32Config1sim tm32Config1sim tm3282sim tm3282sim tm3282sim tm3285sim Options <none> -avdsp <none> -target pnx85500_nm_dsp1 -target pnx85500_nm_dsp2 -target pnx85500_tm3285_memc1 What is simulated tmconfig (8 interrupts) in msvd2 tmconfig (16 interrupts) in msvd2 in pnx85500 tm3282 in pnx1005 nm_dsp1 in pnx85500 nm_dsp2 in pnx85500 tm3285 core + memc1 coprocessor in PNX85500M1 SoC

tmconfig tmconfig tm3282 tm3282 tm3282 tm3285

Volume 1 Getting Started

Release 5.4 - February 2010

12

NXP Semiconductors

1.5

Platform support
TCS 5.3 is available on both Linux and Windows.

1.5.1 Linux
The supported Linux platform is 32-bit RedHat Enterprise Linux 4.0 and 5.0 on x86 architecture. The available features on Linux are TCS compilation and simulation tools and the debugger. The TCS 5.2 release also includes Linux drivers for PNX1500 and PNX1700 SoCs for RHEL 4 platform. The drivers have been built and tested on RHEL4, kernel version 2.6.9-67.0.1.ELsmp. If your Linux distribution is based on Linux kernel version 2.6 you may try to build the Linux drivers yourself using the makefiles provided under $TCS/tmComm/src/drivers/tmman32/x86_linux/PNX*. In the Makefile for your particular SoC you will need to set the TCS variable to point to your TCS install and then issue a "make clean all" command. There is no support for other versions of Linux or for other TriMedia SoCs. If you do need support for other Linux versions or for other SoCs, please contact your account manager or business line representative. WindRiver WinICE EJTAG drivers and MDS PCI or USB jtag drivers are not provided by respective vendors on Linux. Hence, EJTAG, JTAG channels are not supported on Linux platform.

1.5.2 Windows
The supported Windows platforms are Windows 2000 and Windows XP. When selecting the EJTAG channel in tmdbg's download box, it is required to fill in correct values for sdram base, limit, cacheable limit, app mem size, and mmio base. If the sdram base is left at 0 tmdbg will assume an sdram base equal to the sdram base of the SoC you are downloading to. All the other values should not be left at 0 and users must supply the correct values, since tmcal EJTAG driver and tmdbg cannot automatically determine these values Users compiling their application for the Windows platform and linking against TriMedia custom ops emulation libraries need to use MSVC 8.0 (.Net 2005) with Service Pack 1 (SP1) installed. If you use any other version of MSVC you may get error messages at link time about unresolved symbols, or you may experience other unexpected behavior. 1.5.2.1 .Net 2005 As of TCS 5.2,TCS releases are compiled with .Net 2005 on Windows. Applications compiled with .Net2005 using Microsoft(R) C runtime dlls require these dlls and their Manifest file to be present in the application's directory. The same holds for dlls that use the MS C runtime dlls. If an application loads such dlls then the MS C runtime dlls and their Manifest file are required to be present in the application's directory.

As a result, if you want to use TCS applications and/or dlls outside the regular TCS install, you will also need to copy the MS C runtime dlls and Manifest file. For example if you want to use probe.dll from a TCS release with Dvpmon and copy it to the Dvpmon application directory you will also need to copy the MS C runtime dlls and Manifest file to Dvpmon application directory. If you want to use the TriMedia debugger or Eclipse as distributed with TCS with a Java/JRE install other than the one distributed with TCS, you need to ensure that the MS C runtime dlls and Manifest file are copied to your java/bin directory. The same holds if you want to use an Eclipse install other than the one provided with TCS in combination with the TCS plug-ins. You will need to take care that the MS C runtime dlls and Manifest file are in the java/bin directory of the java version used by your Eclipse installation.

Volume 1 Getting Started

Release 5.4 - February 2010

13

NXP Semiconductors
If the MS C runtime dlls and Manifest file are not copied correctly the application may fail to initialize properly and abort or crash. You may get one of the following error messages depending on the version of Windows on which you try to run the application:

The application failed to initialize properly (0xc0000135). This application has failed to start because the application configuration is incorrect. Reinstalling application may fix this problem. The system cannot execute the specified program. R6034 An application has made an attempt to load the C runtime library incorrectly. This application has failed to start because MSVCR80.dll was not found. Re-installing the application may fix this problem. This application has failed to start because MSVCP80.dll was not found. Re-installing the application may fix this problem.

The MS C runtime dlls and Manifest files that need to be copied are the following: a. b. c. Microsoft.VC80.CRT.manifest msvcp80.dll msvcr80.dll

They can be found in the $TCS/bin and $TCS/tmComm/bin directories. Note that when you do not use/copy any of the TCS applications or dlls outside your TCS install and do not use Java/JRE or Eclipse versions other than the ones provided in the TCS install you should not have to take any action.

Volume 1 Getting Started

Release 5.4 - February 2010

14

Chapter 2

Installing TriMedia TCS Tools


2.1 Introduction
This chapter provides detailed information for installing TriMedia TCS tools which includes the TriMedia Compilation System, device libraries for the tm32 and tm3260 cores, target-host communication libraries and TriMedia SoC simulation architecture (Ttisim). The Windows disc contains a version of the TriMedia TCS tools for Windows (Windows XP). The installation program for Windows is called setup.exe and can be found in the WINDOWS directory under the root of the Windows dics. Installing TriMedia TCS Software on a PC The TriMedia TCS tools can be installed on a PC to create a complete development and test environment. You can also install TriMedia hardware on a PC with or without the complete TCS. Portions of the TCS are required to use the reference board. In the same way, it is possible to install TCS on a machine that does not include TriMedia hardware.

2.1.1 Supported PC Build Hosts


The following is the supported operating system for PC build host:

Windows XP Linux (RedHat enterprise Linux version 5, RHEL5)

2.1.2 Supported PC Execution Hosts


This release supports the following execution host:

Windows XP Linux (RHEL 5) for PNX1500 and PNX1700 only

2.2

Installing TriMedia TCS tools


The PC can function both as a build host and as an execution host. The TriMedia compiler runs on build hosts such as Windows XP. The TriMedia reference board (NREF) plugs into an execution host, allowing you to execute TriMedia code on the actual hardware. Although an execution host can also be used as a build host, it is a common practice to use different hosts for building and running. For example, you might use two machines connected by a network, where you build on one machine but run on the other. This keeps the build environment active if your program crashes the execution host. The early chapters of the TriMedia cookbook provide more information on building and running your programs.

Volume 1 Getting Started

Release 5.4 - February 2010

15

NXP Semiconductors 2.2.1 Windows Installation


Warning: For an execution host, it is important that no previous version of the TriMedia TCS is installed on your PC. It is possible, but not recommended, to keep two versions of the build environment on one PC: To install the TriMedia TCS on your Windows computer, perform the procedures described in the following sections. The compact Windows installation requires about 250 MB of disk space, not including documentation. A full installation including examples requires 300 MB of disk space. The typical Windows installation installs the entire Windows TCS tools, which allows host compilation and execution. Users can also choose custom install to select only those components that they would like to install. 2.2.1.1 Using the Setup Program TriMedia TCS CD includes setup.exe in the WINDOWS directory under the root directory of the Windows disc. This program automates much of the installation process. To install the complete TCS, run that program and follow its directions as outlined below. 2.2.1.1.1 Entering Personal Information First few screens will show you the licensing information and terms and conditions of installing the TCS tools software. You must agree to the License Agreement before installation will proceed. Once you agree to the license agreements, the next screen will ask for some information about you and your company. Fill in your name and your companys name:

Volume 1 Getting Started

Release 5.4 - February 2010

16

NXP Semiconductors
2.2.1.2 Choosing the Location of the Installation Folder Choose the location of the installation.

1. 2. 3.

By default, the installation wizard installs the TriMedia TCS at C:\TriMedia directory. Click the Browse button if you want to specify an installation directory different from the default chosen by the installation wizard. The Choose Folder window will appear. Choose the directory in which you would like to install the TriMedia TCS from the Directories panel. If the directory does not already exist, the installation wizard will prompt you if you would want a new folder to be created to use as the installation folder.

Volume 1 Getting Started

Release 5.4 - February 2010

17

NXP Semiconductors
4. Type the name of the installation folder in the Path field.

5. 6.

Click OK. Click Next. The Setup window appears.

Volume 1 Getting Started

Release 5.4 - February 2010

18

NXP Semiconductors
7. Click Next. The wizard asks you for the name of the program folder where tmgmon.exe, tmdbg.exe and a readme file will be stored.

The default name for program folder is TriMedia TCS. 8. Click Next. The wizard asks you to choose either TCS tools only installation or TCS tools plus Eclipse installation. It is recommended that you choose to install TCS tools + Eclipse, which will enable the use of powerful Eclipse based Integrated Development Environment for TriMedia Tools.

Volume 1 Getting Started

Release 5.4 - February 2010

19

NXP Semiconductors

9.

Click Next. The wizard copies the necessary files into the installation and program folders. In addition, the wizard creates the TriMedia.bat file, sets up environment variables and asks you to review the readme file.

Note: Use the WordPad program (Start\Programs\Accessories) to view the Windows XP readme files. 2.2.1.2.1 Finishing the Installation Click Finish to exit the installation wizard. If during installation, you elect to install the TMMan driver, the installation will remove any existing TMMan driver and reboot the system after the installation process completes. After rebooting, the system should detect new TriMedia based hardware. When prompted for the path of the driver, please select the folder corresponding to the appropriate Windows version on the installation CD at tmcomm\lib\kernelmode\win2k\pnxXXXX. 2.2.1.3 A Note on Installation Requirements For the TriMedia Debugger The TriMedia debugger tmdbg uses sockets for interprocess communication when used with a simulator target. Consequently, the host operating system must support sockets. On a Windows XP system, you must install an Ethernet card and TCP/IP networking (even if the host machine is not attached to a network) and make sure the machine has an assigned IP address.

Volume 1 Getting Started

Release 5.4 - February 2010

20

NXP Semiconductors
Select: Control Panels>>Network. If TCP/IP is not installed, click Add and follow directions to install TCP/IP. Once it is installed, select: Control Panels>>Network>>TCP/IP>> Properties>>IP Address and make sure the machine has an assigned IP address (not Obtain an IP address automatically). tmdbg will report a gethostbyname failure if it cannot find an IP address for the host machine. 2.2.1.4 Installation of Updates If you have been using TriMedia with earlier releases, your installation will require an extra step to remove the old drivers. Because new features are added, the drivers from a new release are sometimes not compatible with earlier releases. This information will be clearly stated in the release notes. Since the drivers for a Windows system are closely tied to the kernel of the OS, you must reboot to install new drivers. Windows XP became the preferred operating system. For existing Windows XP installations, the drivers that are currently installed must be removed and the new drivers must be installed.

2.3

Eclipse
On Windows, Eclipse is accessible through a shortcut in the Start menu: Programs > TriMedia TCS X.Y > TriMedia Eclipse IDE. On Linux, you can launch <TCS_ROOT>/eclipse/ tcs_eclipse_launcher.sh.

2.3.1 Welcome Screen


When launching Eclipse for the first time, a welcome screen is displayed:

By clicking on the What's New icon you can access the list of new features grouped by components. You can then click on the "C/C++ Development" icon to get news about the C/C++ support in Eclipse or on the "TriMedia Compilation System" icon to get an overview of the newly introduced features.

Volume 1 Getting Started

Release 5.4 - February 2010

21

NXP Semiconductors 2.3.2 On-line Help


The Eclipse help system is available through the global menu Help > Help Contents:

The help system contains documentation for all installed plug-ins. The most relevant entries are:

Workbench User Guide, to get familiar with the Eclipse IDE C/C++ Development Environment User Guide, to get started with the C/C++ environment in which the TCS tool-chain is integrated. TCS Development User Guide contains tutorials covering available features.

Volume 1 Getting Started

Release 5.4 - February 2010

22

Chapter 3

Running Demonstration Programs


3.1 Introduction
The installed version of the TriMedia TCS includes a set of demonstration programs that you can run on the 32-bit variants of the TriMedia chip. The demonstration programs are designed to give you a flavor of the capabilities of the TriMedia processor. In addition, by studying how these programs work, you can learn how to write TriMedia programs. This chapter describes how to run the following demonstration program:

files

The sources of example program files are at installation_folder_for tcs/examples/misc/files. You can build the executable by issuing the following command:
make TARGET=pnx1500 TCS=<path>

You are encouraged to try the other demonstration programs on the CD. The supplied readme file provides the necessary information for running these programs. Warning: Make sure that the directory which contains tmgmon and tmrun.exe is included in the path.

3.2

Running the Files Program


The files program is also useful for verifying TriMedia board installation. It uses the fread and fwrite calls to transfer data back and forth across the PCI bus. The files program should run for many hours without errors. Errors will be consistently generated (error messages are displayed in the tmrun window) if there is a hardware compatibility problem. Refer to Chapter 5, Troubleshooting, for more information. To run the files program, do the following: 1. Double-click on the tmgmon.exe icon. The TriMedia Monitor window appears. 2. 3. 4. Click the Filename button. Select files.out from the folder where it was compiled. Click Go. The tmrun window appears. 5. Press Control-C to quit and go back to tmgmon.

Volume 1 Getting Started

Release 5.4 - February 2010

23

NXP Semiconductors

Volume 1 Getting Started

Release 5.4 - February 2010

24

Chapter 4

Using TriMedia TCS Tools


4.1 Introduction
This chapter shows, step by step, how to compile, simulate, process, and debug getIt.c, a TriMedia sample program, using tmcc, ttisim, tmgmon/tmrun, and tmdbg respectively.

4.2

Sample Program: getIt.c


The step-by-step examples covered in the remaining sections of this chapter are based on the getIt.c program:
#include #include #include #include <stdlib.h> <stdio.h> <math.h> <tmlib/tmtypes.h>

#define INPUT 30 static Float factorial( Int input ){ Int i; Float result, help; for( i=input, result=1; i>0; i ){ help = (Float)i; result *= help; } return result; } void main( void ){ Float finalResult; printf("\nIt's getting started !!!!!!!\n"); printf("...calculating the factorial of %d\n", INPUT); finalResult = factorial(INPUT); printf("\nThe result is %le.\n\n", finalResult); exit(0); }

The getIt.c program calculates and prints the factorial of the value of INPUT.

Volume 1 Getting Started

Release 5.4 - February 2010

25

NXP Semiconductors

4.3

Compiling TriMedia Applications


Use tmcc, the compiler driver, to compile TriMedia C-language applications. Each of tmcc, tmcpp, and tmCC invoke the C/C++ Front End (tmcfe), the Core Compiler (tmccom), the Scheduler (tmsched), the Assembler (tmas), and the Linker (tmld). Note: Before proceeding with this section, make sure that you have placed $TCS/bin and $TMCOMM/bin in your path, where $TMCOMM is typically $TCS/tmComm. The actual location of $TMCOMM can be confirmed by examining the variable TCOMMROOT defined in $TCS/tmconfig file. To compile for a particular target, specify the option "-target target" where target is one of the supported types specified in tmconfig file.The core type for the target is picked from the tmconfig file (tmcc supports a -core option, but its use is unnecessary when the target option is specified). The default target is PNX1500 which uses tm3260 core. For example, to build target programs for pnx8550 based on tm3260 core, the target option is:
tmcc -target pnx8550

To build target programs for pnx1500 based on tm3260 core, the target option is:
tmcc -target pnx1500

Use either of the following two examples to compile the getIt.c program, listed in Sample Program: getIt.c on page 25:

To compile the getIt.c program to run on the simulator, ttisim, enter the following command line at the DOS prompt:
tmcc -o getIt.out getIt.c

The -o option allows you to specify the output file getIt.out. The default output is a.out.

To compile the getIt.c program to run on TriMedia Processor pnx1500 hosted on a Windows XP platform, enter the following command line at the DOS prompt:
tmcc -target pnx1500 -host WinNT -o getIt.out getIt.c

In the second example, unlike the first, you must use the -host option to specify the system that hosts the TriMedia processor. If you dont use this option, the target will be compiled to run on ttisim. For more detailed information about compiling TriMedia applications, refer to: Book 3, Compilation Tools, especially Chapter 2, Using the C Compiler. Also, for more detailed information about the different techniques for generating optimized code (such as using restricted pointers, loop unrolling, profile-driven compilation, custom operators, loop optimization, and decision-tree grafting), refer to Book 4, Cookbook.

4.4

Simulating TriMedia Applications


Simulating TriMedia applications is ideal for working with inner loops. The simulator, ttisim, generates accurate cycle data that can be used to optimize each behavior. However, when speed is a concern or when you are using peripheral I/O, run your programs on a TriMedia processor.

Volume 1 Getting Started

Release 5.4 - February 2010

26

NXP Semiconductors
To simulate the getIt.out program, enter the following command line at the DOS prompt:
ttisim getIt.out

ttisim generates the following output:


It's getting started !!!!!!! ...calculating the factorial of 30... The result is 2.652529e+32.

If you want ttisim to generate performance reports, you can use certain options when compiling the getIt.c program. For more information about the simulators see Book 6, TTIsim User Manual, especially Chapter 3, Using a Standalone Simulator.

4.5

Running TriMedia Applications on the TriMedia Processor


To run the getIt.out program that you generated (in Compiling TriMedia Applications on page 26) on the TriMedia processor, enter the following command line at the DOS prompt:
tmrun getIt.out

tmrun downloads the program and runs it on the TriMedia processor. You can also use tmgmon to run programs on the TriMedia processor. To use tmgmon, do the following: 1. Enter the following command line at the DOS prompt:
tmgmon

The tmgmon window appears. 2. 3. Use the Browse button to locate the getIt.out file. Click Go.

4.6

Debugging TriMedia Applications


To debug getIt.c, do the following (under command shell in Windows): 1. Compile getIt.c using the -g and -O0 options.
tmcc -g -O0 -o getIt.out getIt.c

The -g option generates the symbolic debugging information and links the program with the debug monitor library and the -O0 option disables global optimization. 2. 3. Make sure that the directory $TMCOMM/bin is in path on Windows platform or in LD_LIBRARY_PATH on Linux platforms. Start the TriMedia Debugger:
tmdbg

4.

See the debugger documentation for details on how to debug.

Volume 1 Getting Started

Release 5.4 - February 2010

27

NXP Semiconductors
The debugger can also be loaded in command-line mode by entering tmdbg -cli. For more information, refer to the debugger documentation.

Volume 1 Getting Started

Release 5.4 - February 2010

28

Chapter 5

Troubleshooting
This chapter helps you in troubleshooting the problems that you may encounter while using the TriMedia TCS. It also contains answers to commonly asked questions.

5.1

Important Points to Remember


This section presents some points you must consider before:

setting up your hardware environment. using the new tools or demos.

The information presented here is arranged by component.

5.1.1 Device Libraries and Board Support Packages


The tmconfig file allows one to specify a Board Support Package for a given target SoC such as PNX1500 etc. To support another version of TriMedia board, please modify the BOARD_LIST line of the tmconfig file and add the relevant board support package.

5.1.2 tmcc/tmccomThe C/C++ Compiler


The most common problem anticipated is improper use of the volatile keyword. There are two main considerations. First, the volatile keyword should be used in any case where the value will be updated by other sources (processes, programs, or threads). Second, if the variable in question is a pointer to volatile storage, ensure that you have defined it as such. A common mistake is to mark the pointer as volatile, not the storage to which it points. Because this is a new compiler, it does not generate exactly the same dtrees as the 2.2 compiler. If you were relying on specific timings or dtrees, you must re-evaluate your code. The Trimedia hardware accesses types only on their natural alignment. That means if an integer load is used, the data should be 4-byte aligned. This can cause trouble in cases where a char* array is cast to an int* pointer and then dereferenced. In order to make this work you should ensure proper alignment of the char* array by dynamically allocating it (word aligned by default) or if it is a static or external array using the -Xalign option or the TCS_align pragma to force word alignment. If you are using profiling (-p) and grafting (-G) in your compilation process, please note that the options and the source given on the profiling compilation must match the options and the source given on the grafting run (with the exception of the -p or -G options). If the options are different or the source is different, the compiler will not correctly graft the code and a compiler error could be issued. tmcc now turns on the -bremoveunusedcode and -bcompact linker options by default. These options are generally advantageous, however, in some cases, -bcompact can cause a performance degradation because of a cache hit. To turn off both of these options with tmcc, you can use the nocompact option. If you use -nocompact, we recommend that you manually turn bremoveunusedcode back on by passing tmcc (or tmCC) the option string -tmld bremoveunusedcode --.

Volume 1 Getting Started

Release 5.4 - February 2010

29

NXP Semiconductors
A linker optimization called -bfoldcode can create a significant reduction in module size by removing redundant trees. You should not use this option if you have code that depends on functions with different names having different addresses. If you choose to use this function, you can turn it on by passing the following string to tmcc (or tmCC) when you link: -tmld -bfoldcode -. With the v2.1 release, the compiler has added support for 64-bit emulated long double floating point. If you plan to develop new code using this functionality or if you are porting code from an architecture that currently uses 64-bit doubles, please read the compiler section of Chapter 5. The tmcc driver passes the -generate_data_units flag to the compiler except when the -t compiler option is used. If you wish to generate a .t file with -generate_data_units, you should compile with the options: -t -tmccom -generate_data_units --.

5.1.3 PSOS+ and C++


In TCS 2.2, C++ static constructors were called by _main function which was called by main in the generated code if the file containing main was compiled as a C++ program. Therefore, in case of pSOS applications, where main was part of pSOS which was compiled as a C module, applications had to explicitly call _main after root. In TCS 4.x, _main is just a stub as C++ initialization had already happened in boot code.

5.1.4 Interrupt Service Routines


The PCI device library provides a function (pciMemoryCopy) which can be used to copy memory between SDRAM and HOST(PC) even with the PCI Memory window disabled. This function uses synchronous DMA calls that depend on the scheduler being active and cannot be called from interrupt handlers.

5.1.5 tmdbg The Debugger


The debugger cannot debug linker-optimized code. Such code includes targets compiled with any of the following linker options: -bcompact, -bfoldcode, or -bremoveunusedcode. Although tmcc does specify -bcompact and -bremoveunusedcode, by default, they are not specified if the -g option is specified. The debugger does not use source file/target time stamps. If a source file is modified after the target has been built, the debugger does not warn you that the source file is out of date. The debugger cannot debug header files. If any executable code is contained in a header file the debugger cannot break on those lines. The debugger cannot be used with the -ptm profiling option. Profile-guided compilation (the -p option) is possible with debugging.

5.1.6 tmprofThe Profiler


The tmprof in TCS is completely upward compatible from the tmprof in TCS 2.2. However, there were major changes between the tmprof in the v2.0 release and previous releases. This can lead to problems in several areas of which you should be aware. It is important that tmprof users carefully read the chapter Performance Analysis Overview in Book 4, Cook Book. The -ptm option cannot be used with programs compiled with -g. Also, the option cannot be used with the pSOS debug monitor (psosmon.o). Link errors would result.

Volume 1 Getting Started

Release 5.4 - February 2010

30

NXP Semiconductors 5.1.7 ttisimThe functional Simulator


ttisim cycle counts do not account for cache related cycles since ttisim does not simulate the cache sub-system. Further, ttisim uses the underlying operating system to implement system calls. Differences in the implementation of system calls in the underlying operating systems and differences in the underlying hardware (e.g., block size) can cause small differences in the reported simulated cycles on different execution host platforms. ttisim uses the floating point of the host machine to simulate TriMedia floating point operations. In a few special cases, the behavior of floating point operations involving NaNs and denormals under ttisim may differ from the behavior on TriMedia hardware or under ttisim on a different host platform.

5.2

Troubleshooting Common Problems Under Windows


This section can help you troubleshoot common problems that you might encounter when using the TriMedia TCS under Windows.
Table 5-1: Causes and Solutions for Common TriMedia TCS Problems Problem The error message Cannot connect to Kernel Mode Driver occurs when running TMGMon, TMRun, or TMMon. Cause No device driver has been installed for the TriMedia device or an old and incompatible version of the driver is currently installed. Solution Install the latest device driver through the appropriate .inf file. If the previous version of the driver is installed, it might be necessary to remove the TriMedia device and the existing device drivers. Close all other instances of TMRun.exe that might be running for the given TriMedia processor.

The error message TMRun: ERROR: Cannot Initialize C Run Time Server: CRT I/O calls will not work appears in the TMRun Window.

TMRun uses the C Run Time server TMCRT.dll. Only one instance of TMCRT.dll can be running for a given TriMedia processor at any time. If another instance is already running, TMRun generates the error message on the left.

Volume 1 Getting Started

Release 5.4 - February 2010

31

NXP Semiconductors

5.3

Frequently Asked Questions


Table 5-2: lists frequently asked questions and their answers.
Table 5-2: Frequently Asked Questions Question How can I automatically remove the existing TriMedia device and device drivers under Windows XP? Answer The tmmanins.exe utility can be used to achieve this. Tmmanins.exe is a dialog-based Windows application that removes the TriMedia device, TriMedia device drivers and the relevant .INF files from the system. When the user reboots the system, after running tmmanins.exe, Windows prompts the user for .INF file for the TriMedia device. tmmanins.exe runs under Windows XP.

How can I manually remove existing Removing the driver pnxXXXX.sys from the system Windows TriMedia device and device driver under XP). Windows XP? (1) Click Start, point to Programs, and then click Windows Explorer. (2) In Explorer, go to C:\Windows\ System32\Drivers directory. (3) Look for pnxXXXX.sys where XXXX is 1700 or 1500 or 1005. Click on this file to highlight it, Right Click and then Click Delete. Removing all the INF files containing the string "tmman" from the system Windows XP. Click Start, point to Programs, and then click Windows Explorer. In Explorer, go to c:\WINNT\INF directory In Explorer, Click on View, Click on (Folder Options / Options), Click on View Tab, Click on Hidden Files, Click on Show All Files, Click OK button. In Explorer, Click on Tool, Click on Find, Click on Files or Folders, Find dialog box pops up. In the Containing Text edit box type "tmman" (without the quotes). Click on Find Now. Files containing the string will be displayed. Click on each file to highlight it, Right Click and then Click Delete. How can I manually remove existing Removing the hardware device instance from the system. TriMedia device and device driver under (1)Right click My Computer. Windows XP? Continued (2)Click Properties. (3)Click the Device Manager tab. (4)Double-click a device type (Other Devices/Sound, Video and Game Controllers). (5)Click the TriMedia Device (PCI Multimedia Device/TriMedia NREF Board). (6)Click Remove. A Confirm Device Removal dialog box appears. (7)Click OK. Note: after these steps when the system is rebooted Windows Plug and Play will re-detect the device and ask for the INF file and the device driver again.

Volume 1 Getting Started

Release 5.4 - February 2010

32

NXP Semiconductors
Table 5-2: Frequently Asked Questions (Continued) Question How can I determine if the device drivers are installed for the TriMedia device under Windows XP? Answer Follow the steps below to determine if proper device drivers are installed in the system that has the TriMedia device installed. (1)Right Click My Computer, click Properties, click Device Manager tab. (2)Double-click a Other Devices, to see the devices in that category. If this category is not present then go to step 4. (3)If the PCI Multimedia Device entry is present then there are NO drivers installed for that device. Goto step 6. (4)Double-click on Sound / Video and Game Controllers, to see the devices in that category. (5)If the TriMedia Board entry is present, then device drivers are installed in the system. (6)Click on OK. How to find the version information for TriMedia Device Driver Files? (1)Click Start, point to Programs, and then click Windows Explorer. (2)In Explorer RIGHT click on any TriMedia Device Driver file i.e tmman.sys, tmman32.dll, tmmon.exe, tmrun.exe, tmcrt.dll etc. (3)Click on Properties, Properties dialog box pops up. (4)Click on the Version tab (5)File Version field indicates the version of the executable. What files are required to setup the hosted execution environment under Windows XP? The following common files are required to setup an environment to run TriMedia executables on a TriMedia board. TMMon.exe TMGMon.exe TMRun.exe TMMPRun.exe TMMan32.dll TMCRT.dll AuthHost.dll *.inf *.sys

Volume 1 Getting Started

Release 5.4 - February 2010

33

NXP Semiconductors

Volume 1 Getting Started

Release 5.4 - February 2010

34

Chapter 6

Migration
This chapter is primarily intended to aid users migrating from TCS 2.2 to TCS 4.x. This chapter can also be used as a short overview of the differences between the version 2 and version 4 products.

6.1

tmcc/tmccom C/C++ Compiler


6.1.1 Compiling for different targets
To compile for a particular target, specify the option "-target target" where target is one of the supported types specified in tmconfig file.The core type for the target is picked from the tmconfig file (tmcc supports a -core option, but its use is unnecessary when the target option is specified). The default target is tm1 which uses tm32 core. For example, to build target programs for tm3282 core based systems to run on a tm3282 minimal system, the target option is:
tmcc -target tm3282Minimal

6.1.2 64 bit Floating Point Emulation


TCS releases v2.2 and later include a new tmcc option -fp64. Previously, TCS represented C types float, double and long double using IEEE single precision format (32 bits), and the C/ C++ compiler generated TriMedia hardware floating point operations for all floating point arithmetic. With -fp64, TCS still represents C type float using IEEE single precision format (32 bits), but it represents C types double and long double using IEEE double precision format (64 bits). Since the tm32 architecture does not provide 64 bit floating point instructions, double precision floating point operations are supported via a software emulation library. Thus, double and long double operations are more accurate, but considerably slower than the corresponding float operations. NOTE: Because the sizes of double and long double types are different with the -fp64 option, the TCS distribution includes two separate versions of the standard C library and tmcc links with the appropriate version based on the presence of the -fp64 option. Mixing object files compiled with and without the -fp64 option yields undefined results. The standard C library normally defines only double versions of the standard <math.h> mathematics library functions, such as:
extern double cos(double d);

For users who do not require the additional precision, the -fp64 version of the standard C library also defines corresponding single precision routines, such as:
extern float _f_cos(float d);

The elegance of the -fp64 option is the transparency for the user. In contrast to the scheme used in v2.1 of the TCS, code written using double can be compiled out-of-the-box with either 32 bit precision or 64 bit precision based on the need for speed or precision; no initial special porting is necessary. If the -fp64 option is not specified, the default will be 32bit precision for all floating point calculations (-fp32). If an application developer compiling with -fp64 wishes to do some single precision (i.e., C type float) arithmetic on hardware to aid in performance, the floating point code must be written with care. In addition to using the floating point specific functions mentioned above, users should note

Volume 1 Getting Started

Release 5.4 - February 2010

35

NXP Semiconductors
that unsuffixed floating point constants are of type double, not float; floating point constants suffixed with F (e.g. 1.234F) are of type float. If you neglect to put the F suffix on constants that you intend to be single precision you could unintentionally use the 64bit floating point emulation library.

6.1.3 64 bit Integers


Releases v4.0 and later of the TCS allow the use of C type long long (C9X extension). If possible, operations are mapped into native instructions. If not possible, an emulation function is called. For tm32, most operations are mapped into a sequence of native operations; division, modulus and shifts are emulated by function calls. No option needs to be passed to tmcc to recognize long long.

6.1.4 Struct Packing and Specifying Unaligned Data


TCS release v3.0 and later allow user-defined struct packing and unaligned loads and stores. Structure packing is supported by a special pragma, pack. The syntax is:
#pragma pack(n) #pragma pack()

where n is the maximum alignment that may be assigned to any nonstatic data member (even if it is less than the normal alignment for the members type). If n is omitted, the pack alignment effectively reverts to the default value. The fields in the struct that have a smaller alignment than their natural alignment are marked as unaligned and special unaligned load and stores are generated (unaligned loads and stores are not supported by the tm32 architecture and thus must be expanded by the compiler into loads and stores of portions of the elements). For instance, a load of an int field in a struct subject to a #pragma pack(1) is expanded into 4 byte loads, which are combined to construct the 32-byte integer. It is also possible to use the __unaligned qualifier to signify that a variable should be treated as unaligned. For instance:
extern int __unaligned *packed_struct_field;

This marks the contents of the pointer as unaligned integer data, generating appropriate loads and stores when dereferencing the pointer.

6.1.5 Stricter Aliasing


When a program uses pointers, the compiler uses certain rules to determine where those pointers could be pointing. With the v4.x, the compiler by default conforms to the ANSI defined rules, which basically focus on pointers only pointing at objects of the same type as the object they are declared to point to. This assumption enables the compiler to do more optimization. A program that does not conform to the ANSI defined rules that produced certain results with previous versions of the compiler may thus produce different results with the v4.0F compiler. These new alias restrictions can be disabled in the v4.0F compiler (to produce the behavior of previous compiler versions) using one or both of the following options:
-tmccom -ignore_alias_types --tmccom -ignore_alias_sizes --

Do not apply ANSI aliasing rules for types that have the same size. Must be used with -ignore_alias_types. Do not apply ANSI aliasing rules.

Volume 1 Getting Started

Release 5.4 - February 2010

36

NXP Semiconductors 6.1.6 Other Compiler Enhancements


With v4.x comes a number of other compiler enhancements, as follows:

The scope of the TCS_unroll pragma has been changed so that it now only applies to the loop following its use. Code using the TCS_unroll pragma no longer has to reset the TCS_unroll value after the loop. With v4.x, the compiler automatically generates guarded code for sufficiently simple if conditions.

6.1.7 Better C++ Support

Iterator classes now support the operator->() functions as described by the C++ ISO standard.

6.1.8 New Versioning Macros


The predefined macro __TCS_V2__ has been replaced with a more general mechanism, __TCS_VERSION__. For v4.5, the value of __TCS_VERSION__ is 450. tmcc supplies D__TCS_VERSION__450 to the compiler front end. In v2.2 this macro was also defined as D__TCS_VERSION=220. These macros allow the user to write comparisons in code that are good for several releases. e.g. if (__TCS_VERSION__ >=220) would be true for 2.2 and all following releases.

6.1.9 List of New Options in tmcc

-noloadspec: Do not speculate loads; this option is a more general implementation of the tmsched option -noloadspec, which also inhibits the compiler from speculating

loads. Using this option will signal tmcfe, tmccom, and tmsched not to speculate loads.

-fp64: Use double precision floating point emulation (see the detailed description

above).

-graph=<dtree>: This option generates a graph.dot file that contains the dependency graph for the given function. The results of this option can be displayed using the dot tool found at http://www.research.att.com/sw/tools/graphviz/. -allow_atomic_calls: This option allows functions that have the TCS_atomic pragma

to call other functions. It is the responsibility of the programmer to ensure that any function called from an atomic function is also an atomic function.

-dirty_float: Specify the amount of optimization that should occur for floating point

numbers.

6.2

tmld - Linker

The -el and -eb options are no longer supported for tmld (but are still used for tmcc). tmld now reads its endian information directly from the object file. -bcompact_lookahead <n> and -bcompact_lookbehind <n>: These new options are used in conjunction with the -bcompact option to provide greater control over its operation. The -bcompact option attempts to reduce the size of the executable, by avoiding padding, but in doing so may adversely impact performance by placing together unrelated program functionality. These new options parameterize the compaction algorithm to allow a user to lessen the chance that unrelated functionality will be placed together by paying particular attention to the dtrees adjacent to the last dtree assigned an

Volume 1 Getting Started

Release 5.4 - February 2010

37

NXP Semiconductors
address during compacting. The default values for lookahead and lookbehind are 8 and 1, respectively, when the -bcompact option is specified. A user may try different values for lookahead and lookbehind to strike the desired balance between performance and code size. Note that using a lookahead value of 1 and a lookbehind value of 0 will produce the behavior of the -bcompact option in previous releases.

6.3

Machine Description File Incompatibility Note


The low-level machine description file format has been enhanced. This has led to backward compatibility being broken. This means that tools from the v4.0F release will not work with machine description files from previous releases and vice versa. This should have no impact on the ordinary user.

6.4

tmman Execution Hosts


This release supports tmman on Windows XP for pnx1005, pnx1500, pnx1700 and pnx8550 processors.

6.5

Device Libraries
The release includes all tm1 device libraries and core device libraries for the other supported targets. Since multiple targets are supported, any include path like tm1/... needs to be changed to .... tmcc will automatically include the correct path depending on the target specified.

6.6

Changes in Include and Library Paths


Library locations have been re-organized to support different architectures. You may have to modify pathnames in your Makefiles to match these new locations, e.g.:
$(TCS)/lib/$(ENDIAN)/libz.a

is now at
$(TCS)/lib/$(CORE)/$(ENDIAN)/$(FP)/libz.a

Similarly
$(TCS)/lib/$(ENDIAN)/libdev.a

is now at
$(LIBDEV)/lib/$(CORE)/$(TARGET)/$(ENDIAN)/$(FP)/libdev.a

The source files also should be modified as they might have tm1 in the include path, e.g..:
#include <tm1/*.h>

All the tm1s in the include path should be replaced to


#include <*.h>

With the separation of host communication from TCS, some header files have moved from $TCS/ tmlib to $TCOMMROOT/include. So it would be necessary to replace "tmlib/*.h" to "*..h" for such files. The directory $TCOMMROOT/include will be added to the include path automatically.

6.6.1 Custom Ops Header Files Location


The location of ops.h and fops.h has been changed from $TCS/include/ops to $TCS/ include/cores/$CORE/ops.

Volume 1 Getting Started

Release 5.4 - February 2010

38

NXP Semiconductors

6.7

Cache Device Library


A new cache device library has been added and the function prototypes are defined in the header file $LIBDEV/include/$TMTARGET/tmCache.h. Use the new functions tmCacheDataCopyBack and tmCacheInvalidateData instead of _cache_copyback and _cache_invalidate respectively. However, for backward compatibility, the old functions have been retained. Previously, _cache_copyback and _cache_invalidate were declared in $TCS/tmlib/tmlibc.h, but now they are declared in $LIBDEV/include/$TMTARGET/tmCache.h. Therefore, if prototype checking is needed, application code must include tmCache.h. In order to compile the code for both TCS 2.2 and TCS 4.1, the file can be included as follows:
#if defined(__TCS_VERSION__) #if (__TCS_VERSION__ >= 410) include "tmCache.h" #endif #endif

6.8

Migrating from tmsim to TTIsim Simulators


Starting with TCS 5.3, TCS releases do not contain tmsim anymore. TTIsim is a new simulation system, and its simulators are not backward compatible with tmsim. The decision not to be backward compatible with tmsim allows a clearer and more flexible interface suitable for supporting many different cores and system configurations. Customers using the TM1xxx cores from NXP should continue to use tmsim. TTIsim simulators all use a uniform invocation syntax and command line interface (CLI). If you have scripts that invoke tmsim or batch (control) files for tmsim, you will need to make some changes. Once migration is complete, your scripts and batch files will work for all TTIsim simulators, regardless of core or system configuration, so you will not need to migrate again when you move to future TTI cores. Please refer to the TTIsim user manual for details of the invocation switches (options) and CLI commands. Some areas to watch in particular (not an exhaustive list): TTIsim simulators do not simulate any of the TM1xxx peripherals. Options and commands relating to them have no equivalents in TTIsim. The -memorysize(ms) option of tmsim expects its argument in Kbytes. In TTIsim the argument is in bytes. It is easier to relate memory size to memory base and top. TTIsim will warn if -memorysize(ms) has an argument <= 65536. The undocumented tmsim option -mmiobase(ib) is replaced by -mmiobase(mmb) (only the short form is different). The -memorymodel(mm) option of tmsim does not exist. This is the default with TTIsim, as it is with tmsim. Scripts should remove this option. The -nomemorymodel(nomm) option requires no change. The -eb and -el options that control endianness do not exist in TTIsim. The endianness is obtained from the target program executable (set by the tmld) and should be set in the PCSW by the target program (else the architectural default of the particular core applies). The -cycles1(c1) and -cycles2(c2) options should be replaced by -cycleinterval(ci) and cyclelimit(cl) respectively. It is not necessary to turn on -verbose(v) for these to take effect.

Volume 1 Getting Started

Release 5.4 - February 2010

39

NXP Semiconductors
TTIsim by default reports the cycle count at the end of the program, and gives some other pieces of information at the beginning. There is no need to specify -t to obtain the cycle count (this option does not exist in TTIsim). To suppress informational messages (and warnings) so that non-error output from the simulator is purely target program output, use -quiet(q). TTIsim provides a -bootfile(boot) switch that causes the simulated boot block to read its boot parameters from a file. The boot parameters are pairs of MMIO addresses and values, written to the core(s) by the boot block during the reset protocol. This is useful for controlling aperture settings in one or more cores, and should be used instead of several undocumented options in tmsim. Please see the user manual for details. tmsim batch (control) files are not compatible with TTIsim because the command line interface (CLI) is different. TTIsim provides most of the same functionality with a more flexible and uniform syntax and more options for controlling output. Batch files need to be converted. For interactive convenience, a few common tmsim commands are silently recognized by TTIsim, and many commands are backward compatible. It is recommended that batch files be fully converted. Please see the user manual for details. TTIsim batch files do not need to begin with a line containing only the word control. They are simply lists of CLI commands, one per line. Since control is not a recognized CLI command, TTIsim will complain if it is encountered. This will alert you that you need to migrate your batch files.

6.9

Loading of Dynamic Applications via appshell.out


In TCS 2.x, when a -btype app executable was specified as the executable name in the run tools tmrun, tmgmon, and ttisim, the executable appshell.out was loaded implicitly either from the current directory or from $TCS/lib/$ENDIAN/$HOST and the -btype app executable was provided as an argument to it. In the case of tmrun, tmmon and tmgmon, TCS path needed to be specified in the registry. Multiple targets are supported in TCS 4.x, so it is no longer possible to have a single version of appshell.out for a given endianness and host which will support all targets. Therefore, in TCS 4.x, implicit loading of appshell.out is not supported. If you want to load -btype app executables from these tools, specify appshell.out for the intended target, and specify the btype app executable as the argument to appshell.out. For example,
tmrun path\appshell.out myapp.app

For displaying trace messages while loading, specify the -trace option to appshell.out. For example,
tmrun path\appshell.out -trace myapp.app

If a -btype app executable is provided directly to the run tools, then an error message will be displayed saying that a dynamic application must be loaded via appshell.out.

6.10

Windows Registry Settings for tmman


TCS 4.x uses different locations of registry for the kernel level tmman driver and the user mode driver and tools. The Windows XP tmman kernel level drivers now read entries from
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

while user mode tmman drivers and tools read entries from
HKEY_LOCAL_MACHINE\SOFTWARE\NXPSemiconductors\TMMan.

Volume 1 Getting Started

Release 5.4 - February 2010

40

NXP Semiconductors
This change was necessary as Windows XP kernel driver cannot read entries from
HKEY_LOCAL_MACHINE\SOFTWARE\NXPSemiconductors\TMMan.

6.11

tmdbg - Debugger
You must compile your application using TCS 4.x compiler to use the new debugger. The debugger has a new interface and look and feel. Since the debugger itself does not have any builtin knowledge about the communication channel, it must be specified by the user. In the Load Target dialog, there is a new option to specify the communication channel (commType) and communication method (commMethod) used. For example, if the program is built for host=WinNT, select PCI for commType and commMethod. For simulator hosts, select sim as the commType and appropriate simulator such as tm3260sim, tm2270sim as the commMethod.

Volume 1 Getting Started

Release 5.4 - February 2010

41

NXP Semiconductors

Volume 1 Getting Started

Release 5.4 - February 2010

42

Contents

Chapter 1 Overview of the TriMedia System


1.1
1.1.1 1.1.2 1.1.3

TriMedia VLIW Architecture 3


Functional Unit Assignment 3 What Makes TriMedias VLIW Architecture Better 4 Performance 4

1.2
1.2.1 1.2.1.1 1.2.1.2 1.2.1.3 1.2.1.4

TriMedia Compilation and Simulation System (TCS) 5


TriMedia Tools 6 Execution Tools 6 System Tools 7 Performance Analysis and Enhancement Tools 7 Machine-Level Simulator 8

1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7

Navigation and Visualization 8 Report Generation 9 Design space exploration 9 Automatic Updates 9 Eclipse TriMedia target control plugins 9 Eclipse Debugger 10 Eclipse setup 11

1.4
1.4.1 1.4.2

PNX85500 Support 11
Compilation 11 Simulation 12

1.5
1.5.1 1.5.2 1.5.2.1

Platform support 13
Linux 13 Windows 13 .Net 2005 13

1.3

Eclipse IDE for TriMedia Tools 8

Chapter 2 Installing TriMedia TCS Tools


2.1
2.1.1 2.1.2

Introduction 15
Supported PC Build Hosts 15 Supported PC Execution Hosts 15

2.2.1.2 2.2.1.3 2.2.1.4

2.2
2.2.1 2.2.1.1

Installing TriMedia TCS tools 15


Windows Installation 16 Using the Setup Program 16

Choosing the Location of the Installation Folder 17 A Note on Installation Requirements For the TriMedia Debugger 20 Installation of Updates 21

2.3
2.3.1 2.3.2

Eclipse 21
Welcome Screen 21 On-line Help 22

Chapter 3 Running Demonstration Programs


3.1 Introduction 23 3.2 Running the Files Program 23

Chapter 4 Using TriMedia TCS Tools


4.1 4.2 4.3 Introduction 25 Sample Program: getIt.c 25 Compiling TriMedia Applications 26 4.4 4.5 4.6 Simulating TriMedia Applications 26 Running TriMedia Applications on the TriMedia Processor 27 Debugging TriMedia Applications 27

Chapter 5 Troubleshooting
5.1
5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6

Important Points to Remember 29


Device Libraries and Board Support Packages 29 tmcc/tmccomThe C/C++ Compiler 29 PSOS+ and C++ 30 Interrupt Service Routines 30 tmdbg The Debugger 30 tmprofThe Profiler 30

5.1.7

ttisimThe functional Simulator 31

5.2 5.3

Troubleshooting Common Problems Under Windows 31 Frequently Asked Questions 32

Volume 1 Getting Started

Release 5.4 - February 2010

43

NXP Semiconductors
Chapter 6 Migration
6.1
6.1.1 6.1.2 6.1.3 6.1.4 6.1.5 6.1.6 6.1.7 6.1.8 6.1.9

Contents

tmcc/tmccom C/C++ Compiler 35


Compiling for different targets 35 64 bit Floating Point Emulation 35 64 bit Integers 36 Struct Packing and Specifying Unaligned Data 36 Stricter Aliasing 36 Other Compiler Enhancements 37 Better C++ Support 37 New Versioning Macros 37 List of New Options in tmcc 37

6.4 6.5 6.6


6.6.1

tmman Execution Hosts 38 Device Libraries 38 Changes in Include and Library Paths 38
Custom Ops Header Files Location 38

6.7 6.8 6.9 6.10 6.11

6.2 6.3

tmld - Linker 37 Machine Description File Incompatibility Note 38

Cache Device Library 39 Migrating from tmsim to TTIsim Simulators 39 Loading of Dynamic Applications via appshell.out 40 Windows Registry Settings for tmman 40 tmdbg - Debugger 41

Volume 1 Getting Started

Release 5.4 - February 2010

44

You might also like