01 Getting Started
01 Getting Started
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
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.
2
3 3
3
3 3
4
3 3 3
5
3 3 3
5 5 2
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.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.
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
Code Profiling TriMedia Multimedia Libraries Independent Software Vendors (ISVs) Customer-developed Optimization Tools Reporting
Simulator
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))
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
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
1.2.1.1
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.
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.
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
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
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.
NXP Semiconductors
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.
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.
10
* 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
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)
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
[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
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.
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.
14
Chapter 2
2.2
15
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.
17
NXP Semiconductors
4. Type the name of the installation folder in the Path field.
5. 6.
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.
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.
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.
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.
21
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.
22
Chapter 3
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
23
NXP Semiconductors
24
Chapter 4
4.2
#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.
25
NXP Semiconductors
4.3
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
26
NXP Semiconductors
To simulate the getIt.out program, enter the following command line at the DOS prompt:
ttisim getIt.out
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
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
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.
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.
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
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 --.
30
5.2
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.
31
NXP Semiconductors
5.3
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.
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
33
NXP Semiconductors
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
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
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.
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.
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.
36
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.
Iterator classes now support the operator->() functions as described by the C++ ISO standard.
-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
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
6.4
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
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>
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.
38
NXP Semiconductors
6.7
6.8
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
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
while user mode tmman drivers and tools read entries from
HKEY_LOCAL_MACHINE\SOFTWARE\NXPSemiconductors\TMMan.
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.
41
NXP Semiconductors
42
Contents
1.2
1.2.1 1.2.1.1 1.2.1.2 1.2.1.3 1.2.1.4
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
Introduction 15
Supported PC Build Hosts 15 Supported PC Execution Hosts 15
2.2
2.2.1 2.2.1.1
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 5 Troubleshooting
5.1
5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6
5.1.7
5.2 5.3
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
tmman Execution Hosts 38 Device Libraries 38 Changes in Include and Library Paths 38
Custom Ops Header Files Location 38
6.2 6.3
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
44