DSP C5000 Chapter 4 Software Development Tools Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 2 Software Development Tools Code Composer Studio (CCS). CCS Development Starter Kit (DSK). DSK 5416 DSK 5510 Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 3 Code Composer Studio Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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. Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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. Copyright © 2003 Texas Instruments. All rights reserved. Assembly Conventions tabs or spaces label: colon optional mnemonic operand,operand ;comment 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 ESIEE, Slide 6 Copyright © 2003 Texas Instruments. All rights reserved. How Do We Build a Project ? Processing goal : z=x+y ESIEE, Slide 7 code get x add y store z loop .text .text LD @x,A #X,DP start: LD ADD LD @y,A @x,A STL ADD A,@z @y,A BSTL start A,*(z) B start constants x=2 y=7 variables x y .data .int .int 2 7 .bss z,1 z Copyright © 2003 Texas Instruments. All rights reserved. Instructions Used and On-line Help ESIEE, Slide 8 LD ADD STL Smem,dst Smem,dst src,Smem Copyright © 2003 Texas Instruments. All rights reserved. Linker Command File MEMORY { PAGE 0: VECS: PRAM: origin = 0080h, length = 0080h /* Internal Program RAM */ 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 } ESIEE, Slide 9 Copyright © 2003 Texas Instruments. All rights reserved. Memory Space and Software Sections Sections are placed into specific memory spaces via the linker. ESIEE, Slide 10 file1.asm Program (Internal/External) VECS .text .data PRAM .bss Data file2.asm (Internal/External) DSP Core .text .data .bss SCRATCH INRAM Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 11 Building the Executable File Equivalent Process .cmd Text Editor .asm -o .out .obj ASM500 -L .lst LNK500 Debug -m .map HEX500 Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 12 How to Create a Project under CCS Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 13 Building the Project Sum.asm Sum.cmd Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 14 Project Options Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 15 Project Build Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 16 Running the Program - Step by step - real time - Breakpoints Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 17 Memory and Register Display Copyright © 2003 Texas Instruments. All rights reserved. Assembler Directives and Data Types Basic Directives .sect create initialized named section for code or data .usect create uninitialized named section for data .byte 8-bit constant word-aligned .int (.word) 16-bit constant .long 32-bit constant .ref/.def used for symbol references .global .ref and .def combined .set/.equ equate a value with a symbol* .asg assign an assembly constant*. Will display in debugger ESIEE, Slide 18 Data Types 10 0Ah, 0xA 1010b, 1010B Decimal (default) Hexadecimal Binary * takes no memory space Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 19 Visual Linker 1 of 2 Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 20 Visual Linker 2 of 2 Copyright © 2003 Texas Instruments. All rights reserved. Dynamic Graph Display 1 of 3 - Probe Point Insertion ESIEE, Slide 21 Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 22 Dynamic Graph Display 2 of 3 -Display configuration -Start adresse : z -Acq buffer size : 1 -Display size : 40 -Data type : 16 bits unsigned Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 23 Dynamic Graph Display 3 of 3 Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 24 DSK5416 Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 25 DSK5416 Block Diagram Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 26 DSK5416 Hardware Resources TMS320VC5416 Internal APLL and 16Mhz Xtal 128 Kwords of on chip RAM 16 Kwords of on chip ROM 1 Timer 3 McBSP 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) McBSP 2 may be used for audio codec 6 DMA Channel 16 bit EMIF interface 8/16 bit Host Port Interface Copyright © 2003 Texas Instruments. All rights reserved. DSK5416 Internal Memory Resources Internal Memory Details ESIEE, Slide 27 Depends on DROM and OVLY values (PMST register) (as set by C5416_dsk.gel and MP/MC pin (JP4)) : 4x8Kwords DARAM (0080h-7FFFh) Data. Also map in (xx0000h-xx7FFFh) Program with OVLY=1 4x8Kwords DARAM (018000h-01FFFFh) Program. DROM=1, OVLY=1 and MP/MC=0 Also map in (8000h-FFFFh) Data with DROM=1 4x8Kwords SARAM (028000h-02FFFFh) Program. 4x8Kwords SARAM (038000h-03FFFFh) Program. Copyright © 2003 Texas Instruments. All rights reserved. DSK5416 External Memory Resources External Memory Configured by DM CNTL register located at IO@0005h. 64Kwords SRAM 2x32Kwords (SR PAGE0 and SR PAGE1): 1MEMTYPE ESIEE, Slide 28 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: 000000h-007FFFh if OVLY=0, SR PAGE1: 008000h-00BFFFh always, 00C000h-00FF80h if MP/MC=1. DS, MEMTYPE PS, DM PG[4..0] are bits field of DM CNTL register. Copyright © 2003 Texas Instruments. All rights reserved. DSK5416 Flash Memory Resources 256Kwords Flash memory 8x32Kwords (F_PAGE0 through F_PAGE7): 1MEMTYPE ESIEE, Slide 29 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: 000000h-007FFFh if OVLY=0, F PAGE1: 008000h-00BFFFh always, 00C000h00FF80h 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. DS, MEMTYPE PS, DM PG[4..0] are bits field of DM CNTL register. Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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 Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 31 DSK5416 Default Memory Map Check memory from CCS Copyright © 2003 Texas Instruments. All rights reserved. DSK5416 Hardware Resources Four switches and LEDs ESIEE, Slide 32 Provided for user application Read and driven through USER REG (IO@0000h) 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. Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 33 Tutorial : LedSwitch 1 of 6 Create a new project called LedSwitch Modify call option in « Project>Options » and select « far » Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 34 Tutorial : LedSwitch 2 of 6 Set a new configuration file (*.cdb) Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 35 Tutorial : LedSwitch 3 of 6 Save (File>Save) the new configuration file under the project directory Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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). Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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 satisfactory message after build … Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 38 Tutorial : LedSwitch 6 of 6 Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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 (IO@0002h) and CODEC H (IO@0003h) to send command word to the codec. CODEC CLK (IO@0007h) to set the sampling frequency. MISC[7] and MISC[0] (IO@0006h) for status. Copyright © 2003 Texas Instruments. All rights reserved. DSK5416 Hardware Resources Analog Interface Input Analog Interface Output ESIEE, Slide 40 DAC outputs are send to both outputs : line and Speaker through an audio power amplifier for this one. Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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 : Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 42 DSK 5510 Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 43 DSK 5510 Block Diagram Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 44 DSK 5510 Hardware Resources TMS320VC5510 Internal DPLL and 24Mhz Xtal 160 Kwords of on chip RAM 16 Kwords of on chip ROM 2 Timers 3 McBSP From 6 Mhz to 200 Mhz. (CLKMD register IO@1C00h) Run at 200 Mhz after default boot. McBSP 1 & 2 may be used for audio codec 6 DMA Channel 32 bit EMIF interface 16 bit Enhanced Host Port Interface Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 45 DSK 5510 Memory Resources Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 46 DSK 5510 Default Memory Map Check memory from CCS Copyright © 2003 Texas Instruments. All rights reserved. DSK 5510 Hardware Resources Four switches and LEDs ESIEE, Slide 47 Provided for user application Read and driven through USER REG (DATA@300000h1) 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. Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 48 Tutorial : LedSwitch 1 of 6 Create a new project called LedSwitch Modify memory model in « Project>Options » and select « large memory model » Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 49 Tutorial : LedSwitch 2 of 6 Set a new configuration file (*.cdb) Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 50 Tutorial : LedSwitch 3 of 6 Save (File>Save) the new configuration file in the project directory Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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). Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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 satisfactory message after build … Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 53 Tutorial : LedSwitch 6 of 6 Copyright © 2003 Texas Instruments. All rights reserved. DSK5510 Hardware Audio Resources ESIEE, Slide 54 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. Copyright © 2003 Texas Instruments. All rights reserved. DSK5510 Hardware Resources Analog Interface Input Analog Interface Output ESIEE, Slide 55 DAC outputs are send to both outputs : line and Speaker through an internal audio power amplifier for this one. Copyright © 2003 Texas Instruments. All rights reserved. DSK5510 Audio Tutorial ESIEE, Slide 56 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 : Copyright © 2003 Texas Instruments. All rights reserved. Further Activities ESIEE, Slide 57 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. Copyright © 2003 Texas Instruments. All rights reserved.