Texas Instruments TMS320C3 Series User Manual Download Page 105

 Assemble Conditional Block

.if, .else, .endif

6-23

  Assembler Directives

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.

J

If the expression evaluates to 

true (nonzero), the assembler as-

sembles the code that follows it (up to an .else, or an .endif).

J

If the expression evaluates to 

false (0), the assembler assembles

code that follows an .else (if present), or an .endif.

-

The .else directive identifies a block of code that the assembler assembles
when the .if expression is false (0). This directive is optional in the condi-
tional block; if an expression is false and there is no .else statement, the
assembler continues with the code that follows the .endif.

-

The .endif directive terminates a conditional block.

Nested .if/.else/.endif directives are not valid.

Example

Here is an example of conditional assembly:

TRUE

.set 1

FALSE .set

0

.if TRUE

;

nop

; Assembles ’nop’ since TRUE

.else

;

B

$

; Never assembles

.endif

;

Summary of Contents for TMS320C3 Series

Page 1: ...TMS320C3x DSP Starter Kit User s Guide...

Page 2: ...UCTS ARE NOT DESIGNED INTENDED AUTHORIZED OR WARRANTED TO BE SUITABLE FOR USE IN LIFE SUPPORT APPLICATIONS DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS Inclusion of TI products in such applicatio...

Page 3: ...installation instructions for your assembler and de bugger It lists the hardware and software tools you ll need to use the DSK and tells you how to set up its environment J Chapter 3 lists the key fe...

Page 4: ...e system displays such as prompts command output error messages etc Here is a sample program listing of a bit file generated by the accumulator 0x00809800 directive word 1 2 3 0x00809800 0x00000001 wo...

Page 5: ...use an op tional parameter you specify the information within the brackets you don t enter the brackets themselves Here s an example of a directive that has an optional parameter entry value The entr...

Page 6: ...re number SPRU035 describes the assembly language tools as sembler linker and other tools used to develop assembly language code assembler directives macros common object file format and symbolic debu...

Page 7: ...13 274 2324 33 1 3070 1032 4389750 mcimail com http www ti com dsps 713 274 2323 8 N 1 44 2 3422 3248 ftp ti com mirrors tms320bbs 192 94 94 53 Ask questions about micro controller product operation o...

Page 8: ...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 Corporatio...

Page 9: ...DSK Software 2 5 2 4 Step 3 Modifying Your config sys File 2 5 2 5 Step 4 Modifying the PATH Statement 2 6 2 6 Step 5 Verifying the Installation 2 7 Installation errors 2 8 3 Overview of a Code Develo...

Page 10: ...he DSK assembler describes valid source file formats 5 1 Creating DSK Assembler Source Files 5 2 Using valid labels 5 3 Using the mnemonic field 5 4 Using the operand field 5 5 Commenting your source...

Page 11: ...a particular address PORT option 7 3 Automatically search for a printer port TEST option 7 3 7 2 Understanding the Debugger Windows 7 4 DISASSEMBLY window 7 4 CPU REGISTER window 7 5 MEMORY window 7...

Page 12: ...1 TMS320C3x DSK Functional Circuit Diagram 4 3 4 2 Parallel Port Control Register 0x37A 4 4 4 3 Parallel Port Status Register 0x379 4 4 4 4 DSK Memory Map 4 7 4 5 Data Packet Structure 4 8 4 6 Single...

Page 13: ...Summary 6 2 7 1 Summary of Debugger Options 7 2 7 2 Editing Command Keys 7 7 7 3 Command Line Editing 7 10 7 4 Command Line Buffer Manipulation 7 10 7 5 Running Programs 7 10 7 6 Displaying and Changi...

Page 14: ...Attribute Reference xiv Examples 2 1 Port Selection Display 2 9 3 1 File rand asm 3 5 4 1 Initialize the Serial Port Global Control Register 4 16 4 2 Setting the TA and TB Registers 4 20 6 1 Sections...

Page 15: ...signal processing The DSK has a TMS320C31 on board to allow full speed verification of the TMS320C3x code The DSK also gives you the freedom to build new boards create your own software on a host PC...

Page 16: ...g data acquisition via the TLC32040 analog interface circuit AIC J Variable rate analog to digital converter ADC and digital to analog converter DAC with 14 bit dynamic range at 20 000 samples per se...

Page 17: ...an sion connectors include four 32 pin headers an 11 pin jumper block and a 12 pin XDS510 header The TLC32040 AIC interfaces to the TMS320C3x serial port A jumper block allows removal of this connecti...

Page 18: ...1 4...

Page 19: ...t DSK on a PC system running under DOS Topic Page 2 1 What You Need 2 2 2 2 Step 1 Connecting the DSK to Your PC 2 4 2 3 Step 2 Installing the DSK Software 2 5 2 4 Step 3 Modifying Your config sys Fil...

Page 20: ...ated wall mount supplies the polarity of the 2 1 mm power jack does not mat ter Laboratory type power supplies with case grounds are not rec ommended since they can create ground loops and possibly cr...

Page 21: ...unning the DSK debug ger interface Miscellaneous files Other files are included in your DSK package such as sample source files and additional documentation You can find a brief de scription of these...

Page 22: ...into the DSK DB25 connector 4 Plug 7 12 Vdc or 6 9 Vac power supply into the DSK power supply con nector See Figure 2 1 for details Figure 2 1 Connecting Your Parallel Printer Port Cable and Transfor...

Page 23: ...This directory will contain the DSK assembler and debugger software To create this directory enter md c dsktools 3 Insert your product disk into drive A Copy the contents of the disk using the follow...

Page 24: ...system s autoexec bat file The general for mat for doing this is PATH C dsktools pathname2 pathname3 This allows you to invoke the debugger without specifying the name of the di rectory that contains...

Page 25: ...SSEMBLY COMMAND MEMORY 809c03 50700080 startLDIU 00080h DP 809c04 08349c2c LDI 09c2cH SP 809c05 07608000 LDF 0 000000e 00 R0 809c06 c610c1c0 LDI AR0 R0 LDI AR 809c07 c610c1c0 LDI AR0 R0 LDI AR 809c08...

Page 26: ...our printer port cable and connectors may not be connected snugly Your power transformer may not be plugged in on both ends If the DSK is receiving power then the LED will illuminate either red or gre...

Page 27: ...ION I O CONNECTIONS AND CABLES POWER CONSERVATION SOFTWARE LAPTOPS AUTOEXEC BAT CONFIG SYS AND BIOS DAUGHTER CARDS VERY OLD PRINTER PORTS WITHOUT PULLUPS PRE 1986 IF THE LED IS CYCLING R Y G THE KERNE...

Page 28: ...2 10...

Page 29: ...to build new boards and expand the sys tem in any number of ways The DSK assembler and debugger are software interfaces that help you to develop test and refine DSK assembly language programs This ch...

Page 30: ...create an output file Instead the DSK uses special directives to assemble code at an absolute address dur ing the assembly phase As a result you can create small programs quick ly and easily Easy to...

Page 31: ...0 F3 FLOAT F4 Srce F5 Run F6 DispBP F7 ClrAll F8 SStep F9 Grow F10 FStep COMMAND 809c03 50700080 startLDIU 00080h DP 809c04 08349c2c LDI 09c2cH SP 809c05 07608000 LDF 0 000000e 00 R0 809c06 c610c1c0 L...

Page 32: ...assembly language source files into machine language object files for the TMS320C3x family of processors Only the most essential assembler features are incorporated This is not a COFF assembler althou...

Page 33: ...either by using the debugger or a bootloader This example does not use 0x809800 and 0x809801 since the bootloader uses these locations for stack space start CODE 0x809802 Start assembling CODE section...

Page 34: ...s an executable file called rand dsk This file is used for directly loading executable code into the DSK The executable file includes a listing of all errors and warnings that may have occurred during...

Page 35: ...n 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 This chapter details the function...

Page 36: ...ammable array logic PAL determines when the C31 is accessing the host interface by using the STROBE A23 A22 A21 and A20 signals to decode the address of the C31 The PAL provides one input TRI that dis...

Page 37: ...5 19 VCC VCC DEMO LTICPAL22V10Z 25 D Q0 D Q1 HPIA TRI NC Address decode TRI 0 1 10 11 8 74HCT245 74HCT245 0 1 4 EN EN DIR DIR TLC32040 IN IN OUT OUT MCLK RESET DR DX FSX FSR SCLK RESET INT2 READY H1 A...

Page 38: ...and activates the bootload mode The host then downloads your pro gram or the communications kernel to the C31 The parallel port is mapped into the C31 memory to the address range 0xFFF000 0xFFFFFF as...

Page 39: ...and drives the C31 s READY signal high This prevents the C31 from completing its write access The host uses the ERROR signal to acknowledge that the C31 is already sending data 3 When the host receive...

Page 40: ...tional pins from the C31 control resetting and clocking signals to the AIC The C31 s TIMER0 pin drives the master input clock to the AIC The C31 s XF0 signal resets the AIC The AIC s analog input and...

Page 41: ...800h 8098FFh 809C00h 809FC0h 809FC1h 809FFFh 80A000h 0x0BFFFFFh 0x0C00000h 0x0DEFFFFh 0x0E00000h 0x0EFFFFFh 0x0FFF000h 0x0FFFFFFh Reserved for boot loader operations Boot 1 External USER_BOOT Boot 2 R...

Page 42: ...on typically consist of four fields command data stream length target address and target index This header is followed by the data stream as shown in Figure 4 5 The header fields are described as foll...

Page 43: ...memory location pointed to by the target address The target address is incremented by the target index after each write operation XREAD Read a block of data from the DSK to the host This command reads...

Page 44: ...ation Debugging functions provided in the communications kernel operate as a background task and they never disable the CPU or force a pipeline flush For example single stepping an opcode in scan base...

Page 45: ...followed by a standard return from interrupt The processor is then free to execute code The communications kernel implements the opcode XSTEP by using a re served interrupt in the C31 Serial Port 1 t...

Page 46: ...ldiu BUD or ldi ldiu _PC R5 CINT2 IF 4 IF 3 _ST ST R5 2000h ST _R5 R5 _DP DP return to PC from TOS return Clear Poll INT2 before SSTEP or RUNF Set XINIT1 interrupt restore Status turn on INT s restore...

Page 47: ...ISR 11 Pipeline continues to fill with ISR ISR2 XSTEP ISR 12 Pipeline continues to fill with ISR ISR3 ISR2 XSTEP ISR 13 Execute first instruction of ISR ISR4 ISR3 ISR2 XSTEP ISR Table 4 1 describes t...

Page 48: ...capacitor filter clocks and the A D and D A timing signals The timer pulses the TCLK0 signal whenever the C31 timer counter register memory mapped to 0x0080 8024h counts up to the timer period regist...

Page 49: ...riod 1 TGCR0 set 808020h Timer 0 global control register TCNT0 set 808024h Timer 0 counter register TPR0 set 808028h Timer 0 period register TIMVAL word 3c1h Timer global control register value ldp TG...

Page 50: ...R4 to zero sti R4 SGCR0 ldi SINIT1 R7 Reset and sti R7 SPCX0 initialize serial port sti R7 SPCR0 initialize serial port ldi SINIT0 R7 Reset and sti R7 SGCR0 initialize serial port Refer to the exampl...

Page 51: ...A Conver sion_Frequency To initialize the AIC s Tx counter A and B registers you must send a primary communication followed by a secondary communication explained in the Pri mary communications subsec...

Page 52: ...functions and gener ate nonstandard modem frequencies Secondary communications Secondary communication follows a primary communication that has the two LSBs set to 11 This secondary communication prog...

Page 53: ...2 sets the TA and TB registers of the AIC This code transmits a 16 bit word to the AIC and then waits until the transmit interrupt is generated by the serial port Four commands are transmitted start i...

Page 54: ...set 0x808028 TIM0 prd S0_gctrl set 0x808040 SP 0 global control S0_xctrl set 0x808042 SP 0 FSX DX CLKX port ctl S0_rctrl set 0x808043 SP 0 FSR DR CLKR port ctl S0_xdata set 0x808048 SP 0 Data transmit...

Page 55: ...R3 pop ST reti ADC2 push ST push R3 ldi S0_rdata R3 sti R3 ADC_last pop R3 pop ST reti The startup stub is used during initialization only and can be safely overwritten by the stack or data entry ST_S...

Page 56: ...up the Fs to final rate call prog_AIC smallest divisor should be last ldi A_REG R0 call prog_AIC b main prog_AIC ldi S0_xdata R1 Use original DXR data during 2 ndy sti R1 S0_xdata idle ldi S0_xdata R1...

Page 57: ...es the low level routines that manipulate the data transmissions into packets that are recognized by the C31 communications kernel object cpp uses the target and driver level routines to initialize an...

Page 58: ...ong addr ulong length ulong data Description The getmem routine reads a block of data from the C31 memory Arguments addr Address of the data to be read length Size of memory block to read data Pointer...

Page 59: ...RECV_ERR Failed reception Run Command RUN_CPU Syntax MSGS RUN_CPU void Description The RUN_CPU routine executes instructions starting at the program counter obtained from the CPU context save area an...

Page 60: ...escription 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 DE...

Page 61: ...routine resets the DSK by toggling the INIT signal Arguments None Return Value NO_ERR Reset sequence completed RESET_ERR Reset has failed Input Ready input_rdy Syntax char input_rdy void Description T...

Page 62: ...S xmit_long ulong snd_data Description The xmit_long routine transmits a 32 bit value in four 8 bit data transfers to be used in bidirectional and unidirectional parallel printer ports Arguments snd_d...

Page 63: ...t is defined in the file DSK_COFF H An ASCII hexadecimal file format that contains the bootloader header informa tion and raw data is also supported Since the header information defines where and how...

Page 64: ...times This function also queries an existing communications kernel to determine if the kernel is configured for bytewide or nibble mode readback After initializing communications with the DSK the Load...

Page 65: ...er and describes valid DSK source files Topic Page 5 1 Creating DSK Assembler Source Files 5 2 5 2 Constants 5 8 5 3 Character Strings 5 10 5 4 Symbols 5 11 5 5 Expression Analyzer 5 12 5 6 Assembling...

Page 66: ...ialization value 1 into R7 sti R7 SPCX0 Initialize FSX DX CLKX control reg sti R7 SPCR0 Initialize FSR DR CLKR control reg ldi SINIT0 R7 Load initialization value 0 into R7 sti R7 SGCR0 Enable RINT an...

Page 67: ...The DSK assembler does not require a label terminator When you use a label its value is the current value of the section program counter the label points to the statement it s associated with If for e...

Page 68: ...IE set 0x2000 C3xMMRS ASM A_REG word TA 9 RA 2 0 0x809902 B_REG word TB 9 RB 2 2 0x809903 C_REG word 10000011b 0x809904 1 5 V S0_gctrl_val word 0x0E970300 S0_xctrl_val word 0x00000111 S0_rctrl_val wor...

Page 69: ...s If you use the sign as a prefix the assembler treats the operand as the contents of a 32 bit ad dress specified by addr The 16 MSBs of the address are specified by the DP register the 16 LSBs are sp...

Page 70: ...reindex add and modifica tion ARn disp Indirect with predisplacement or preindex subtract and modification ARn disp Indirect with postdisplacement or postindex add and modifi cation ARn disp Indirect...

Page 71: ...or example Memory map register locations SGR0 set 0x808040 Serial port 0 global control register SPCX0 set 0x808042 Serial port 0 FSX DX CLKX control register SPCR0 set 0x808043 Serial port 0 FSR DR C...

Page 72: ...ual to 21 0101b Constant equal to 5 Decimal integers A decimal integer constant is a string of decimal digits ranging from 2 147 483 647 to 4 294 967 295 Examples of valid decimal constants in clude 1...

Page 73: ...ed internally as 12E3 C00016 A floating point constant can be preceded with a or sign Character constants A character constant is a single character enclosed in single quotes The char acters are repre...

Page 74: ...is defined for each directive that re quires a character string Examples of valid character strings include sample program defines a 14 character string sample program temp asm defines an 8 character...

Page 75: ...ister names as labels Constants Symbols can be set to constant values By using constants you can equate meaningful names with constant values The set directive enables you to set constants to symbolic...

Page 76: ...se these functions with the COFF toolset then extract the resulting hexadecimal values from the DSK listing file Table 5 2 ANSI C Math Library Functions Supported by the DSK Assembler Function Descrip...

Page 77: ...long circ long long Align the first value to the next address located by raising the second value to the power of 2 You can generate a table of values using certain assembler directives To gen erate a...

Page 78: ...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 Less than Logica...

Page 79: ...are not case sensitive If you do not specify an extension the assembler as sumes the default extension asm options affect the way the assembler processes input files You can specify options and filena...

Page 80: ...ns at 0x809800 sect Mysect Assemble code into Mysect entry START Execution START point START LDI 0 R0 Initialize R0 0 LOOP ADDI 1 R0 Increment R0 B LOOP Do it again To place two sections of code that...

Page 81: ...nd then use the include directive to append all assembly source files For example consider the following build file where three source files are appended to each other using a common block statement f...

Page 82: ...5 18...

Page 83: ...semble conditional blocks Topic Page 6 1 Using the DSK Assembler Directives 6 2 6 2 Directives That Define Sections 6 5 6 3 Directives That Initialize Constants 6 8 6 4 Directives That Reference Other...

Page 84: ...he current section note that a label points to the beginning of the reserved space 6 29 float expression Initialize a 32 bit TMS320C3x floating point constant 6 21 float16 expression Initialize a 16 b...

Page 85: ...d Directives that enable conditional assembly Mnemonic and Syntax Description Page else Optional conditional assembly 6 23 endif End conditional assembly 6 23 if well defined expression Begin conditio...

Page 86: ...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 Page brstart section name n Align the named section to...

Page 87: ...how you can use sections directives to associate code and data with the proper sections This is an output listing column 1 shows the SPC value and column 2 shows the memory contents if affected by the...

Page 88: ...4 nocode 0x00809804 directive data 0x00809900 directive byte 9 10 0x00809900 0x00000009 byte 0x00809901 0x0000000a byte 0x00809902 directive byte 11 12 0x00809902 0x0000000b byte 0x00809903 0x0000000c...

Page 89: ...Addressable ref Default Start 0x00809800 1 1 ref 0x00000001 1 2 ref text 0x00809800 1 1 ref data 0x00809900 1 1 ref mysect 0x00809a00 1 1 ref 0x00000001 1 2 Output section start end length sect Defaul...

Page 90: ...not used and are filled with 0s The float8 directive converts an expression value into an 8 bit TMS320C3x floating point constant This format has a 4 bit exponent and a 4 bit mantissa This format can...

Page 91: ...reserved block The string directive places 8 bit characters from one or more character strings into the current section The word directive places one or more 32 bit values into consecutive by tes in t...

Page 92: ...f an expression Note that you cannot nest if statements if well defined expression marks the beginning of a conditional block and assembles code if the if well defined expression is true else marks a...

Page 93: ...boundary it is not incremented The entry directive identifies the starting address of the section program counter By default the current address is used or you can specify an op tional address 6 7 Dir...

Page 94: ...to the next 2n address boundary following the current section The end directive terminates assembly It should be the last source state ment of a program This directive has the same effect as an end of...

Page 95: ...d together on one page Here is an alphabetical table of contents for the directive reference Directive Page Directive Page align 6 14 include 6 17 brstart 6 15 int 6 16 byte 6 16 long 6 16 copy 6 17 l...

Page 96: ...example of the align directive Slightly modified FIR filter example from C3x Users Guide start ISR 0x809808 Create an output section which is sect ISR not on a 32 word boundary for demo align FIRLENG...

Page 97: ...ction 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...

Page 98: ...e words in the cur rent section The value must be an expression that evaluates to a number within the range of 32768 and 32767 The upper 16 bits are always 0 The long and word directives place 32 bit...

Page 99: ...specify a full pathname the assembler searches for the file in the current directory The copy and include directives can be nested within a file that is copied or included the assembler limits this t...

Page 100: ...ed 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...

Page 101: ...ve 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 directiv...

Page 102: ...e encountered becomes the starting address of your code Example Here is an example of the entry directive start code 0x809800 Create a named section to assemble to sect code use the new section entry...

Page 103: ...mat has a 4 bit exponent and a 4 bit mantissa When properly scaled this format can be used for quick logarithm approxi mations The pfloat16 directive converts a value into a 16 bit floating point cons...

Page 104: ...ion 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 Each constant...

Page 105: ...evaluates to false 0 the assembler assembles code that follows an else if present or an endif The else directive identifies a block of code that the assembler assembles when the if expression is fals...

Page 106: ...unt the number of loops to be per formed If there is no expression the loop count defaults to 246 The endloop directive terminates a repeatable block of code it executes when the number of loops perfo...

Page 107: ...nd 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 q0 3 1415926 All upper 32 bit...

Page 108: ...pass 1 analysis When used with the if directive sdef can conditionally assemble included blocks of code This is useful for turning on and off included library functions The symbol must appear in the...

Page 109: ...section name identifies the section The section name is significant to 80 characters and must be enclosed in double quotes Example Here s an example of the sect directive start Mysect_1 0x809800 Creat...

Page 110: ...in assembly source This allows you to equate meaningful names with constants and other values The symbol must appear in the label field The value must be a well defined expression that is all symbols...

Page 111: ...The fill directive reserves size number of words in the current section and fills them with value The value must be an absolute value The SPC is in cremented to point to the word following the reserv...

Page 112: ...ion to have a valid starting address the start statement for the section must precede the text data or sect directive that defines the section name Note that by using an include file with an imbedded...

Page 113: ...character in a string represents a separate value The string directive places the 8 bit values into memory in a packed form in the order they are encountered If a word is not filled the remaining bits...

Page 114: ...embled into the text section the SPC is restored to its previous value in the section Note that the assembler assumes that text is the default section Therefore at the beginning of an assembly the ass...

Page 115: ...DSK debugger and use its function keys and commands Topic Page 7 1 Invoking the Debugger 7 2 7 2 Understanding the Debugger Windows 7 4 7 3 Using the Help Menu 7 8 7 4 Using Software Breakpoints 7 9...

Page 116: ...munication using the parallel port in standard 4 bit uni directional mode BW 8 Byte Forces communication using the parallel port in 8 bit bidirectional mode LPTx LPT x Selects a parallel printer port...

Page 117: ...the LPTx AT Convention EISA and PS 2 I O Address LPT1 LPT2 ox378 LPT2 LPT3 0x278 LPT3 LPT1 0x3BC Select the parallel printer port at a particular address PORT option The port option selects the paral...

Page 118: ...0 000000e 00 R0 809c06 c610c1c0 LDI AR0 R0 LDI AR 809c07 c610c1c0 LDI AR0 R0 LDI AR 809c08 08600100 LDI 256 R0 809c09 09a09c00 LSH 09c00H R0 809c0a 61809c0e BRD jump 809c0b 07618000 LDF 0 000000e 00...

Page 119: ...SP 008098de R0 00000000 R1 00000000 R2 00000000 R3 00000000 R4 00000000 R5 00000000 R6 00000000 R7 00000000 AR0 00000000 AR1 00000000 AR2 00000000 AR3 00000000 AR4 00000000 AR5 00000000 AR6 00000000...

Page 120: ...ed by 4 Although the window shows four columns of data there is still only one column of addresses address 0x0080 9800 con tains 0x0000 0007 address 0x0080 9801 contains 0xFFFF FFFC address 0x0080 980...

Page 121: ...t from your commands and displays debugger error messages Figure 7 4 shows the window command line and display area Figure 7 4 COMMAND Window load testa J COMMAND Display area Command line You can use...

Page 122: ...ll breakpoints F8 Singlestep F9 Toggle DASM window size F10 Step over function ALT D Selects Disassembly Window ALT M Selects Memory Window H Xtra help S save help to file Move Up Dn Pup Pdn To move t...

Page 123: ...y of the run or single step commands You can set a software breakpoint by entering the SB command sb addr If you know the address where you d like to set a software breakpoint you can use the SB comma...

Page 124: ...Move the cursor to the left Move the cursor to the right Table 7 4 Command Line Buffer Manipulation To do this Use this command Recall the last command typed PAGE UP or Recall the first command in th...

Page 125: ...ow DASM addr Display extended precision registers in 40 bit hexade cimal format in the register window REG40 Display extended precision registers in floating point decimal format in the register windo...

Page 126: ...Enter the DOS shell and optionally execute the ex pression Enter EXIT to return to debugger DOS expression to Run Enter the DOS shell and execute the editor to edit filename If no filename is given th...

Page 127: ...p screen F2 Set breakpoint at cursor F3 Clear breakpoint at cursor F4 Run to cursor F5 Run F6 Display breakpoints F7 Clears all breakpoints F8 Single steps your program F9 Grow window F10 Step over SH...

Page 128: ...a list of commands F2 Displays extended precision registers in 40 bit hex adecimal format F3 Displays extended precision registers in floating point decimal format F4 Toggles between displaying the so...

Page 129: ...A 1 Appendix A Communications Kernel Source Code This appendix contains the source code for the TMS320C3x DSK communica tions kernel Appendix A...

Page 130: ...ce it is no longer needed In this case the startup stub is placed after the stack Another safe location would be a section of memory which is used for I O or uninitialized data This section of code al...

Page 131: ...and executed there may be other dummy fetches This pending interrupt then causes the processor to return back to the context save routine effectively singlestepping the CPU S0_xdata set 0x808048 SP 0...

Page 132: ...lock size ldi _SP SP get user SP ldi _PC R5 return to PC from TOS return andn 0x4 IF Clear Poll INT2 before SSTEP or RUNF tstb 4 IF bnz 3 ldiu _ST ST restore Status or _IE IE BUD R5 or 2000h ST turn o...

Page 133: ...DP pop IR0 save user PC sti IR0 _PC sti SP _SP save user SP sti BK _BK Block size sti IE _IE Internal int enable sti IF _IF CPU interrupt flags sti IOF _IOF IO flags sti RS _RS Repeat start sti RE _RE...

Page 134: ...OWLEDGE zero to host b spin0 Branch is removed spin0 is inline The spin0 code loop is used by the kernel as a known program loop when a process is halted While in the spin loop commands can be process...

Page 135: ...3 word 0 F3 _R4 word 0 F4 _R5 word 0 F5 _R6 word 0 F6 _R7 word 0 F7 _AR0 word 0 AR0 _AR1 word 0 AR1 _AR2 word 0 AR2 _AR3 word 0 AR3 _AR4 word 0 AR4 _AR5 word 0 AR5 _AR6 word 0 AR6 _AR7 word 0 AR7 _DP...

Page 136: ...ece of data or command INTx maxspeed push ST Push ISR variables push DP push R0 NOTE A HALT command pops these push IR1 values followed by a full save push AR0 push AR1 ldp JUMP Get address of command...

Page 137: ...ss from the primary vector table located in the bootloader ROM This 32 bit value is then used as an address where the new execution begins Since it is impossible to relocate the vector table or modify...

Page 138: ...FFF000 ldi WSCOUNT AR1 WH sti R0 AR0 16 Store lsbs to HPI lsh WSHIFT R0 shift to next lsbs db AR1 WH loop until done pop DP b COMNHST R_HOST performs an interlocked Host Port read from the printer por...

Page 139: ...tart JMPTBL 0x809FF4 sect JMPTBL JUMP word JUMP 0x809FF4 Jump table base address word XWRIT 1 0x809FF5 for DSK3 routines word XREAD 2 0x809FF6 word XCTXT 3 0x809FF7 word XRUNF 4 0x809FF8 word XSTEP 5...

Page 140: ...Communications Kernel Source Code A 12...

Page 141: ...tic 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...

Page 142: ...rcuit Board Dimensions B 2 Figure B 1 TMS320C3x DSP Starter Kit DSK Circuit Board Dimensions TLC32040CFN 3 2000 2 1250 1 0750 0 0000 1 6560 0 1500 3 3500 3 2000 2 5820 0 7300 0 0500 0 0000 3 5000 5 00...

Page 143: ...scillator The on board 50Mhz oscillator drives the C31 clock input The C31 internal clock value is divided by 1 same frequency Parallel printer port connector The DB25 25 pin connector connects direct...

Page 144: ...d and then regulated by the LM7805 and LM7905 to 5V and 5V respectively The 5V and 5V supplies are used to power all of the DSK on board circuitry The TLC32040 AIC requires a negative poser supply of...

Page 145: ...Schematics B 5 DSK Circuit Board Dimensions and Schematic Diagrams...

Page 146: ...Schematics B 6...

Page 147: ...Schematics B 7 DSK Circuit Board Dimensions and Schematic Diagrams...

Page 148: ...Schematics B 8...

Page 149: ...Schematics B 9 DSK Circuit Board Dimensions and Schematic Diagrams...

Page 150: ...Schematics B 10...

Page 151: ...decodes Memory access times for the SRAM decoded output are as follows TIBPAL22V10Z CMOS at 50MHz H1 40ns t access H1 1 WS Tpal Td H1L A Tsu D R t access H1 1 WS 25ns 19ns wait states 0 1 2 3 4 t acc...

Page 152: ..._ __ _ _ __ ___ ____ __________ ____ If an H bridge drive circuit is used with these signals an AC motor can be driven with an DSP controlled frequency By using an external PAL to provide additional r...

Page 153: ...DEMO T0 T1 T0 T1 The decoded address ranges are as follows NOTE By using A23 as an enable it is possible to use external zero wait state RAM Essentialy by ignoring decoded outputs USER_BOOT 000000 0FF...

Page 154: ...B 14...

Page 155: ...ation codes and absolute or relocatable ad dresses for symbolic addresses assignment statement A statement that assigns a value to a variable autoexec bat A batch file that contains DOS commands for i...

Page 156: ...s modular programming by supporting the concept of sections constant A numeric value that can be used as an operand cursor An icon on the screen such as a rectangle or a horizontal line that is used a...

Page 157: ...rs the type of system the object file can be downloaded to the number of symbols in the symbol table and the symbol table s starting address G global A kind of symbol that is either 1 defined in the c...

Page 158: ...age instruc tion assembler directive or macro directive options Command parameters that allow you to request additional or spe cific functions when you invoke a software tool P PC Personal computer or...

Page 159: ...ep A form of program execution that allows you to see the effects of each statement The program is executed statement by statement the debugger pauses after each statement to update the data display w...

Page 160: ...C 6...

Page 161: ...2 key features 3 2 options 5 15 source listings 5 2 source statement format 5 2 symbols 5 11 assembler directives aligning the section program counter 6 11 alphabetical reference 6 13 to 6 32 conditio...

Page 162: ...ers 5 8 hexadecimal integers 5 8 symbols as 5 8 contacting Texas Instruments vii copy directive 6 9 6 17 cursors command line cursor definition C 2 definition C 2 D data directive 6 5 6 18 data packet...

Page 163: ...3 hexadecimal integers 5 8 host requirements 2 2 host software 4 23 I ieee directive 6 8 6 22 if directive 6 10 6 23 include directive 6 9 6 17 Init_System 4 30 input section definition C 3 input_rdy...

Page 164: ...ctive 6 11 6 26 secondary communications 4 18 to 4 22 control register bit fields 4 19 data format 4 18 sect directive 6 5 6 27 section definition C 5 section program counter See SPC serial port defin...

Page 165: ...11 predefined 5 11 T target cpp 4 23 text directive 6 5 6 32 timer period register value maximum 4 15 minimum 4 14 TLC32040 hardware interface 4 6 TLC32040 AIC initialization 4 14 to 4 22 V VGA defin...

Page 166: ...Index 6...

Reviews: