Page 2
Running Title—Attribute Reference IMPORTANT NOTICE Texas Instruments (TI) reserves the right to make changes to its products or to discontinue any semiconductor product or service without notice, and advises its customers to obtain the latest version of relevant information to verify, before placing orders, that the information being relied on is current.
Page 3
Preface Read This First About This Manual This book describes the DSP (digital signal processing) Starter Kit (DSK) and how to use the DSK with these tools: The DSK assembler The DSK debugger How to Use This Manual The goal of this book is to help you learn how to use the DSK assembler and debugger.
Page 4
Notational Conventions Part IV: Debugger Description contains detailed information about using the debugger. Chapter 7 explains how to invoke the DSK debugger, and use its function keys, and debugger commands. Part V: Appendices contains a description of the communications kernel source code, the DSK circuit board dimensions and schematic diagrams, the data sheet of the TLC32040 that provides all specifications of the ana- log interface circuit, and a glossary.
Page 5
Notational Conventions/Information About Warnings In assembler syntax statements, column 1 is reserved for the first charac- ter of a label or symbol. If the label or symbol is optional , it is usually not shown. If it is a required parameter, it is shown starting against the left mar- gin of the shaded box, as in the example below.
Page 6
Related Documentation From Texas Instruments The following books describe the TMS320C3x and related support tools. To obtain a copy of any of these TI documents, call the Texas Instruments Litera- ture Response Center at (800) 477–8924. When ordering, please identify the book by its title and literature number.
Page 7
If You Need Assistance If You Need Assistance . . . If you want to . . . Contact Texas Instruments at . . . Visit TI online World Wide Web: http://www.ti.com Receive general information World Wide Web: http://www.ti.com/sc/docs/pic/home.htm or assistance North America, South America: (214) 644–5580...
Page 8
Trademarks Trademarks AT is a trademark of International Business Machines Corp. IBM, PC, and PC-DOS are trademarks of International Business Machines Corp. MS-DOS is a registered trademark of Microsoft Corporation. Windows is a trademark of Microsoft Corporation. OS/2 is a trademark of International Business Machines Corp. viii...
Page 11
Contents Directives That Initialize Constants ..........Directives That Reference Other Files .
Page 12
Running Title—Attribute Reference Figures 1–1 TMS320C3x DSK Block Diagram ..........2–1 Connecting Your Parallel Printer Port Cable and Transformer Into Your DSK Board .
Chapter 1 Introduction This chapter provides an overview of the TMS320C3x DSP Starter Kit (DSK). The ’C3x DSK is a low-cost, simple, high-performance stand-alone application development board that lets you experiment with and use TMS320C3x DSPs for real-time signal processing. The DSK has a TMS320C31 on board to allow full-speed verification of the TMS320C3x code.
Key Features of the DSK 1.1 Key Features of the DSK This section details the key features of the TMS320C3x DSP Starter Kit. Industry-standard TMS320C31 floating-point DSP 40-ns instruction cycle time, 50 MFLOPS, 25 MIPS Standard or enhanced parallel printer port interface which connects to a host PC and allows the TMS320C31 to communicate with PC programs Analog data acquisition via the TLC32040 analog interface circuit (AIC ): Variable rate analog-to-digital converter (ADC) and digital-to-analog...
DSK Overview 1.2 DSK Overview Figure 1–1 depicts the block diagram of the TMS320C3x DSK hardware. The basic components are the TMS320C31 DSP, the TLC32040 AIC, expansion connectors, system clock, parallel printer port interface, and tri-color LED. The parallel printer port connects the DSK to a host PC and allows the TMS320C31 to communicate with PC programs.
Chapter 2 Installing the DSK Assembler and Debugger This chapter describes how to install the DSP Starter Kit (DSK) on a PC system running under DOS . Topic Page What You Need ..........Step 1: Connecting the DSK to Your PC .
What You Need 2.1 What You Need The following checklists detail items that are shipped with the DSK assembler and debugger and any additional items you’ll need to use this tool. The DSK module connections with a parallel printer port are also discussed in this sec- tion.
What You Need Board DSK circuit board Cable Pass-through parallel printer port cable Optional hardware An EGA- or VGA-compatible graphics display card and monitor. Miscellaneous Blank, formatted disks materials Software checklist Operating system MS-DOS or PC-DOS (version 5.0 or later), Windows OS/2 Files dsk3a.exe is an executable file for the DSK assembler.
Step 1: Connecting the DSK to Your PC 2.2 Step 1: Connecting the DSK to Your PC Follow these steps to connect your DSK board to your PC: 1) Turn off your PC’s power. 2) Connect your parallel printer port cable to the parallel communication port (LPT) on your PC.
Step 2: Installing the DSK Software / Step 3: Modifying Your config.sys File 2.3 Step 2: Installing the DSK Software This section explains how to install the debugger software on a hard disk sys- tem. 1) Make a backup copy of the product disk. (If necessary, refer to the DOS manual that came with your computer).
Step 4: Modifying the PATH Statement 2.5 Step 4: Modifying the PATH Statement To ensure that your debugger and assembler are invoked from any directory in your PC, you must modify the PATH statement to identify the dsktools direc- tory. Not only must you do this before you invoke the debugger for the first time, you must do it any time you power up or reboot your PC .
Step 5: Verifying the Installation If you see a display similar the one shown in Figure 2–3, you have correctly installed your DSK board, assembler, and debugger. If you see the display shown in Example 2–1, then your software or cable may not be installed prop- erly.
Page 27
Step 5: Verifying the Installation Example 2–1.Port Selection Display TESTING TMS320C3x DSK RESET AT PORT 0x378 (LPT1) >>>> HPACK (ERROR pin) did not go high during reset SELECT: 1) LPT1 0x378 (alternate LPT2) 2) LPT2 0x278 (alternate LPT3) 3) LPT3 0x3BC (alternate LPT1) H) Additional online help CHECK: TARGET POWER (LED IS RED OR GREEN)
Chapter 3 Overview of a Code Development and Debugging System The DSP Starter Kit (DSK) lets you experiment with, and use a DSP for real- time signal processing. The DSK gives you the freedom to create your own software to run on the board as is, or to build new boards and expand the sys- tem in any number of ways.
Description of the DSK Assembler / Description of the DSK Debugger 3.1 Description of the DSK Assembler The DSK assembler is a simple and easy to use tool. Only the most significant features of an assembler have been incorporated. However, if you want, you can create and load COFF files by using the TMS320 floating-point DSP as- sembly language tools that will also load and run on the DSK.
Developing Code for the DSK 3.3 Developing Code for the DSK Figure 3–2 illustrates the DSK code development flow. Figure 3–2. DSK Software Development Flow assembler source assembler executable debugger file target system The following list describes the tools shown in Figure 3–2. The assembler translates DSK assembly language source files into machine assembler language object files for the TMS320C3x family of processors.
Getting Started 3.4 Getting Started This section provides a quick walkthrough so that you can get started without reading the entire user’s guide. These examples show the most common methods for invoking the assembler and debugger. 1) Create a source file to use for the walkthrough; call it rand.asm. You do not need to enter the information following a semicolon;...
Getting Started 2) Enter the following command to assemble rand.asm: dsk3a rand This command invokes the TMS320C3x DSK assembler. If the input file extension is .asm (for example, rand.asm), you don’t have to specify the extension; the assembler uses .asm as the default. For more information about invoking the assembler, refer to Section 5.6, Assembling Your Pro- gram , on page 5-15.
Chapter 4 Functional Overview The TMS320C3x DSK hardware and software work together to create a low- cost development platform that lets you develop real-time signal processing applications. In addition to performing full-speed verification of your TMS320C3x code, the DSK has expansion headers that allow you to build new daughterboards to expand your system.
DSK Hardware Interface 4.1 DSK Hardware Interface The ’C3x DSK starts up by responding to a host reset command and bootload- ing a communications kernel or a program that you supply. The communica- tions kernel provides the necessary I/O for interfacing the DSK board and the host system.
DSK Hardware Interface Host communications The host communicates with the ’C31 through the parallel printer port. The PC manipulates the parallel port’s signals by writing to and reading from the host’s parallel port control and status registers. Figure 4–2 and Figure 4–3 show the parallel port control and status register bit fields used by the DSK host soft- ware.
Page 39
DSK Hardware Interface 4) The host drives the HPSTB signal high, indicating to the ’C31 that the data is ready. The PAL detects the rising edge of HPSTB and drives the ’C31’s READY signal low, unlocking (freeing) the locked-bus access, and con- cluding the ’C31 read cycle.
Page 40
DSK Hardware Interface TLC32040 AIC hardware interface The TLC32040 analog interface circuit (AIC) on the DSK provides: A single-channel, input/output, analog interface with 14-bit dynamic range ADC and DAC Variable ADC and DAC sampling rate with 14-bit precision at 20 000 sam- ples per second Output reconstruction filter Bypassable, switched-capacitor, antialiasing input filter...
DSK Hardware Interface DSK memory map Because host communications occur through the ’C31 parallel bus, the PAL decodes the address of the ’C31 to determine when it is accessing the host interface according to the memory map shown in Figure 4–4. Figure 4–4.
DSK Communications Kernel 4.2 DSK Communications Kernel Upon reset, the host downloads a communications kernel to the ’C31 using the bootloader. This communications kernel provides a set of low-level routines that allow the host and the ’C31 to exchange information and perform debug- ging functions.
Page 43
DSK Communications Kernel Commands When the ’C31 receives an interrupt from the host (INT2), the ’C31 saves the current state of the CPU and then receives a packet. Once the ’C31 receives the packet, the communications kernel analyzes the command entry in the header to direct the handling of the packet.
Page 44
DSK Communications Kernel Debugging functions Several debugging functions are implemented within the communications ker- nel by building upon the low-level communications commands. The kernel’s debugging functions can execute as a background task that is integrated into the system. Debugging does not halt the system, but allows concurrent execu- tion of other tasks.
Page 45
DSK Communications Kernel Interrupts The communications kernel implements breakpoints by replacing the code at the desired location with a TRAPn opcode. When the CPU encounters a TRAP, the context-save routine is invoked, the CPU enters spin mode, writes an acknowledge to the host, and waits for a new command. While in spin mode, the CPU can receive new interrupts.
DSK Communications Kernel Figure 4–6. Single-Step Flow Diagram Context restore @_PC,R5 return to PC from TOS return CINT2,IF Clear/Poll INT2 before SSTEP or RUNF 4,IF Set XINIT1 interrupt tstb $–3 @_ST,ST restore Status ldiu 2000h,ST turn on INT’s @_R5,R5 @_DP,DP restore DP ldiu Fetch one user...
DSK Communications Kernel Table 4–1. Single-Step Pipeline Flow Cycle Description Fetch Decode Read Execute BUD R5 or 2000h,ST BUD R5 ldi @_R5, or 2000h,ST BUD R5 ldp @_DP,DP ldi @_R5,R5 or 2000h,ST BUD R5 Set global interrupt enable USER1 ldp @_DP,DP ldi @_R5,R5 or 2000h,ST Interrupt recognized...
Page 48
TLC32040 AIC Initialization 4.3 TLC32040 AIC Initialization To use the TLC32040 analog interface circuit (AIC), you must follow a se- quence of steps to initialize and set up the ’C31’s timer and serial port, and to reset and program the AIC. The following subsections describe this process. Resetting the AIC As shown in Figure 4–1, page 4-3, the ’C31’s XF0 signal is connected to the RESET signal of the AIC.
Page 49
TLC32040 AIC Initialization Maximum Timer Period Register Value. The AIC’s minimum master clock frequency is 75 kHz. Taking into account the ’C31 maximum timer frequency of 12.5 MHz and the AIC’s minimum master clock frequency, the ’C31’s timer counter register maximum value should be 165 (12.5 MHz / 75 kHz = 166.7).
Page 50
TLC32040 AIC Initialization The ’C31 assembly code in Example 4–1 initializes the serial port global con- trol register (SGCR0) in the following manner: Issuing transmit and receive resets Enabling receive and transmit interrupts Setting 16-bit receive and transmit transfers Setting FSX and FSR, CLKX and CLKR active low Setting continuous mode Setting variable data rate transfers: Example 4–1.Initialize the Serial Port Global Control Register...
TLC32040 AIC Initialization To ensure that the switched-capacitor lowpass and bandpass filters meet their transfer function characteristics, the frequency of the clock inputs of the switched-capacitor filter must be 288 kHz; otherwise, the upper and lower cut- off frequencies of the low-pass and band-pass are scaled accordingly. Equation 4–2 shows the switched capacitor filter frequency, Equation 4–2.
TLC32040 AIC Initialization Figure 4–9 describes the control register bit fields. Figure 4–9. Control Register Bit Fields Loopback Bandpass Input Gain Transmit/Receive AUX IN Pins Function Filter " 0 0 = 1X for 6V analog input 0 = asynchronous 0 = disables 0 = disables 0 = deletes "...
Page 54
TLC32040 AIC Initialization Example 4–2.Setting the TA and TB Registers ;––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– ; LOOPAIC.ASM is an example program which shows how to initialize and use ; the TLC32040. The analog output (DAC output) is either a ramp signal ; (RAMPEN=1) or a loopback of the analog input (RAMPEN=0). ;–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––...
Page 55
TLC32040 AIC Initialization Example 4–2.Setting the TA and TB Registers (Continued) ;**************************************************** ; Begin main code loop here ;**************************************************** main GIE,ST ; Turn on INTS 0x34,IE ; Enable XINT/RINT/INT2 main ; Do it again! ;––––––––––––––––––––––––––––––– DAC2 push ; DAC Interrupt service routine push RAMPEN ;...
Page 56
TLC32040 AIC Initialization Example 4–2.Setting the TA and TB Registers (Continued) ;======================================================; ; This section of code initializes the AIC ;======================================================; AIC_INIT 0x10,IE ; Enable only XINT interrupt andn 0x34,IF 0,R0 R0,@S0_xdata RPTS 0x040 2,IOF ; XF0=0 resets AIC rpts 0x40 6,IOF ;...
Page 57
Host Software 4.4 Host Software The DSK software includes several source-code files that manipulate the par- allel printer port and perform the necessary functions to initialize and commu- nicate with the ’C31. The commands in each of the source-code files are sum- marized in the following subsections.
Page 58
getmem, putmem Host Software Host communications target routines The communications kernel resident in the ’C31 assumes that data transfers to and from the host are organized into packets as shown in Figure 4–5 on page 4-8. The target.cpp file includes routines that manipulate data transmis- sions between the host and the ’C31 into this packet structure.
Page 59
SSTEP_CPU, RUN_CPU, HALT_CPU Host Software Single-Step Command SSTEP_CPU Syntax MSGS SSTEP_CPU (void) Description The SSTEP_CPU routine single-steps one instruction by restoring the context of the CPU, executing one instruction, and then saving the CPU context. This command places the CPU in command mode. Arguments None Return Value...
Page 60
GET_DEBUG_CTXT Host Software Return CPU Context Save Address GET_ DEBUG_CTXT Syntax MSGS GET_DEBUG_CTXT (void) Description The GET_DEBUG_CTXT routine retrieves the ’C31 context save location starting address. The context address value is placed in the global variable DEBUG_CTXT. Arguments External unsigned long DEBUG_CTXT. Return Value NO_ERR Command completed successfully...
Page 61
DSK_reset, input_rdy, recv_long_byte Host Software Host communications driver routines To facilitate the data transfer from the host to the ’C31, the DSK software in- cludes several driver-level routines in the file driver.cpp. This file includes rou- tines that manipulate the hardware interface circuitry of the host to reset, send, and receive data through unidirectional and bidirectional parallel printer ports.
Page 62
recv_long, xmit_long, xmit_byte Host Software Receive Long recv_long Syntax MSGS recv_long (ulong *rcv_data) Description The recv_long routine receives a 32-bit value in eight 4-bit data transfers (to be used in bidirectional and unidirectional parallel printer ports). Arguments rcv_data Address of the value to receive Return Value NO_ERR Successful reception...
Page 63
Host Software Host communications object routines Using the low-level driver routines, the DSK software provides several high- level routines that allow the loading of programs or data from dsk3a files or COFF (Common Object File Format), that move binary data from the host to the DSK, and that initialize the DSK system.
Page 64
Init_Communication Host Software Initialize Communication Init_ Communication Syntax MSGS Init_Communication (int init_n_times) Description The Init_Communication function first attempts to communicate with the DSK assuming that a valid communications kernel already exists. If this fails, the DSK is reset and the kernel is bootloaded up to init_n_times. This function also queries an existing communications kernel to determine if the kernel is configured for bytewide- or nibble-mode readback.
Page 65
Chapter 5 Using the DSK Assembler This chapter explains how to use the DSK assembler and describes valid DSK source files. Topic Page Creating DSK Assembler Source Files ......Constants .
Page 66
Creating DSK Assembler Source Files 5.1 Creating DSK Assembler Source Files To create a DSK assembler source file, you can use almost any ASCII program editor. Be careful using word processors; these files contain various formatting codes and special characters. DSK assembly language source programs consist of source statements that can contain assembler directives, assembly language instructions, and com- ments.
Page 67
Creating DSK Assembler Source Files Using valid labels Labels are optional for all assembly language instructions and for most (but not all) assembler directives. When you use them, a label must begin in col- umn 1 of a source statement. A label can contain up to eight alphanumeric characters (A–Z, a–z, 0–9, and _ ).
Page 68
Creating DSK Assembler Source Files Using the mnemonic field The mnemonic field follows the label field. The mnemonic field cannot start in column 1, or it is interpreted as a label. The mnemonic field can contain one of the following opcodes: Machine-instruction mnemonic (such as ADDI, MPYF) Assembler directive (such as .data, .set, .entry) If you have a label in the first column, a space, colon, or tab must separate the...
Page 69
Creating DSK Assembler Source Files Using the operand field The operand field is a list of operands that follow the mnemonic field. An oper- and can be a constant (see Section 5.2, page 5-8), a symbol (see Section 5.4, page 5-11), or a combination of constants and symbols in an expression. You must separate operands with commas.
Creating DSK Assembler Source Files Table 5–1. Indirect Addressing Operand Description *ARn Indirect with no displacement *+ARn( disp ) Indirect with predisplacement or preindex add *–ARn( disp ) Indirect with predisplacement or preindex subtract *++ARn( disp ) Indirect with predisplacement or preindex add and modifica- tion *–...
Page 71
Creating DSK Assembler Source Files Commenting your source file A comment can begin in any column and extends to the end of the source line. A comment can contain any ASCII character, including blanks. Comments are printed in the assembly source listing, but they do not affect the assembly. You can comment your source file in one of two ways.
Page 72
Constants Constants The assembler supports five types of constants: Binary integer constants Decimal integer constants Hexadecimal integer constants Floating-point constants Character constants The assembler maintains each constant internally as a 32-bit quantity. Constants are not sign extended . For example, the constant 0FFh is equal to 00FF (base 16) or 255 (base 10);...
Page 73
Constants Floating-point constants A floating-point constant is a string of decimal digits, followed by an optional decimal point, fractional portion, and exponent portion. Examples of floating- point numbers include: 1.75e–10 represented internally as 2202 629A represented internally as 0200 0000 –3.5 represented internally as 01A0 0000 3.2e5...
Page 74
Character Strings 5.3 Character Strings A character string is a string of characters enclosed in double quotes. The maximum length of the string varies and is defined for each directive that re- quires a character string. Examples of valid character strings include: “sample program”...
Page 75
Symbols Symbols Symbols are used as labels, constants, and substitution symbols. A symbol name is a string of up to eight alphanumeric characters (A–Z, a–z, 0–9, $, –, and +); symbols cannot contain embedded blanks. The first character in a symbol cannot be a number or special character.
Expression Analyzer 5.5 Expression Analyzer The expression analyzer used in the DSK assembler includes ANSI C math library functions that aid in the generation of tables and constants. These func- tions eliminate the tedious work of calculating tables and constants before in- cluding them in the assembly process.
Page 77
Expression Analyzer Table 5–2. ANSI C Math Library Functions Supported by the DSK Assembler (Continued) Function Description double log10(double); Logarithm (based–10) double pow10(double); 10 raised to the power of a value double sqrt(double); Square root double log2(double); Logarithm (based–2) double pow(double,double); First value raised to the power of the second value long br(long, long);...
Expression Analyzer Table 5–3. Operators Used in Expressions Operator Description Operator Description Addition Not equal Subtraction Equal to Multiplication Equal to Division & Logical AND Modulo Division Logical OR > Greater than Logical XOR >= Greater than or equal to Bitwise negation (1s complement) <...
Assembling Your Program 5.6 Assembling Your Program Before you attempt to debug your programs, you must first assemble them. Here’s the command for invoking the assembler when preparing a program for debugging: dsk3a filename [ options ] dsk3a is the command that invokes the assembler. filename is the assembly language source file.
Page 80
Placing Code Sections in Memory Locations 5.7 Placing Code Sections in Memory Locations The assembly source contains several sections that must be placed in ‘C31 memory locations, because the DSK assembler includes several new direc- tives that control the starting address of the sections. A linker is not needed. In the following code example, an output section named Mysect is placed be- ginning at address 000x80 9800.
Page 81
Placing Code Sections in Memory Locations To simulate a linker command file, such as the one used in the TMS320 code generation tools, you can use a single file to control the starting address of all sections and then use the .include directive to append all assembly source files.
Page 83
Chapter 6 Assembler Directives Assembler directives supply program data and control the assembly process. They allow you to do the following: Assemble code and data into specified sections Reserve space in memory for uninitialized variables Initialize memory Assemble conditional blocks Topic Page Using the DSK Assembler Directives...
Using the DSK Assembler Directives 6.1 Using the DSK Assembler Directives Table 6–1 summarizes the assembler directives. Note that all source state- ments that contain a directive may have a label and a comment. To improve readability, they are not shown as part of the directive syntax. Table 6–1.
Using the DSK Assembler Directives Directives that initialize constants (data and memory) (Continued) Mnemonic and Syntax Description Page .string “string ” [,..., “string ” ] Initialize one or more text strings 6-31 .word value [, ... , value Initialize one or more 32-bit integers 6-16 (c) Directives that reference other files Mnemonic and Syntax...
Page 86
Using the DSK Assembler Directives (f) Directives that define symbols at assembly time Mnemonic and Syntax Description Page .set value Equate a value with a local symbol 6-28 .sdef value Equate a value with a local symbol multiple times 6-26 (g) Miscellaneous Directives Mnemonic and Syntax Description...
Directives That Define Sections 6.2 Directives That Define Sections These directives associate the various portions of an assembly language pro- gram with the appropriate sections: The .data directive identifies portions of code to place in data memory. Data memory usually contains initialized data. The .sect directive defines an initialized named section and associates subsequent code or data with that section.
Directives That Initialize Constants 6.3 Directives That Initialize Constants Several directives assemble values for the current section. The .byte directive places one or more 8-bit values into consecutive words in the current section. A byte in this case uses all 32 bits of the word placing 0s into the upper 24 bits.
Directives That Initialize Constants / Directives That Reference Other Files The .space directive reserves a specified number of bits in the current section. The assembler advances the SPC and skips the reserved words. When you use a label with .space, it points to the first word of the reserved block.
Directives That Enable Conditional Assembly 6.5 Directives That Enable Conditional Assembly Conditional assembly directives enable you to instruct the assembler to as- semble certain sections of code according to a true or false evaluation of an expression. Two sets of directives allow you to assemble conditional blocks of code: The .if/.else/.endif directives tell the assembler to assemble a block of code according to a true or false evaluation of an expression.
Directives That Align the Section Program Counter / Directives That Define Symbols at Assembly Time 6.6 Directives That Align the Section Program Counter These directives affect the section program counter (SPC). The .align directive aligns the SPC at a 1-byte to 32K-byte boundary. This ensures that the code following the directive begins on the byte value that you specify.
MIscellaneous Directives 6.8 Miscellaneous Directives These directives enable miscellaneous functions or features: The .brstart directive aligns the named section to the next 2 address boundary following the current section. The .end directive terminates assembly. It should be the last source state- ment of a program.
Directives Reference 6.9 Directives Reference The remainder of this chapter is a reference. Generally, the directives are orga- nized alphabetically, one directive per page; however, related directives (such as .if/.else/.endif) are presented together on one page. Here is an alphabetical table of contents for the directive reference: Directive Page...
Page 96
.align Align to a 32-Word Boundary Syntax .align Description The .align directive aligns the current section to a 32-word boundary, filling the hole with NOPs. If the hole is greater than 2 words, .align places a branch to the newly-aligned address. This directive is useful for placing critical code blocks on the boundaries that best use the cache resources of the ’C3x archi- tecture.
Page 97
.brstart Align to Address Boundary Syntax .brstart “ section name”, n Description The .brstart directive aligns the section name to the next 2 address boundary immediately following the current section. This directive aligns data buffers in order to use the ’C3x circular and bit-reversed addressing modes. Another method for creating a section whose start is bit-reversed, is to use the br() func- tion within the .start directive’s address field.
Page 98
.byte, .int., .long, .word Initialize a 32-bit Integer Syntax .byte value [ ,..., value .int value [ ,..., value .long value [, ... , value .word value [ , ... , value Description These directives place one or more values into the current section. The .byte directive places 8-bit values into consecutive words in the cur- rent section.
Page 99
.copy, .include Copy Source File Syntax .copy “ filename ” .include “ filename ” Description The .copy and .include directives tell the assembler to read source state- ments from a different file. The assembler: 1) Stops assembling statements in the current source file 2) Assembles the statements in the copied/included file 3) Resumes assembling statements in the main source file, starting with the statement that follows the .copy or .include directive...
Page 100
.data Assemble Into .data Section Syntax .data Description The .data directive tells the assembler to begin assembling source code into data memory. The .data section normally contains tables of data or preinitial- ized variables. Note that the assembler assumes that .text is the default section. Therefore, at the beginning of an assembly, the assembler assembles code into the .text section unless you specify a section control directive.
Page 101
.end End Assembly Syntax .end Description The .end directive is an optional directive that terminates assembly. It should be the last source statement of a program. The assembler ignores any source statements that follow an .end directive. Example This example shows how the .end directive terminates assembly. 1,R1 ;...
Page 102
.entry Define Entry Point Syntax .entry [ value ] Description The .entry directive tells the assembler the address of the section program counter when a file is loaded. If you do not use the value parameter, the current program memory address, determined by the .text section, becomes the start- ing address.
Page 103
.float, .float16, .float8, .pfloat16, .pfloat8 Initialize TMS320C3x Floating-Point Value Syntax .float value [ ,..., value .float16 value [ ,..., value .float8 value [ ,..., value .pfloat16 value [ ,..., value .pfloat8 value [ ,..., value Description These directive convert one or more values into TMS320C3x floating-point constants.
Page 104
.ieee Initialize IEEE Format Floating-Point Value Syntax .ieee expression Description The .ieee directive places the IEEE single-precision floating-point representa- tion of a single floating-point constant into three bytes in the current section. The expression is a required parameter; it is an expression that must evaluate to a floating-point constant.
Page 105
.if, .else, .endif Assemble Conditional Block Syntax .if well-defined expression .else .endif Description Three directives provide conditional assembly: The .if directive marks the beginning of a conditional block. The expres- sion is a required parameter. If the expression evaluates to true (nonzero), the assembler as- sembles the code that follows it (up to an .else, or an .endif).
Page 106
.loop/.break/.endloop Assemble Code Block Repeatedly Syntax .loop well-defined expression .endloop Description Two directives enable you to repeatedly assemble a block of code: The .loop directive begins a repeatable block of code. The optional ex- pression evaluates to the loop count (the number of loops to be per- formed).
Page 107
.qxx Initialize 2s-Complement Integers Syntax .q xx value [ ,..., value Description The .q xx directive generates signed, 2s-complement fractional integers and long integers whose decimal point is displaced xx places from the LSB. Example Here’s an example of the .qxx directive. The value of xx can be either positive or negative.
Page 108
.sdef Define Assembly-Time Constant Syntax symbol .sdef value Description The .sdef directive functions in the same manner as the .set directive; howev- er, .sdef can redefine the symbol name multiple times without generating an error. All instances of .sdef symbols are stripped from the symbol table at the end of pass 1 analysis.
Page 109
.sect Assemble Into Named Section Syntax .sect “ section name ” Description The .sect directive begins assembling source code into the named section. The .sect directive defines named sections that are used like default .text and .data sections. The section name identifies the section. The section name is significant to 80 characters and must be enclosed in double quotes.
Page 110
.set Define Assembly-Time Constant Syntax symbol .set value Description The .set directive equates a constant value to a symbol. The symbol can then be used in place of the value in assembly source. This allows you to equate meaningful names with constants and other values. The symbol must appear in the label field.
Page 111
.space, .fill Reserve Space Syntax .space size in words .fill size in words, value Description Two directives reserve space in the current section. The .space directive reserves size number of words in the current section and fills them with 0s. The SPC is incremented to point to the word follow- ing the reserved space.
Page 112
.start Link Section to Address Syntax .start “ section name ” , address Description The .start directive links the section name to start at location address . This di- rective effectively gives the DSK assembler the same functionality as a linker command file when used only to create runtime executable modules.
Page 113
.string Initialize Text Syntax .string “ string ” [,..., “ string ”] Description The .string directive places one or more 8-bit character strings into consecu- tive bytes of the current section. The character string must be enclosed in double quotes. Each character in a string represents a separate value.
Page 114
.text Assemble Into .text Section Syntax .text Description The .text directive tells the assembler to begin assembling into the .text sec- tion. The .text section usually contains executable code. The section program counter (SPC) is set to 0, if nothing has been assembled into the .text section. If code has already been assembled into the .text section, the SPC is restored to its previous value in the section.
Page 115
Chapter 7 Using the DSK Debugger This chapter tells you how to invoke the DSK debugger and use its function keys and commands. Topic Page Invoking the Debugger ........Understanding the Debugger Windows .
Invoking the Debugger 7.1 Invoking the Debugger Here’s the command for invoking the debugger: dsk3d [ options ] dsk3d is the command that invokes the debugger. options supply the debugger with additional information. Table 7–1 lists the debugger options; the following subsections describe some of the more commonly used options.
Page 117
Invoking the Debugger Selecting the parallel printer port (LPT = 3 or LPT# option) The LPT option selects a parallel printer port from the host to communicate with the DSK. Parallel Printer Port Functions LPT1 or LPT = 1 Selects printer port hardware at I/O address 0x378. LPT2 or LPT = 2 Selects printer port hardware at I/O address 0x278.
Understanding the Debugger Windows 7.2 Understanding the Debugger Windows DISASSEMBLY window The DISASSEMBLY window shows the reverse assembly of memory con- tents. As shown in Figure 7–1, this window displays several lines of code. Each line shows the instruction address, instruction opcode, label, and instruc- tion mnemonic.
Understanding the Debugger Windows CPU REGISTER window The CPU REGISTER window displays the content of all CPU registers as shown in Figure 7–2. The register’s contents are normally displayed in hexa- decimal format. You can press to display the extended-precision registers in floating-point decimal format.
Understanding the Debugger Windows MEMORY window The MEMORY window shows the contents of a range of memory as shown in Figure 7–3. The MEMORY window has two parts: Addresses. The first column of numbers identifies the addresses of the first column of display data. No matter how many columns of data you dis- play, only one address column is displayed.
Understanding the Debugger Windows COMMAND window The COMMAND window provides an area for entering commands, echoing commands, and displaying command output errors and messages. The COM- MAND window has two parts: Command line. This is the area where you enter commands. When you want to enter a command, just type —...
Using the Help Menu 7.3 Using the Help Menu You can press the or H key to bring up the Help Window Display shown in Figure 7–5. Choose from the menu selections listed below to find additional information. Figure 7–5. Monitor Information Screen KEYBOARD COMMANDS Help Screen 40-bit hex display...
Using Software Breakpoints 7.4 Using Software Breakpoints This section describes how to set and clear software breakpoints and how to obtain a listing of all the breakpoints that are set. While debugging, you may want to halt execution temporarily so that you can examine the contents of selected variables, registers, and memory locations before continuing with program execution.
Debugger Commands 7.5 Debugger Commands The following tables provide a summary of the debugger function keys and commands. Table 7–3. Command-Line Editing To do this Use this command Move the cursor to the beginning of the command line HOME Move the cursor to the end of the command line Delete the character to the left of the cursor Delete the character to the right of the cursor SHIFT...
Debugger Commands Table 7–6. Displaying and Changing Data To do this Use this command MEM addr Display the contents of memory starting at address addr in the MEMORY window Modify memory at address addr MM addr Fill leng locations of memory starting at address addr MM addr leng val with value val.
Debugger Commands Table 7–9. Performing System Tasks To do this Use this command Reset the DSK RESET Quit or exit the debugger QUIT or EXIT DOS ( expression to Run ) Enter the DOS shell and optionally execute the ex- pression.
Quick Reference Guide 7.6 Quick Reference Guide The following tables provide a quick-reference guide of the function key defini- tions. Table 7–10.Function Key Shortcuts for DISASSEMBLY Window Active Function Key Description Help screen Set breakpoint at cursor Clear breakpoint at cursor Run to cursor Display breakpoints Clears all breakpoints...
Quick Reference Guide Table 7–12.Function Key Shortcuts for MEMORY Window Active Function Key Description Help screen Toggle window size Exit memory window Move to top HOME Move to bottom Move by page up/down PAGE UP PAGE DOWN Move cell vertical Move cell horizontal Table 7–13.Function Key Shortcuts for COMMAND Window Active Function Key...
Page 129
Appendix A Appendix A Communications Kernel Source Code This appendix contains the source code for the TMS320C3x DSK communica- tions kernel.
Page 130
Communications Kernel Source Code ;–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––; ; TMS320C3x DSK COMMUNICATIONS AND DEBUG MONITOR KERNAL ; Texas Instruments Incorporated ; (C) 1995,1996 ;–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––; .start ”vectors”,0x809FC1 .start ”kernel” ,vectors–0xAB ; Use size report from DSK3A .start ”sstack” ,0x809F00 ; output to pack to end of RAM .entry START...
Page 131
Communications Kernel Source Code ;========================================================================; ; DEBUGGER COMMANDS The debugger commands are assembled into the lowest available kernel ; memory. If an application were to overgow this section the debugger ; functions would be corrupted, but the application would continue to run so long as the debugger functions were not used.
Page 133
Communications Kernel Source Code ;========================================================================; ; SSTEP This section of code is executed after the pending interrupt, which ; was set in XSTEP, has feteched the ISR vector and begun execution. ; This code performs a full CPU context save before going to the spin ;...
Page 135
Communications Kernel Source Code ;=====================================================================; ; REGISTER CONTEXT STORAGE This block of memory holds the register values when a process is stopped. Essentially the registers displayed in the debugger are the contents of this memory block. ;=====================================================================; context .word ; R0 .word ;...
Page 136
Communications Kernel Source Code ;********************************************************************; ; KERNEL COMMANDS ; ––––––––––––––– These commands are the primary functions required by the kernel ; to perform host based communications. They have been packed into ; the avalable memory in such a way as to minimize the kernels size. ; ;...
Page 137
Communications Kernel Source Code ;====================================================================; ; The XCTXT command returns the address of the context save area to ; the host. Subsequently, the host can use this address to ’get’ ; and put the CPU registers to modify the exectution of the processor; ;––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––;...
Page 138
Communications Kernel Source Code ;====================================================================; ; HOST HPI communications routines packed into himem NOTE: These routines can be called from a high level langauge compiler using the C31s TRAP commands, by directly linking their resolved addresses or by using the jump table. ;====================================================================;...
Page 139
Communications Kernel Source Code ;====================================================================; XREAD is a host port command designed to transfer a block of ; data from C31 memory to the host. ;====================================================================; XREAD call COMN *AR0++(IR1),R0 call W_HOST AR1,XR1 ;====================================================================; There are a few leftover traps that can be used by appliactions ;...
Page 141
Appendix B Appendix A DSK Circuit Board Dimensions and Schematic Diagrams Figure B–1 shows the dimensions of the DSK circuit board, and the rest of the appendix contains a brief description of the hardware in the TMS320C3x DSP Starter Kit, the schematic diagrams and design notes for host interface control.
Page 143
Hardware Component Overview B.1 Hardware Component Overview This section describes the basic functions of the DSK components: Expansion connectors — The four 32-pin headers allow you to develop add-on cards that can directly interface to all of the ’C31 signals. Jumper block header —...
Page 144
Hardware Component Overview Voltage Regulators - The DSK uses a 7–12 Vdc or 6–9 Vac wall mount power supply. The 7–12 Vdc supply voltage is full-wave rectified and then regulated up to 5 volts by the LM7805. It is also converted to –5 volts by the capacitive switching circuit LT1054, and then regulated by the LM7905.
Page 145
Schematics DSK Circuit Board Dimensions and Schematic Diagrams...
Page 151
HOST INTERFACE CONTROL DWG. NAME TMS320C3X DSK ASSY # D600335–0001 PAL # COMPANY TEXAS INSTRUMENTS INCORPORATED ENGR KEITH LARSON DATE 3/7/96 DESIGN NOTES: The power consumption of the TMS320C31 DSK was considerably lowered by the use of a CMOS TIBPAL22V10Z.
Page 152
Host Interface Control Design Notes If T0=T1 the output is a DC level proportional to the phase difference T0 ––––––______––––––______––––––______––––––______––––––______––––––____ T1 ––––______––––––______––––––______––––––______––––––______––––––______ XOR____––____––____––____––____––____––____––____––____––____––____––____ USING THE PWM AS A TRIANGLE WAVE GENERATOR –––––––––––––––––––––––––––––––––––––––––– If T0 and T1 are set to different frequencies a PWM modulated triangle wave at a frequency of F0_t0 –...
Page 155
Appendix C Appendix A Glossary absolute address: An address that is permanently assigned to a memory location. assembler: A software program that creates a machine-language program from a source file that contains assembly language instructions, direc- tives, and macro directives. The assembler substitutes absolute opera- tion codes for symbolic operation codes, and absolute or relocatable ad- dresses for symbolic addresses.
Page 156
Glossary code-display windows: Windows that show code, text files, or code-specif- ic information. command line: The portion of the COMMAND window where you can enter commands. command-line cursor: A block-shaped cursor that identifies the current character position on the command line. comment: A source statement (or portion of a source statement) that is used to document or improve readability of a source file.
Page 157
Glossary EGA: Enhanced Graphics Adaptor . An industry standard for video cards. entry point: The starting execution point in target memory. expression: A constant, a symbol, or a series of constants and symbols separated by arithmetic operators. external symbol: A symbol that is used in the current program module but defined in a different program module.
Page 158
Glossary member: An element or variable of a structure, union, or enumeration. memory map: A map of target system memory space that is partitioned into functional blocks. mnemonic: An instruction name that the assembler translates into machine code. MSB: Most significant bit. MSByte: Most significant byte.
Page 159
Glossary raw data: Executable code or initialized data in an output section. section: A relocatable block of code or data that ultimately occupies contig- uous space in the memory map. serial port: The serial port that the DSK uses for communicating with the analog interface circuit (AIC).
Page 161
Index Index ? debugger option 7-2 assembler directives aligning the section program counter 6-11 ; in assembly language source 5-7 alphabetical reference 6-13 to 6-32 ’C31 serial port, initializing 4-15 to 4-16 conditional assembly 6-10 $ symbol for SPC 5-11 defining assembly-time symbols 6-11 @ operand prefix 5-5 defining sections 6-5 to 6-7...
Page 162
5-8 DSP, defined C-2 character 5-9 decimal integers 5-8 hexadecimal integers 5-8 symbols as 5-8 contacting Texas Instruments, vii EGA, definition C-3 .else directive 6-10, 6-23 .copy directive 6-9, 6-17 .end directive 6-12, 6-19 cursors .endif directive 6-10, 6-23...
Page 163
Index .entry directive 6-11, 6-20 .include directive 6-9, 6-17 entry point, definition C-3 Init_System 4-30 execute program to breakpoint, function key meth- input section, definition C-3 od 7-14 input_rdy 4-27 external symbol, definition C-3 installing the DSK software 2-1 to 2-10 instructions 2-5 possible errors 2-8 .int directive 6-8, 6-16...
Page 164
Index reset 4-27 RUN_CPU 4-25 named section, definition C-4 .sdef directive 6-11, 6-26 secondary communications 4-18 to 4-22 object file, definition C-4 control register bit fields 4-19 object.cpp 4-23 data format 4-18 opcodes, defining 5-4 to 5-18 .sect directive 6-5, 6-27 operand, definition C-4 section, definition C-5 operands 5-5...
Page 165
Index .string directive 6-9, 6-31 TLC32040 AIC initialization 4-14 to 4-22 symbol, definition C-5 symbolic constants 5-11 symbols 5-11 VGA, definition C-5 predefined 5-11 windows, definition C-5 target.cpp 4-23 word, definition C-5 .text directive 6-5, 6-32 .word directive 6-9, 6-16 timer period register value maximum 4-15 minimum 4-14...
Need help?
Do you have a question about the TMS320C3 Series and is the answer not in the manual?
Questions and answers