Exercise 1-2. The Assembler and Debugger EXERCISE OBJECTIVES

Similar documents
Exercise 2-3. Addressing EXERCISE OBJECTIVES

Exercise 4-1. DSP Peripherals EXERCISE OBJECTIVES

Exercise 3-1. The Program Controller EXERCISE OBJECTIVES

Digital Signal Processor

AN1369 APPLICATION NOTE

NEW CEIBO DEBUGGER. Menus and Commands

TMS320C2xx/C24x Code Composer User s Guide

Assembly Language programming (1)

3 TUTORIAL. In This Chapter. Figure 1-0. Table 1-0. Listing 1-0.

Create and Debug a CCSv5.5 Project for DSK6713- or DUETT-Board1

2 TUTORIAL. Overview. VisualDSP Getting Started Guide 2-1 for SHARC DSPs

ADuC814 GetStarted Guide a tutorial guide for use with the ADuC814 Quickstart Development System CONTENTS:

ToolStick-EK TOOLSTICK USER S GUIDE. 1. Kit Contents. 2. ToolStick Overview. Green and Red LEDs. C8051F321 provides USB debug interface.

Using the Xcode Debugger

MicroConverter. QuickStart Development System

Code Composer Studio User s Guide

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine

Linear Control Systems LABORATORY

Using the DSK In CalPoly EE Courses - Dr Fred DePiero

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

Getting Started with the HCS12 IDE

At the shell prompt, enter idlde

Lab 2: Introduction to Assembly Language Programming

SKP16C26 Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

ECE4703 Real-Time DSP Orientation Lab

PSoC Designer: Integrated Development Environment

M16C/62P QSK QSK62P Plus Tutorial 1. Software Development Process using HEW4

1 Introduction to MARS

Changing the Embedded World TM. Module 3: Getting Started Debugging

ADuC812 GetStarted Guide a tutorial guide for use with the ADuC812 Quickstart Development System CONTENTS:

EE 210 Lab Assignment #2: Intro to PSPICE

April 4, 2001: Debugging Your C24x DSP Design Using Code Composer Studio Real-Time Monitor

Experiment 6 Finite Impulse Response Digital Filter (FIR).

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Small rectangles (and sometimes squares like this

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

AiM User Guide. Race Studio 3 Track Manager. Release 1.00

ECE 5655/4655 Laboratory Problems

1 Preface About this Manual Intended Audience Revision History Document Conventions Version...

CodeWarrior Development Studio for Power Architecture Processors FAQ Guide

Computer Structure Lab. RESA b1monitor PROGRAM USER GUIDE

MULTIPROG QUICK START GUIDE

Assembly Language LAB

Training Simulator and Demo Software

U90 Ladder Software Manual. Version 3.50, 6/03

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

FALSIM. FALSIM is the name of the software application which consists of the FALCON-A assembler and the FALCON-A simulator. It runs under Windows XP.

1. Working with PSpice:

Resource 2 Embedded computer and development environment

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

P&E Microcomputer Systems, Inc. PKGPPCNEXUS

Virtual Instrumentation With LabVIEW

Supplement: Visual C++ Debugging

CPE 323: Laboratory Assignment #1 Getting Started with the MSP430 IAR Embedded Workbench

Intro to MS Visual C++ Debugging

Project Debugging with MDK-ARM

Microsoft Visual Basic 2005 CHAPTER 6. Loop Structures

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

_ V Intel 8085 Family In-Circuit Emulation. Contents. Technical Notes

Lab 1 Introduction to TI s TMS320C6713 DSK Digital Signal Processing Board

Programming Model 2 A. Introduction

LabVIEW. Table of Contents. Lesson 1. Pre-reqs/Technical Skills Basic computer use

SQL Server. Management Studio. Chapter 3. In This Chapter. Management Studio. c Introduction to SQL Server

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version.

Parallel Debugging. ª Objective. ª Contents. ª Learn the basics of debugging parallel programs

Experiment N o 1. Introduction to Assembly Language Programming

Step-by-Step Data Acquisition Part II Exercise 2: Generating an Analog Output Waveform

Debugging Nios II Systems with the SignalTap II Logic Analyzer

Tutorial 3: Using the Waveform Viewer Introduces the basics of using the waveform viewer. Read Tutorial SIMPLIS Tutorials SIMPLIS provide a range of t

Hands-on Lab Session 9909 Introduction to Application Performance Management: Monitoring. Timothy Burris, Cloud Adoption & Technical Enablement

Creating and Simulate/Emulating an ASM Project in Atmel Introduction Procedure File New Project Assembler

Codewarrior for ColdFire (Eclipse) 10.0 Setup

Section 2: Getting Started with a FPU Demo Project using EK-LM4F232

Introduction to PSpice

Maintain an ILE RPG application using Remote System Explorer

Starting Embedded C Programming CM0506 Small Embedded Systems

Tools Basics. Getting Started with Renesas Development Tools R8C/3LX Family

TINA-TI Simulation Software. Application Note

CPU. IBM PC and compatible Memory Structure

Lab 6 : Introduction to Simulink, Link for CCS & Real-Time Workshop

VB Net Debugging (Console)

The iworx 214 and LabScribe V2.0 Tutorial. Overview

DOMAIN TECHNOLOGIES. Getting Started Guide Version 1.1. BoxView IDE. Integrated Development Environment

Using the KD30 Debugger

Hands-On Introduction to. LabVIEW. for Scientists and Engineers. Second Edition. John Essick. Reed College OXFORD UNIVERSITY PRESS

Introduction to C/C++ Programming

Lab Exercise 1 Using EGit and JUnit

and 32 bit for 32 bit. If you don t pay attention to this, there will be unexpected behavior in the ISE software and thing may not work properly!

CodeWarrior Development Studio for etpu v10.x Quick Start SYSTEM REQUIREMENTS

Assembly Language Fundamentals

Getting Started in Assembly Programming with Keil uvision and MSP432

The 8051 Microcontroller and Embedded Systems

Outline. Debugging. In Class Exercise Solution. Review If Else If. Immediate Program Errors. Function Test Example

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

file://c:\documents and Settings\degrysep\Local Settings\Temp\~hh607E.htm

Code Composer TM. Quick Start Guide

TUTORIAL Auto Code Generation for F2806X Target

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

A Quick Introduction to MPLAB SIM

DOMAIN TECHNOLOGIES INC. Users Guide Version 2.0 SB-USB2. Emulator

Transcription:

Exercise 1-2 The Assembler and Debugger EXERCISE OBJECTIVES Upon completion of this exercise, you will understand basic DSP source file syntax. You will be able to operate the debugger that accompanies the DIGITAL SIGNAL PROCESSOR. DISCUSSION The source file for a DSP program can be written inside of a text editor, virtually any ASCII editor can be used. 1-29

The instruction lines found in the source file and used in the assembler programming language are called source statements. A DSP program is a list of these assembled source statements. The source statements used in the assembler language have a very precise syntax. There are four fields that make up a statement: the label (optional) the instruction mnemonic the instruction mnemonic operands (the number of operands depends on the instruction used) the comment (optional) 1-30

Each source statement field must be separated by one or more blanks The source statements themselves must either begin with a label or a blank. The beginning of a comment line must be indicated by a semicolon or an asterisk. A source file may also contain assembler directives. Directives supply the program with data and control the assembly process. Assembler directives permit the following to be done: initialize program instructions and data values into memory. define symbolic names for certain DSP registers (using the.mmregs directive). reserve space in memory for variables that have not been initialized. assemble conditional blocks. 1-31

The source files used with the DIGITAL SIGNAL PROCESSOR contain certain assembler directives, some of the most common ones are: What assembler directives declare the initial DSP memory addresses where program instructions and data variables are stored? a. The mnemonic and the operand directives respectively. b. The.entry and the.end directives respectively. c. The.entry directive. d. The.ps and the.ds directives respectively. The executable file dsk5a.exe is the assembler program used with the DIGITAL SIGNAL PROCESSOR. When a source file (*.asm) is assembled, a dsk file (*.dsk) and a listing file (*.lst) are created. 1-32

The dsk file, also known as the program file, contains a list of machine code corresponding to assembled source statements. To run a program, the program file must be loaded into the DSP. The DSP is loaded with the dsk file. The listing file lists all source statements, line numbers and any errors that occurred during assembly. When the program is viewed inside of the debugger, the listing and the dsk files are used to create a display of the source file statements. If an MPY, multiply, instruction uses one operand, #031h, and is labeled OMEGA then which of the following source statements has the correct syntax? a. MPY #031h ;OMEGA b. OMEGA: MPY #031h c. #031h MPY ;OMEGA d. None of the above The C5x VDE is the debugger used with the Digital Signal Processor. It has the following functions: Load dsk programs into memory and view the program code, run and halt the program and execute single step commands (execution of single instructions), display in a viewing window the CPU registers and peripheral registers, display in a viewing window the DSP memory areas, graph DSP memory values while the DSP program is running, edit CPU registers, DSP program instructions and memory, place breakpoints at specific DSP source statements. 1-33

The C5x VDE uses the listing file to dis-assemble (contrary of assemble) machine code contained within the dsk file. The dis-assembled code is then displayed. When a dsk file is loaded into DSP memory the Dis-Assembly window automatically opens. The Dis-Assembly window displays four columns of information: 1. The address in memory where the instruction is found, 2. the instruction in machine code, 3. the instruction mnemonic, 4. the instruction operands. The source statement highlighted with a yellow line represents the next instruction that the DSP will execute. A source statement highlighted with a purple line corresponds to an instruction where a breakpoint has been set. 1-34

A toolbar located at the top of the debugger screen has commands that aid in the control of program execution. Run and Halt, are used to begin and stop program execution. StepInto: You can single step through the code by clicking on the StepInto button on the Toolbar. This will execute one program instruction for every click of the button. StepOver: If you do not wish to single step through a subroutine, you can execute the StepOver command once you reach a CALL function. The entire function will then be executed, at this point single stepping can resume. StepOut: The StepOut command will execute all of the instructions necessary to execute a subroutine. Execution will be halted once a RET (return from subroutine) assembler instruction is encountered. 1-35

The value of all CPU registers are shown in the C5X Registers window. You will become familiar with many of the CPU registers as you advance through the course. For the moment, it is sufficient to know that these registers contain DSP system information. The registers displayed in the window contain values, DSP status and control bits and instruction pointers. Memory is viewed inside of the debugger by opening a Memory display window. The memory addresses to be monitored are user selected. As many memory windows as needed may be launched inside of the debugger. 1-36

When a dsk file is loaded inside of the C5x VDE, the following is true for the Dis- Assembly and Memory display windows: All source statement labels, used to declare a variable within the source code, appear in blue. All comments of labeled source statements appear in green. The Memory display window can be used as a Watch Window. Variables stored in memory may be watched and edited if necessary. Within all viewing windows, the following is true: Memory addresses and registers appear in red when the values stored within them are modified during the execution of the previous instruction. Memory addresses and registers (except the RAM, XF and INTM registers) can be edited by simply double-clicking on the desired register or memory address. 1-37

The Graph command in the View menu can be used for graphical displays of data values. Signals can be viewed in either the time or frequency domain, at any point in your program. Breakpoints halt a program for the debugger user to be able to verify the status of the loaded program after a certain instruction. When an instruction, in the Dis-Assembly window, is double-clicked on, a breakpoint is set on the instruction. 1-38

The associate breakpoint window can be launched by executing the Associate Breakpoints command in the Options menu. A window can be continuously refreshed by using the associate breakpoint feature. A selected display window (Graph display, Memory display, CPU Register display,...) can be associated with any breakpoint. When a breakpoint is executed any display windows that are associated with it are updated. This effectively connects a probe to a specific point in the program. PROCEDURE The Assembler and Directives In this procedure section, you will assemble a source file and familiarize yourself with the assembler source code directives. 1-39

* 1. Open the ex1_2.asm file inside of a text editor. * 2. Find, inside of the source code, the directives instructing the assembler where to store program instructions and data variables. See HELP Unit 01 shelp4 At what program memory address does the program code start? a. 1280h b. 080Ah c. 0A80h d. 0980h Note: The source file contains entries that begin with.include. The.include directive tells the assembler to read source statements from a different file. The.include directive has been used to eliminate complicated initialization subroutines from the main source file. * 3. Notice that the source code contains a wavetable within a.include directive. The.ds assembler directive used before the.include directive instructs to which data memory address (dma) the DSP must begin writing the wavetable values. 1-40 * 4. Assemble the program by executing, within the c:\lv91027\exercise\ex1_2\ folder, the following code at a DOS prompt: C:\lv91027\bin\dsk5a.exe ex1_2.asm -l

* 5. Confirm that a program file (ex1_2.dsk) and a listing file (ex1_2.lst) were created when the source file was assembled. * 6. Open the listing file inside of another text editor. Observe the contents of the file. What assembler directive is used to store the wavetable data variables to DSP memory? a..word b. SPLK c..entry d. ADD * 7. Close the source code and the listing file text editor windows. Viewing Memory In this procedure section, you will open a Memory display window inside of the C5x VDE. Note: Before using the C5x VDE please make certain the circuit board power source is turned ON, and that the serial connection is present between the host computer and the DIGITAL SIGNAL PROCESSOR circuit block labeled SERIAL PORT. * 8. Open the C5x VDE and using the Load Program command, found in the C5x VDE File menu, load the ex1_2.dsk program into the DSP. 1-41

* 9. Open a Data Memory window to the first wavetable value held within the dma labeled C0 (use a capital C). This window can be launched by executing the Memory command in the View menu. What do the blue symbols (C0, C9, C19, C29,...) within the Data Memory window represent? a. Natural divisions of the C5x VDE Data Memory window. b. Memory addresses. c. Wavetable values. d. Source statement labels contained in the source file. A wavetable is used to generate a waveform. It is a list of sample points representing one period of the waveform to be generated. The technique makes a train of discrete samples become a seemingly continuous signal. 1-42

Graphing Memory In this procedure section, you will view DSP memory graphically and use the Graphical display to gather information about the wavetable of the current program. * 10. Launch the Graphic Display window with the Graph command found in the View menu. To visualize the wavetable data enter the setup information that is found in the above figure (use a capital for C0). * 11. Note that by clicking in the Graphic Display window a cursor line appears. The coordinates of the point where the cursor line and the graphed curve cross is displayed at the bottom of the window. * 12. Locate the maximum value of the wave signal shown in the Graphic Display window. Input the x-coordinate (time) of the maximum value. t MAX = ms * 13. Locate the minimum value of the wave signal shown in the Graphic Display window. Input the x-coordinate (time) of the minimum value. t MIN = ms What is the frequency of the wavetable signal? f = Hz 1-43

* 14. Inside of the Data Memory window edit to 0 the data at DSP memory location C549 (by double-clicking) and refresh the wavetable Graphic Display window(using the Windows toolbar menu). Observe the change caused on the wave signal in the Graphic Display window. * 15. Change the wavetable value back to the original value of 1F0E. Refresh the Graphic Display window. * 16. Connect the OUTPUT of the DC SOURCE to the ANALOG INPUT of the CODEC. * 17. Connect the ANALOG OUTPUT of the CODEC to the INPUT of the AUDIO AMPLIFIER and to the input of an oscilloscope. * 18. Run the DSP program (the RUN command can be found on the C5x VDE toolbar). Use the GAIN of the AUDIO AMPLIFIER to adjust the volume level of the generated signal. * 19. Observe the generated wave signal on the oscilloscope. Observe that the frequency of the generated signal is shown on the display of the I/O INTERFACE circuit block. * 20. Using the potentiometer of the DC SOURCE vary the frequency of the generated signal. 1-44

* 21. Using the oscilloscope, compare the frequency displayed in the I/O INTERFACE circuit block with the inferred frequency of the generated wave signal. What are the approximate frequency limits of the generated function? f MIN = Hz f MAX = Hz Breakpoints and Associated Breakpoints In this procedure section, you will create a breakpoint within the DSP program. With the aid of an associated breakpoint, you will view the variation with time of certain DSP register values. * 22. Execute the HALT command found on the C5x VDE toolbar. Place a breakpoint at the program memory address (pma) labeled MARKER1 by double-clicking within the dis-assembly window on the label(you might have to scroll down to find it). Run the DSP program. Which of the following sentences is correct? a. After a program is started the breakpoints disappear. b. The program memory address (pma) labeled MARKER1 cannot become a breakpoint. c. The program is automatically halted when an execution line reaches a breakpoint. d. All of the above. 1-45

* 23. Open a Peripheral Registers window. The Peripheral Registers window can be launched by executing the Peripheral Registers command inside of the View menu. * 24. Associate the MARKER1 breakpoint, set in step 22, with the Peripheral Registers window. To do so, make certain that the Peripheral Registers window is active(highlighted). Launch the Associate Breakpoint window by executing the Associate Breakpoints command inside of the Options menu. Fill the menu as show and press OK. * 25. Execute the ANIMATE command found on the C5x VDE toolbar. Make a note of the peripheral registers that are continuously updated. The DXR register represents the register where values are stored before being sent through the CODEC to the ANALOG OUTPUT. It is the stream of these values that create the signal seen on the oscilloscope. 1-46

* 26. Halt the program. To generate a signal with a low frequency, adjust the potentiometer of the DC SOURCE to the minimum position. * 27. Make the Graphic Display the current window within the C5x VDE and execute the Options command that is located on the Toolbar. * 28. Change the settings of the Setup for Graphics window to the ones shown in the figure above. * 29. Associate the breakpoint, placed at MARKER1 in step 22, with the Graphic Display window. Select to refresh the window only on the associated breakpoint. * 30. Animate the DSP program. * 31. While the program is in Animate mode, execute the Graphic Display Options command again. Change the graph from the Time Domain to the Frequency Domain: FFT. In the Frequency Domain: FFT Graphic Display mode, each spike represents the component of an individual frequency within the signal being observed. Because the program is currently generating a sine wave only one spike appears. * 32. To generate a signal with a high frequency, adjust the potentiometer of the DC SOURCE to the maximum position. Observe the effect of the frequency change inside of the Graphic Display window. 1-47

Editing Memory and Registers In this procedure section, using the C5x VDE you will edit a memory location as well as a CPU register. * 33. Halt the animation. Observe that the content of the Program Counter (PC) register is displayed within the C5x Registers window inside of the C5x VDE. The PC register stores the address of the next source statement to be executed. * 34. Note that the PC value corresponds to the address highlighted in yellow inside of the Dis-Assembly window. * 35. Edit the PC register by double-clicking it within the C5x Registers window. Edit the PC to the pma labeled MAIN. * 36. Note that the source statement now highlighted in yellow corresponds to the statement held within the pma labeled MAIN. This is a simple technique used for moving from one part of code to another. * 37. Close the C5x Visual Development Environment. CONCLUSION & A source statement has a very precise syntax. It contains a mnemonic, and the mnemonic operands. It may also contain a label and a comment. & Assembler directives supply the program with data and they control the assembly process. & When a source file (*.asm) is assembled, a program file (*.dsk) and a listing file (*.lst) are created. & The C5x VDE is the debugger used with the DIGITAL SIGNAL PROCESSOR circuit board. It gives the programmer the ability to diagnose DSP program problems and to control program execution. 1-48

REVIEW QUESTIONS 1. Out of the following possibilities which is the correct syntax for a source statement? a. MNEMONIC [OPERAND LIST] [LABEL] [; COMMENT] b. [LABEL][:] [OPERAND LIST] MNEMONIC [; COMMENT] c. [LABEL][:] MNEMONIC [; COMMENT] [OPERAND LIST] d. [LABEL][:] MNEMONIC [OPERAND LIST] [; COMMENT] 2. Which of the following choices best describes the function of assembler directives in the source code? a. They initialize program instructions and data values into memory. b. Assembler directives supply program data and control during the assembly process. c. They reserve space in memory for initialized variables. d. All of the above. 3. What step(s) must you perform to execute (Run) a dsk program from within the C5x VDE? a. Turn power on to the DIGITAL SIGNAL PROCESSOR circuit board and make the serial connection to the host computer. b. Open the C5x VDE. Using the Load Program command found in the File menu, load the dsk program into the DSP. c. Execute the Run command from the C5x VDE toolbar. d. All of the above. 4. Which among the following list of features of the C5x VDE is false? The C5x VDE lets you: a. Run and halt the program and execute single step commands (execution of single instructions). b. Edit, build, debug, profile and manage DSP projects (programs). c. Load dsk programs into memory and view the program code. d. Place breakpoints at DSP source statements. 1-49

5. Which of the following choices is the reason why Animate mode and Run mode within the C5x VDE are not the same? a. In Animate mode, the DSP is not used at all. The program is executed by the C5x VDE. b. In Run mode, the DSP is not used at all. The program is executed by the C5x VDE. c. In Animate mode, the DSP stops communication with the C5x VDE and the DSP begins independent execution of the program. d. In Run mode, the DSP stops communication with the C5x VDE and the DSP begins independent execution of the program. 1-50