Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 4 Software Development Tools

Similar presentations


Presentation on theme: "Chapter 4 Software Development Tools"— Presentation transcript:

1 Chapter 4 Software Development Tools
DSP C5000 Chapter 4 Software Development Tools

2 Software Development Tools
Code Composer Studio (CCS). Development Starter Kit (DSK). CCS CCS and DSK offer powerful low-cost development platforms for digital signal processing (DSP). Code Composer Studio (CCS) is an Integrated Design Environment (IDE) that facilitates software development. Development Starter Kits (DSKs) are versatile boards that connect to a PC to run practical signal processing applications. They are based on ‘C5416 and ‘C5510 processors respectively and contain memory and audio interfaces. DSK 5416 DSK 5510

3 Code Composer Studio Code Composer Studio (CCS) consists of multiple windows. At the bottom left you have the « project window » where you can manage the software project you are working on. At the bottom right you have the « edit window », that is used to display and memory contents. An important window is the « disassembly window » that displays the reverse assembly from the program memory of the DSP. The yellow arrow and the red point on the left margin of the « disassembly » window indicate respectively the current position where in code the DSP program is halted (here at the address 0xFF80), and the position of a break point. Around those window are icons that are short-cuts to useful actions such as run, step, halt, … All these actions can be accessed through the menus at the top of the screen.

4 Code Composer Studio Debugging Loading of the executable code.
Running in real-time or step by step. Breakpoints. Profiling. Saving memory contents in a file. Waveform representation of memory contents. CCS offers a complete framework for program debugging … Waveform representation of memory content: It is possible to plot with CCS the content off memory and to choose different option for the plot: - temporal plot - Frequency plot (using a Fast Fourier Transform) - Eye diagram or constellation for digital communications - …

5 To Build an Executable File
Source files (C,C++ and/or assembly) (*.c,*.asm) Text files with strict syntax checking, especially for assembly language *.asm. Linker command file (*.cmd) Project file (*.pjt) : Act as a makefile for CCS. Defines all the source files and the linker command file needed to build an executable file.

6 Assembly Conventions Any printable ASCII text is allowed.
tabs or spaces label: mnemonic operand,operand ;comment colon optional instruction or directive Any printable ASCII text is allowed. Use .asm extension for file Instructions and directives cannot be in first column Comments O.K. in any column after semicolon All the DSP instructions or directives must be in the second column. Directives are specific commands that are used to give particular requirements to the assembler or to the linker, for example, where in memory to place variables.

7 How Do We Build a Project ?
Processing goal : z=x+y .text LD #X,DP STL A,*(z) B start .text code STL B start start: get x add y store z loop constants .data x .int 2 y .int 7 We will use this simple example to show the basic steps of building a project and to illustrate the main parts of a program and the main types of data. The goal here is to realize the simple arithmetic operation z=x+y, where x and y are memory locations initialized with specific values and z is a memory location that will store the result. We can distinguish three kinds of data. First, the code part that will be made of the hexadecimal translation of the instructions used to implement the desired algorithm. Second, constant data for which we need to be able to allocate and initialize memory space. And finally dynamic data for which we need only to make memory allocation. These three parts will be indentified in the source file by pre-processing directives (which must be in the second column). Each of them begin with a dot (.text, .data, …). In the above example we have two kinds of directive. The first group (.text, .data, .bss) to identify respectively code, initialized data and dynamic data. For this last part the directive has two operands: a symbolic label z to an address at the beginning of the allocated space and a number to specify the size in word of the allocated space. The second group concern the initialization of data in the « .data » section. The first field is optional and is used to specify a symbolic label to access the required memory, the « .int » directive indicates a 16-bit data value and the operand field contains the initialization value. An alternative way to obtain the same result could be : .data X .int 2,7 Y .set X+1 where the directive « .set » allows us to make a computation on symbolic label. x = 2 y = 7 variables .bss z,1 z

8 Instructions Used and On-line Help
LD Smem,dst ADD Smem,dst STL src,Smem From CCS online help can be found for the instruction set of the specified DSP.

9 Linker Command File MEMORY {
PAGE 0: VECS: origin = 0080h, length = 0080h /* Internal Program RAM */ PRAM: origin = 100h, length = 1f00h /* Internal Program RAM */ PAGE 1: SCRATCH: origin = 0060h, length = 0020h /* Scratch Pad Data RAM */ INRAM: origin = 2000h, length = 1fffh /* Internal Data RAM */ } SECTIONS .text > PRAM PAGE 0 .data > INRAM PAGE 1 .bss > SCRATCH PAGE 1 The Linker Comand File tells the linker where the code, data etc. are found on the DSP chip. It is processor specific. The linker command file is made of two parts : The « MEMORY » section which identifies the physical memory resource of the target hardware. « PAGE0 » identifies program memory space and « PAGE1 » data memory space. For this instance we have a memory bank with symbolic name « PRAM » in program memory space starting at address « 0x100 » and having a length of « 0x1F00 » words. The « SECTIONS » section targets the different parts of the source files into the specified memory banks, for example all the « .text » parts of the input files will be targeted into the program space memory bank called « PRAM ». It must be emphasized that there could be several «.text » segments in a source file and there could be many source files.

10 Memory Space and Software Sections
Sections are placed into specific memory spaces via the linker. Program (Internal/External) file1.asm VECS .text PRAM .data DSP Core .bss Data (Internal/External) file2.asm This slide illustrates the linking process in the case of multiple source files .text SCRATCH .data .bss INRAM

11 Building the Executable File
Equivalent Process .cmd -o .out Text Editor ASM500 LNK500 Debug .asm .obj .lst -L .map -m The build of the executable file is conducted by clicking the right icon (either Rebuild or Incremental). The underlying process consists of compiling for C source files and/or assembly for ASM source files, the outputs of which are object files (*.obj) that are linked together into an executable file (*.out) using the information provided by the linker command file (*.cmd) and the linker application. HEX500

12 How to Create a Project under CCS
Once the new project is created, a virtual directory tree appears in the project window.

13 Building the Project Sum.asm Sum.cmd
At least two files must added to an empty project : A source file. A linker command file. This could be done either by choosing the « Project>Add files to project .. » menu, or by choosing « Add Files .. » in the pop-up menu that appears when right-clicking the mouse over the project name in the project window

14 Project Options Project options can be set up if necessary such as the program entry point. here being set to the symbolic label « start ». In this way the program counter of the DSP is loaded with the address of the label when the program is loaded into the program memory of the DSP.

15 Project Build Once all the necessary files have been gathered in project, it could be build thanks to « rebuild » or « incremental build » icons or from « Project>build » menu. It must be pointed out that « Project>Compile » does not build an executable file, but only object files. Once the project have been build, the executable file have to be loaded in the program memory of the DSP. A safe configuration choice could be « Load Program after Build » set up in the « Option>Customize » menu. In this way the executable file is automaticaly reloaded in the program memory of the DSP after new code generation.

16 Running the Program - Step by step - real time - Breakpoints
Once the program is loaded, it can be executed, either step by step or at full speed. Many tools are provided for debugging, one of the most common are the breakpoints (highlighted by a red point in the left margin of the program being runned). When the program is stopped either by a breakpoint or by a « Debug>halt » command or by short cuts « Shift F5 », the contents of memory and CPU registers can be checked (and evnetually modified) to check the program. To look at the memory contents use « View>Memory » to pop up the « Memory Window Options » shown on the next slide.

17 Memory and Register Display
The « Memory Window Options » allows us to specify data or program memory. The address can be absolute or symbolic. The CPU registers can be accessed via « View>CPU Registers>CPU Registers ». Each value can be modified directly on register or memory window.

18 Assembler Directives and Data Types
Basic Directives Data Types .sect create initialized named section for code or data .usect create uninitialized named section for data 10 Decimal (default) 0Ah, 0xA Hexadecimal 1010b, 1010B Binary .byte 8-bit constant word-aligned .long 32-bit constant .int (.word) 16-bit constant .ref/.def used for symbol references In « sum.asm » we have seen some directives. Here are some more: .sect and .usect are used to create named section to be handled specifically by the linking process. .ref, .def and .global are special directives for symbolic labels. By default a label is only visible inside the source file where it is declared. To be referenced outside of this program it must declared as operand of a .def directive in its origin source file and as an operand of .ref directive in the source file where it is used as a reference. Alternatively we could use .global directive in both cases. .global .ref and .def combined .set/.equ equate a value with a symbol* .asg assign an assembly constant*. Will display in debugger * takes no memory space

19 Visual Linker 1 of 2 The linking process could use another method than the linker command file (*.cmd) as seen previously. It could use the visual linker which could be run from CCS. To use visual linker we have to proceed according to the following steps : First the visual linker must be selected for the link process using the menu « Tools>Linker Configuration ». Create a linker recipe that will be used by the link process using « File>New>Visual Linker Recipe. A wizard will be run and you have to provide some directives, one of them is the name of a file containing the description of the physical memory available on the target. This information can be extracted from the traditionnal *.cmd file (memory section) or provided by a specific file (*.mem) many of them are provided in the Templates directory of visual linker installation directory for each DSP.

20 Visual Linker 2 of 2 Once this has been done all the sections can be graphically allocated to specific memory banks. The result of such process is shown on this slide.

21 Dynamic Graph Display 1 of 3
- Probe Point Insertion The contents of a memory word or memory bank can be displayed as a graph. The graph could be static or refresh by a specific event. We will give an overview the second case and the first will be obvious. The event that will refresh a graph will be a probe point. Each time the program reaches a probe point a specific action allocated to it will be run. The first task is to insert the probe point, This can be done by the icon « Toggle Probe Point ». The program used to illustrate this functionality generates a sawtooth signal by reading sample value in a look-up table writing them one after the other in a memory (z). We will display this memory content.

22 Dynamic Graph Display 2 of 3
Display configuration Start adresse : z Acq buffer size : 1 Display size : 40 Data type : 16 bits unsigned Then a kind of graph must be chosen and configured.

23 Dynamic Graph Display 3 of 3
The probe point must be connected to the graphical display. Use « Debug>Probe Points… », select the right probe point and choose to connect it to Graphical Display (the title of the graphic window) and choose replace button. You can then run the program (F5 short cut key or « Debug>Run ») and the graphic display is refreshed each time the program goes over the probe point by an amount of data specified in the acquisition buffer size of graphic properties window (see previous slide).

24 DSK5416 The DSK5416 is a development board embedding a TMS320VC5416 DSP, interface for CCS through USB or JTAG header (requires a XDS510 family tool) for software development and debug, some « human interface » components: leds, switch, audio interface, and finally three expansion buses to extend the system through hardware add-on boards.

25 DSK5416 Block Diagram The expansion capabilities are emphasized on this block diagram. There are three expansion interfaces connected to three different interface of the DSP: Expansion Memory InterFace (EMIF) bus: intended for memory Peripheral Interface: for I/O, Serial, … Special Interface: linked to Host Port of the DSP

26 DSK5416 Hardware Resources
TMS320VC5416 Internal APLL and 16Mhz Xtal Up to 160 Mhz. (CLKMD register) Reset value set by JP4 on board : Default settings : 32Mhz (x2) Running value set by startup GEL file: 160 Mhz (x10) 128 Kwords of on chip RAM 16 Kwords of on chip ROM 1 Timer 3 McBSP McBSP 2 may be used for audio codec 6 DMA Channel 16 bit EMIF interface 8/16 bit Host Port Interface

27 DSK5416 Internal Memory Resources
Internal Memory Details Depends on DROM and OVLY values (PMST register) (as set by C5416_dsk.gel and MP/MC pin (JP4)) : DROM=1, OVLY=1 and MP/MC=0 4x8Kwords DARAM (0080h-7FFFh) Data. Also map in (xx0000h-xx7FFFh) Program with OVLY=1 4x8Kwords DARAM (018000h-01FFFFh) Program. Also map in (8000h-FFFFh) Data with DROM=1 4x8Kwords SARAM (028000h-02FFFFh) Program. 4x8Kwords SARAM (038000h-03FFFFh) Program.

28 DSK5416 External Memory Resources
Configured by DM CNTL register located at 64Kwords SRAM 2x32Kwords (SR PAGE0 and SR PAGE1): Data: (MEMTYPE DS1=1) All pages, specified by DM PG[4..0]1, are seen in the (8000h-FFFFh) address space if DROM=0. Program: (MEMTYPE PS1=1), mapped on : SR PAGE0: h-007FFFh if OVLY=0, SR PAGE1: h-00BFFFh always, 00C000h-00FF80h if MP/MC=1. 1MEMTYPE DS, MEMTYPE PS, DM PG[4..0] are bits field of DM CNTL register.

29 DSK5416 Flash Memory Resources
256Kwords Flash memory 8x32Kwords (F_PAGE0 through F_PAGE7): Data: (MEMTYPE DS1=0) All pages, specified by DM PG[4..0]1, are seen in the (8000h-FFFFh) address space if DROM=0. Program: (MEMTYPE PS1=0), mapped on : F PAGE0: h-007FFFh if OVLY=0, F PAGE1: h-00BFFFh always, 00C000h-00FF80h if MP/MC=1, F PAGE[2/4/6]: 0[1/2/3]0000h-0 [1/2/3]7FFFh if OVLY=0, F PAGE[3/5/7]: 0[1/2/3]8000h-0 [1/2/3]FFFFh if MP/MC=1. 1MEMTYPE DS, MEMTYPE PS, DM PG[4..0] are bits field of DM CNTL register.

30 DSK5416 Default Memory Map Status bit values:
MEMTYPE DS=1, MEMTYPE PS=0, MP/MC=0, DROM=1, OVLY=1. Data memory Program memory

31 DSK5416 Default Memory Map Check memory from CCS

32 DSK5416 Hardware Resources
Four switches and LEDs Provided for user application Read and driven through USER REG USER REG[3..0]: drive leds USER REG[7..4]: read switches value. Tutorial : Create a project (LedSwitch) that will read switch position (ON/OFF) and that will set the corresponding Leds depending on the switch value.

33 Tutorial : LedSwitch 1 of 6
Create a new project called LedSwitch Modify call option in « Project>Options » and select « far » About « far » see Chapter2 « Architecture »

34 Tutorial : LedSwitch 2 of 6
Set a new configuration file (*.cdb)

35 Tutorial : LedSwitch 3 of 6
Save (File>Save) the new configuration file under the project directory You can check in Global Settings that DSP5416 is selected

36 Tutorial : LedSwitch 4 of 6
Add to the project two of the files generated at the previous step: the configuration file (*.cdb) and the linker command file (*.cmd).

37 Tutorial : LedSwitch 5 of 6
Create the main source file : LedSwitch.c which should include the header file generated at the configuration step and add it to the project. You are now able to get this satis- factory message after build …

38 Tutorial : LedSwitch 6 of 6
In the options of the project specify the use of « dsk5416f.lib » which contains C functions to access the hardware of the DSK board. Now you have a framework that you can add to in order to realize the desired application. Once the program is completed, you build, load and run it. You must see the leds switching on and off as you toggle the switch.

39 DSK5416 Audio Resources Audio CODEC (PCM3002) : stereo codec
x64 oversampling DS ADC-DAC converter: 16 bits, 48 kHz (default settings) (possible sampling frequency are 24 , 12, 8, 6 kHz). Use McBSP 2 for data I/F to the DSP Control I/F is done through CPLD registers: CODEC L and CODEC H to send command word to the codec. CODEC CLK to set the sampling frequency. MISC[7] and MISC[0] for status.

40 DSK5416 Hardware Resources
Analog Interface Input Analog Interface Output DAC outputs are send to both outputs : line and Speaker through an audio power amplifier for this one. Mic and Line input are summed in an analog way. The gain of the Mic input can be trimmed by means of a potentiometer (R33)

41 DSK5416 AudioTutorial Write a program that takes input samples from the ADC and writes back them to the DAC. Create a new project, then add this configuration file audioIO.cdb (which configures McBSP2), the function main( ) could be this one : The (#include) part takes the header file generated by the configuration step « audioIOcfg.h », the header file that allows to use specific functions for DSK5416 and another one for further declaration specific to PCM3002. Then there is an array « setup » which contains configuration value for the «program register » of the PCM3002. (refer to datasheet). The main program declare an handle to access to the codec. The board is initialized through « DSK5416_init() » as in the previous tutorial. The codec is opened with initialization array as a parameter. The sampling frequency is set to 8 kHz. Then the program enter in an infinite loop, where it waits for something to read from the ADC. As soon as the ADC sends a sample it is written back to the DAC, then the program wait again for a new sample.

42 DSK 5510 The DSK5510 is a development board embedding a TMS320VC5510 DSP, interface for CCS through USB or JTAG header (requires a XDS510 family tool) for software development and debug, some « human interface » components : LEDs, switches, audio interface, and finally three expansion buses to extend the system through hardware add-on board.

43 DSK 5510 Block Diagram The expansion capacities shown on this block diagram are three expansion interfaces connected to three different interface of the DSP : Expansion Memory InterFace (EMIF) bus : intended for memory Peripheral Interface : for I/O, Serial, … Special Interface : linked to Host Port of the DSP

44 DSK 5510 Hardware Resources
TMS320VC5510 Internal DPLL and 24Mhz Xtal From 6 Mhz to 200 Mhz. (CLKMD register Run at 200 Mhz after default boot. 160 Kwords of on chip RAM 16 Kwords of on chip ROM 2 Timers 3 McBSP McBSP 1 & 2 may be used for audio codec 6 DMA Channel 32 bit EMIF interface 16 bit Enhanced Host Port Interface EMIF Interface : glueless to asynchronous memory (SRAM, EPROM) and synchronous memory (SDRAM, SBSRAM).

45 DSK 5510 Memory Resources For the 320C55x, the memory space is unified : it can be accessed either through data space or program space. Internal memory Dual Access Ram (DARAM) 8x4Kwords block are mapped from 30h to 7FFFh, each block allows for two simultaneous access. Single Access Ram (SARAM) 32x4Kwords block are mapped from 8000h to 27FFFh, each block allows for one access (without wait state) External memory SDRAM is interface through 32 bits EMIF interface and it is clocked at 100Mhz (one half of the DSP). Only 32 Mbit over its 64 Mbit are seen in CE0 space, the remaining 32Mbit are lost. 256Kx16 FLASH EPROM is mapped in the lower part of CE1 space, it have an asynchronous access time of 80 ns. This Flash EPROM is used in the default boot configuration of the DSK5510

46 DSK 5510 Default Memory Map Check memory from CCS

47 DSK 5510 Hardware Resources
Four switches and LEDs Provided for user application Read and driven through USER REG USER REG[3..0]: drive leds USER REG[7..4]: read switches value. Tutorial : Create a project (LedSwitch) that will read switch positions (ON/OFF) and that will set the corresponding LEDs depending on the switch values. 1Because of unified memory space, it can be decoded in data or prog memory space.

48 Tutorial : LedSwitch 1 of 6
Create a new project called LedSwitch Modify memory model in « Project>Options » and select « large memory model » About « large memory model » see Chapter2 « Architecture »

49 Tutorial : LedSwitch 2 of 6
Set a new configuration file (*.cdb)

50 Tutorial : LedSwitch 3 of 6
Save (File>Save) the new configuration file in the project directory You can check in Global Settings that DSP5416 is selected

51 Tutorial : LedSwitch 4 of 6
Add to the project two of the files generated at the previous step: the configuration file (*.cdb) and the linker command file (*.cmd).

52 Tutorial : LedSwitch 5 of 6
Create the main source file : LedSwitch.c which needs to include the header file generated at the configuration step and add it to the project. You are now able to obtain this satis- factory message after build …

53 Tutorial : LedSwitch 6 of 6
In the options of the project specify the use of the library « dsk5510bslx.lib » which contains C functions to access the hardware of the DSK board. Now you have a framework that you can use as the starting point for the particular application. Once the program is completed, you build, load and run it. In this case you will see the LEDs switching on and off as you toggle the switches.

54 DSK5510 Hardware Audio Resources
Audio CODEC (TLV320AIC23) : Stereo codec with selectable line and microphone inputs and both line and headphones outputs. x250 or x272 oversampling DS ADC-DAC converter: 16 bits, 48 kHz (default settings) (possible predefined sampling frequency are 44.1, 32, 24 ,16, 8 kHz). Use McBSP 2 for data interface. Use McBSP 1 in SPI mode to control interface. Here the Greek letters mean Delta-Sigma converter.

55 DSK5510 Hardware Resources
Analog Interface Input Analog Interface Output DAC outputs are send to both outputs : line and Speaker through an internal audio power amplifier for this one. Microphone and Line Inputs (Left Line In and Right Line In) are selected through a multiplexer. The gain of the Microphone can be set either to 0dB or 20dB, to suit the sensitivity of the microphone being used. The gain of the line inpust are programmable from –34.5dB to 12 dB in 1.5 dB steps, where 0dB is 0.775V into 600 Ohms.

56 DSK5510 Audio Tutorial Write a program that takes input sample from ADC and write back them to the DAC. Create a new project, then add this configuration file audioIO.cdb (which configure McBSP 1 and 2), the shape of main could be this one : The (#include) part takes the header file generated by the configuration step « audioIOcfg.h », the header file that allows to use specific functions for DSK5510 and another one for further declaration specific to TLV320AIC23. Then there is an array « setup » which contains configuration value for TLV320AIC23. (refer to datasheet). The main program declares an handle to access to the codec. The board is initialized through « DSK5510_init() » as in the previous tutorial. The codec is opened with initialization array as a parameter. The sampling frequency is set to 8 kHz. Then the program enters in an infinite loop, where it waits for something to read from the ADC. As soon as the ADC sends a sample it is written back to the DAC, then the program waits again for a new sample.

57 Further Activities Application 1 for the TMS320C5510 DSK:
The first in a series of applications to show practical applications of Digital Signal Processing (DSP) with the TMS320C5510 DSK. Template for an audio project. Sets up the audio codec, the 4 user switches to control the program and the 4 LEDs to act as a bargraph display. This project template can be used as the starting point for new projects.


Download ppt "Chapter 4 Software Development Tools"

Similar presentations


Ads by Google