Lecture 04 DSP/BIOS. Chapter 4 DSP/BIOS Part 1 - Introduction.

Slides:



Advertisements
Similar presentations
Yaron Doweck Yael Einziger Supervisor: Mike Sumszyk Spring 2011 Semester Project.
Advertisements

Real-Time Library: RTX
Chapter 4 DSP/BIOS. DSP/BIOS Part 1 - Introduction.
CSE Fall Introduction - 1 What is an Embedded Systems  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
ECE Department: University of Massachusetts, Amherst Lab 1: Introduction to NIOS II Hardware Development.
Detailed Technical Feature Presentation Background Information The Importance of Software Software Roadblocks Development Environment DSP Development Cycle.
Anne Mascarin DSP Marketing The MathWorks
Performance Evaluation of Real-Time Operating Systems
Cortex-M3 Debugging System
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
The 6713 DSP Starter Kit (DSK) is a low-cost platform which lets customers evaluate and develop applications for the Texas Instruments C67X DSP family.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. D SP TEXAS INSTRUMENTS TECHNOLOGY 1.
Real-Time DSP System Design Course and DSP/BIOS II David J. Waldo Associate Professor Oklahoma Christian University 2501 E. Memorial Rd. Oklahoma City,
Introduction to Embedded Systems
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
1 I-Logix Professional Services Specialist Rhapsody IDF (Interrupt Driven Framework) CPU External Code RTOS OXF Framework Rhapsody Generated.
RM2D Let’s write our FIRST basic SPIN program!. The Labs that follow in this Module are designed to teach the following; Turn an LED on – assigning I/O.
CCS APPS CODE COVERAGE. CCS APPS Code Coverage Definition: –The amount of code within a program that is exercised Uses: –Important for discovering code.
FINAL MPX DELIVERABLE Due when you schedule your interview and presentation.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Getting Started with the µC/OS-III Real Time Kernel Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1.Introduction 2.Real-Time.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Chapter 101 Multiprocessor and Real- Time Scheduling Chapter 10.
Dr. R R DOCSIT, Dr BAMU. Basic Java : Multi Threading 2 Objectives of This Session State what is Multithreading. Describe the life cycle of Thread.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
DSP/BIOS Scheduling Chapter 9 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Lecture 04 DSP/BIOS. Chapter 4 DSP/BIOS Part 1 - Introduction.
Code Composer Studio & DSP/BIOS
32-Bit-Digital Signal Controller Texas Instruments Incorporated
Overview Task State Diagram Task Priority Idle Hook AND Co-Routines
Support Across The Board ™ Visual DSP Kernel (VDK)
Lab 2 Parallel processing using NIOS II processors
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
CS140 Project 1: Threads Slides by Kiyoshi Shikuma.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization Introduction.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
MicroC/OS-II S O T R.  MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2.  It.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Debugging TI RTOS TEAM 4 JORGE JIMENEZ JHONY MEDRANO ALBIEN FEZGA.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
DSP/BIOS for C6000/C5000. What is DSP/BIOS Real-time Environment –Thread execution model Threads, Mailboxes, Semaphores –Device independent I/O Logging,
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
DSP/BIOS Real Time Operating system using DSP /ARM processor.
SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 1 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Chapter 4 DSP/BIOS. DSP/BIOS Part 1 - Introduction.
REAL-TIME OPERATING SYSTEMS
Chapter Objectives In this chapter, you will learn:
Topics Covered What is Real Time Operating System (RTOS)
Background on the need for Synchronization
Lesson Objectives Aims Key Words Interrupt, Buffer, Priority, Stack
OPERATING SYSTEMS CS3502 Fall 2017
Chapter 4 DSP/BIOS.
TI’s DSP/BIOS Instrumentation 17 September 2018 Dr. Veton Këpuska.
CSE 153 Design of Operating Systems Winter 19
Chapter 3: Process Management
Presentation transcript:

Lecture 04 DSP/BIOS

Chapter 4 DSP/BIOS Part 1 - Introduction

Chapter 4, Slide 3 Learning Objectives  Introduce DSP/BIOS and its components.  Introduce the software tools for managing DSP/BIOS components and objects.  Run some examples.

Chapter 4, Slide 4DSP/BIOS  The DSP/BIOS is an operating system that can provide:  A graphical interface for static system setup.  Real-time scheduling.  Real-time analysis (RTA).  Real-time data exchange (RTDX).

Chapter 4, Slide 5 DSP/BIOS Components  The user writes code (‘C’/assembly) using the DSP/BIOS library.  The user can use the configuration tools to setup the system.  All the files generated constitute a project.

Chapter 4, Slide 6 DSP/BIOS Components  The project is then compiled, assembled and linked by the code generation tools in order to generate an executable file (*.out).  There are also some DSP/BIOS plug-ins that can be used, for instance, as program test while the target is running.

Chapter 4, Slide 7 DSP/BIOS Components  Code composer simulator/debugger and the host emulator support are also part of the code composer studio.  The host and target communicate through the JTAG (Joint Test Action Group) connection (ssya002c.pdf). ssya002c.pdf

Chapter 4, Slide 8 Graphical Interface for Static System Setup  Static system setup is performed using the DSP/BIOS GUI configuration tool.  The configuration tool has an interface similar to windows explorer.  It lets you:  Specify a wide range of parameters used by the DSP/BIOS real-time library.  Create run-time objects that are used by the target application’s DSP/BIOS API calls. Note: API: Application Programming Interface

Chapter 4, Slide 9 Graphical Interface for Static System Setup  The DSP/BIOS main objects are: (1)Hardware interrupts (HWI). (2)Software interrupts (SWI). (3)Tasks (TSK, IDL). (4)Data and I/O streams (RTDX, SIO, PIP, HST). (5)Synchronization and Communication (SEM, MBX, LCK). (6)Timing (PRD, CLK). (7)Logging and statistics (LOG, STS, TRC). For a complete list see: SPRU303.pdf (Page 1-5). SPRU303.pdf

Chapter 4 DSP/BIOS Part 2 - Real Time Scheduling

Chapter 4, Slide 11 Learning Objectives  What is a real-time scheduler?  Why do we need a real-time scheduler?  DSP/BIOS Thread Types.  Example.

Chapter 4, Slide 12 Real-time scheduling  Before embarking into real-time scheduling let us first state the problem: main () { for (;;); }ISR1(){algorithm1();}ISR2(){algorithm2();}  Once ISR1 or 2 is called, algorithm 1 or 2 runs to completion. Can this cause a problem?

Chapter 4, Slide 13 Real-time scheduling  Before embarking into real-time scheduling let us first state the problem: main () { for (;;); }ISR1(){algorithm1();}ISR2(){algorithm2();}  Once ISR1 or ISR2 is called, algorithm 1 or 2 runs to completion. Can this cause a problem? There is no guarantee of meeting the real-time deadlines because: (1)The algorithms can run at different rates. (2)One algorithm can overshadow the other. (3)The timing can be non- deterministic. etc.

Chapter 4, Slide 14 Real-time scheduling  The answer depends on the application.  If we want to process two algorithms in real-time then we have to answer the following questions:  Are ISR1 and ISR2 synchronized? If yes, then we can use only an ISR that processes both algorithms (assuming that we have enough processing power to complete algorithm 1 and 2 on time).  What happens if the algorithms are not synchronized?  Which algorithm has a higher priority?  Can the algorithm of lower priority be pre-empted (stopped)?

Chapter 4, Slide 15 Real-time scheduling  Example: Simple application.  System description:  Algorithm 1 and 2 are not synchronised.  Assume algorithm 1 has the highest priority.  Algorithm 2 can be pended. Algorithm 1 Algorithm 2 CPU processing Algorithm 1 CPU processing Algorithm 2 MISSED!  Remember: there is only one CPU and therefore only one algorithm can be processed at a time.

Chapter 4, Slide 16 Real-time scheduling  Example: Simple application.  Solution 1: Algorithm decomposition:  The algorithm can be decomposed into sub-functions:  When the CPU is not processing algorithm1 it can process one of the sub-functions (to completion) as shown: algorithm2 ();function1(); function2();function3(); Algorithm 1 Algorithm 2 function1function2function3

Chapter 4, Slide 17 Real-time scheduling  Example: Simple application.  Problems with this solution:  Difficult to write (as timing is critical).  Difficult to change (what happens if algorithm is modified or another algorithm is added).

Chapter 4, Slide 18 Real-time scheduling  Example: Simple application.  Solution 2: Using an operating system Advantages:  Easy to write (algorithms are written independently).  Easy to maintain or change (operating system takes care of the scheduling).  Enables fast time to market.  Which operating system? Depends on:  The processor being used.  The DSP platform (single/multi processors).

Chapter 4, Slide 19 Real-time scheduling: DSP/BIOS  For all TI DSPs there is a DSP/BIOS operating system which includes:  Small sized real-time library.  An API for using the library services.  Easy-to-use configuration tools.  Real-time analysis programs.  DSP/BIOS scheduling solution provides:  Fixed-priority preemptive scheduler.  Multiple thread types.

Chapter 4, Slide 20 Real-time scheduling: Terminology No preemption: Resources cannot be preempted; which means that the only way of releasing a resource is by the process of holding it. Object: Term for data and code structures provided by DSP/BIOS, e.g. an event, task, semaphore. Pending: Wait for an event Resource preemption: Release of a resource. Post: Signal an event, e.g. post a software interrupt, that is make a software interrupt ready. Preemption: A higher priority function (or thread) interrupts other functions (or threads) of lower priority. Priority scheduling: Priority scheduling can be either preemptive or non-preemptive. A preemptive priority scheduling algorithm will preempt (release) the CPU if another process of higher priority arrives. Process: A task or thread of execution. Scheduler: System software to manage the execution of threads. Scheduling: The planning used to share a resource. Semaphore: Synchronization system object that enables tasks to synchronize their activities. Thread: An independent function.

Chapter 4, Slide 21 DSP/BIOS Thread Types Priority HWI Hardware Interrupts  HWI priorities set by hardware One ISR per interrupt. HWI triggered by hardware interrupt. IDL runs as the background thread. What causes a SWI or TSK to run? SWI Software Interrupts  14 SWI priority levels Multiple SWIs at each level. TSKTasks  15 TSK priority levels Multiple TSKs at each level. IDLBackground  Multiple IDL functions Continuous loop.

Chapter 4, Slide 22 Triggering SWI or TSK SWI cannot pend. SWI always returns from function. SWI start end SWI_post “run to completion” TSK only returns when no longer needed, otherwise normally an infinite loop. TSK SEM_pend start end block SEM_post

Chapter 4, Slide 23 Considerations in Selecting Thread Types  Thread latency and data rates.  Multi-tiered response to interrupts:  HWI is fast (for sample-by-sample response time).  SWI is slower (triggered to process frame).  Priority of thread.  Stack needs:  O.K. to share system stack? then use SWI.  Need private stack? then use TSK.  Synchronization and communication methods:  SWI and TSK have different methods.  User preference or ease-of-use.

Chapter 4, Slide 24 Thread Preemption Example HWI SWI 2 SWI 1 IDL main() TSK 2 TSK 1 interrupt pend sem2 return interrupt interrupt pend sem1 interrupt return return post swi1 return post swi2 return post sem2 return post swi2 return post sem1 post sem2 return pend sem2 pend sem1 Events over time

Chapter 4, Slide 25 Laboratory Exercise Bios_Lab1  Laboratory objectives: (1) Create Project. (2) Create Configuration File (3) Set the internal timer 1 to generate ticks at 8kHz. (4) Set a hardware interrupt (HWI) that is triggered by internal timer 1. (5) Create a software interrupt (SWI) that can be posted by the hardware interrupt. (6) Create a task that can be posted by the hardware interrupt. (7) Create a semaphore (SEM) that can be used by the task functions.

Chapter 4, Slide 26 (1) Create New Project  How to create a configuration file:  Open CCS and create a new project and name it “bios_lab_1.pjt”.  Create a new configuration file by using a pre-built template file:File: New: DSP/BIOS Configuration  Double click on the “dsk6416.cdb” icon

Chapter 4, Slide 27 (2) Create Configuration File  How to create a configuration file:  After double click on the “dsk6416.cdb” icon the following configuration will appear:

Chapter 4, Slide 28 (2) Create Configuration File  How to create a configuration file:  Now that you have selected the.cdb, save it in your current working directory, e.g: MyProjects\BIOS_Lab1\bios_lab.cdb.  Finally, add the “*.cdb” configuration file to the project.

Chapter 4, Slide 29 (3) Setting Internal Timer 1 (1) Set a timer configuration by using the “Timer Configuration Manager”. (2) Right click, “Insert timerCfg” and call it “timerCfg0”. (2) Right click and set the properties: The GUI interface will generate the “bios_labcfg.c”, see bios_labcfg.pdf bios_labcfg.pdf Open CSL – Chip Support Library, and TIMER:

Chapter 4, Slide 30 (3) Setting Internal Timer 1  Open CSL – Chip Support Library, and TIMER:  Click on TIMER Resource Manager  Change Properties of Timer_Device1

Chapter 4, Slide 31 (3) Setting Internal Timer 1  Open CSL – Chip Support Library, and TIMER:  Change Properties of timerCfg0

Chapter 4, Slide 32 (4) Setting the Hardware Interrupt (1)In Scheduling session of cdb-API: (2)Select the “HWI - Hardware Interrupt Service …”. ( 3)Select HWI_INT13 and right click to select properties. Source = Timer_1 Function = _timerIsr

Chapter 4, Slide 33 (4) Setting the Hardware Interrupt (4)Write the Interrupt Service Routine in C. void timerIsr (void) { /* Put your code here */ }

Chapter 4, Slide 34 (5) Creating a Software Interrupt (1)In Scheduling session select the “SWI - Software Interrupt Manager” and create a new software interrupt called “SWI_for_algorithm_1”. (2)Change the properties of the “SWI_for_algorithm_1” to:

Chapter 4, Slide 35 (5) Creating a Software Interrupt (3)Create a software interrupt function in C. void algorithm_1 (void) { /* Put your code here */ }

Chapter 4, Slide 36 (6) Creating a Task (Background Task)  Open Scheduling, and TSK - Task Manager:  Insert Task  Click on TSK, change Name to TaskOneTsk  Change Properties

Chapter 4, Slide 37 void ProcessTask (void) { /* Put your algorithm here */ } (6) Creating a Task (3)Create a task function in C:

Chapter 4, Slide 38 (7) Creating a Semaphore (1)Open the cdb file and select the “SEM - Semaphore Manager” and create a new semaphore called “taskOneSem”. (2)Change the properties of the “taskOneSem” to:

Chapter 4, Slide 39 Posting Software Interrupts and Tasks (1)Software Interrupts The software interrupts can be posted simply by writing: (2)Tasks The task can be removed from semaphore queue and put it on the ready queue: SWI_post (&SWI_for_algorithm_1); SEM_post (&taskOneSem);

Chapter 4, Slide 40 More on Tasks…  A task can be pending where as Software Interrupts (SWI) run to completion.  Tasks normally run in an infinite loop and within the loop the task tests for a semaphore.  A task can preempt itself, e.g: void ProcessTask (void) { while (1) { SEM_pend (&taskOneSem, SYS_FOREVER); /* Insert your code here */ }}

Chapter 4, Slide 41 Putting it all together… void main (void) { /* Put all your setup code here */ return; /*DSP BIOS starts after the return */ } /* Hardware Interrupt */ void timerIsr (void) { /* Put your code here */ SWI_post (&SWI_for_algorithm_1); SEM_post (&taskOneSem); } /*Software Interrupt */ void algorithm_1 (void) { /* Put your code here */ } /* Task */ void ProcessTask (void) { while (1) { SEM_pend (&taskOneSem, SYS_FOREVER); /* Insert your code here */ }}

Chapter 4, Slide 42 Putting it all together… void main (void) { /* Put all your setup code here */ return; /*DSP BIOS starts after the return */ } /* Hardware Interrupt */ void timerIsr (void) { /* Put your code here */ SWI_post (&SWI_for_algorithm_1); SEM_post (&taskOneSem); } /*Software Interrupt */ void algorithm_1 (void) { /* Put your code here */ } /* Task */ void ProcessTask (void) { while (1) { SEM_pend (&taskOneSem, SYS_FOREVER); /* Insert your code here */ }}

Chapter 4, Slide 43 Putting it all together (main.c)… #include "bios_labcfg.h" #include #include void main (void); void algorithm_1 (void); void timerIsr (void); void ProcessTask (void); void main (void) { initApplication (); TIMER_start (hTimer1); return;} void timerIsr (void) {//HWI_INT15 is used to hook to timerIsr () int m=0; int i; /* This can be your critical algorithm */ /* This can be your critical algorithm */ for (i=1; i<10; i++) m = m+i; m = m+i; /* The end of your critical algorithm */ /* The end of your critical algorithm */ SWI_post (&SWI_for_algorithm_1); SWI_post (&SWI_for_algorithm_1); SEM_post (&taskOneSem); SEM_post (&taskOneSem);} void algorithm_1 (void) {// This is your software interrupt which printf ("The algorithm_1 has been reached \n"); } void ProcessTask (void) {// This is your task - You can reach this task if you comment out the printf in algorithm_1() while (1) { SEM_pend (&taskOneSem, SYS_FOREVER); printf ("The taskOne has been reached \n"); }}

Chapter 4, Slide 44 Finalization of the Project  We have Enable HW Interrupt using file #include "bios_labcfg.h" #include #include void initInterrupts(void); void initApplication(void) {initInterrupts();} void initInterrupts(void) { IER |= 0x ;/* Enable NMIE and INT13 */ IRQ_enable(IRQ_EVT_TINT1);/* Enable Timer1-to-CPU interrupt */ IRQ_globalRestore(1);/* Enable GIE */ }

Chapter 4, Slide 45 Finalization of the Project  Open System:  Click on Global Settings  Change Properties (DSP Speed) to 600MHz

Chapter 4, Slide 46 Finalization of the Project  Files used to create the DSP/BIOS program:  The abbreviation 62 is used for the C6000 processors. Programs generated by the user Programs/Files generated by the configuration manager

Chapter 4, Slide 47 Finalization of the Project  Files created by the configuration tools:  Once the Bios_Lab1.cdb file is modified, saved and added to the project, the configuration manager will create and load the following files:  Bios_labcfg.s62Assembly file  Bios_labcfg_c.cC file  Bios_labcfg.hHeader file for C  Bios_labcfg.h62Header file for assembly  A file called “Bios_labcfg.cmd” is also created but must be loaded by the user. Note:the user must add the *.cdb, *.cmd, *.h files to the project.

Chapter 4 DSP/BIOS Part 3 - Real Time Analysis Tools

Chapter 4, Slide 49 Learning Objectives  Introduction to the analysis tools.  Using the LOG module.  Using the STS module.  Defining DSP/BIOS objects using the configuration tools.  Example.

Chapter 4, Slide 50Introduction  Traditionally analysis was performed by halting the processor and examining variables or memory.  This traditional method is invasive and does not represent the reality of real-time issues.  Real-time analysis is the analysis of data acquired during real-time operation of a system without having to stop or interfere with the target.  The API’s and Plug-ins provided with DSP/BIOS enable the programmer to monitor data while the target is running.

Chapter 4, Slide 51Introduction  So how can data be monitored without stopping the target?  Target-host communications is performed in the background (IDL) thread (e.g. the CPU is performing NOPs or waiting for an interrupt).  Data formatting is done by the host and therefore releases the CPU to perform useful tasks.  For more details see Chapter 3 of the DSP/BIOS Users Guide (SPRU303.pdf). SPRU303.pdf

Chapter 4, Slide 52 DSP/BIOS - API Modules Instrumentation/Real-Time Analysis LOG Message Log manger STS Statistics accumulator manager TRC Trace manager RTDX Real-Time Data Exchange manager Thread Types HWI Hardware interrupt manager SWI Software interrupt manager TSK Multitasking manager IDL Idle function & processing loop manager Clock and Periodic Functions CLK System clock manager PRD Periodic function manger Comm/Synch between threads SEM Semaphores manager MBX Mailboxes manager LCK Resource lock manager Input/Output PIP Data pipe manager HST Host input/output manager SIO Stream I/O manager DEV Device driver interface Memory and Low-level Primitives MEM Memory manager SYS System services manager QUE Queue manager ATM Atomic functions GBL Global setting manager

Chapter 4, Slide 53 LOG Module  The LOG module contains functions that can be used to capture events in Real-Time while the target program is running.  Functions in LOG module: (1)LOG_disable( ):Disable the system log (2)LOG_enable( ):Enable the system log (3)LOG_error( ):Write a user error event to the system log (4)LOG_event( ):Append unformatted message to a message log (5)LOG_message( ):Write a user message to the system log (6)LOG_printf( ):Append a formatted message to a message log (7)LOG_reset( ):Reset the system log

Chapter 4, Slide 54 Moving from “printf” to the faster “LOG_printf”  How many cycles does the printf() function require? > 34000

Chapter 4, Slide 55 Moving from “printf” to the faster “LOG_printf”  Create directory \Bios_Lab2 and copy all files from project directory \Bios_Lab1  Create New Project Bios_Lab2  Add all *.c and bios_lab.cdb files to the project

Chapter 4, Slide 56 Moving from “printf” to the faster “LOG_printf” (1)Include the following headers in the main.c file: /* #include NOT required */ #include /* this is required by all DSP/BIOS modules */ #include /* this is required by the LOG module */ (2)Include the following external reference to the DSP/BIOS object in the C code: extern far LOG_Obj fastprint; /*fastprint is a user chosen name */

Chapter 4, Slide 57 Moving from “printf” to the faster “LOG_printf” (3) Create a LOG object using the configuration tool: (a)Open the cdb file, select instrumentation and open the “LOG - Event Log Manager”. (b)Create a new object, call it “fastprint” and change its properties as shown below:

Chapter 4, Slide 58 Moving from “printf” to the faster “LOG_printf” (4) Use the following code when using the LOG_printf function: /* #include NOT required */ #include /* this is required by all DSP/BIOS modules */ #include /* this is required by the LOG module */ extern far LOG_Obj fastprint; void algorithm_1 (void) { LOG_printf (&fastprint, “Algorithm 1 is running\n”); }

Chapter 4, Slide 59 Moving from “printf” to the faster “LOG_printf” (5) To Visualize the output of the fastprint log you must open the Message Log window, see below: Note: The complete code can be found in: Bios_Lab2\

Chapter 4, Slide 60 STS Module  The STS module manages objects called statistics accumulators.  Each STS object accumulates the following information:  Count:The number of values  Total:The sum of count values  Maximum:The longest value encountered  Functions in the STS Module: (1)STS_add( ):Update statistics using provided value (2)STS_delta( ):Update statistics using the difference between the provided value and the set point (3)STS_reset( ):Reset the values stored in the STS object (4)STS_set( ):Save a setpoint value

Chapter 4, Slide 61 Using the STS Module (1)Include the following headers in the C file: /* #include NOT required */ #include /* this is required by all DSP/BIOS modules */ /* #include : Created by the tools */ (2)Create an object with the configuration tool: (a)Open the cdb file, select “Instrumentation” and open the “STS - Statistics Object Manager”. (b)Create a new object and call it “mystsObj”.

Chapter 4, Slide 62 Using the STS Module (3)You can use the following code to benchmark the printf function: #include /* Needed for the printf function */ #include /* this is required by all DSP/BIOS modules */ #include #include extern far STS_Obj mystsObj; void algorithm_1 (void) { STS_set (&mystsObj, CLK_gethtime()); printf (“Algorithm 1 is running\n”); STS_delta (&mystsObj, CLK_gethtime()); }

Chapter 4, Slide 63 Moving from “printf” to the faster “LOG_printf” (4) To Visualize the statistics, open the statistics window as shown below: (5)Exercise: Compare the number of cycles the printf and LOG_printf take. Note: The complete code can be found in: Bios_Lab2\

Chapter 4, Slide 64 Low Instrumentation Overhead LOG, STS and TRC module operations are very fast and execute in constant time, as shown in the following list:  LOG_printf and LOG_event:approx 32 cycles  STS_add:approx 18 cycles  STS_delta:approx 21 cycles  TRC_enable and TRC disable:approx 6 cycles Each STS object uses only four words of data memory. This means that the host transfers only four words to upload data from a statistics object.

Chapter 4, Slide 65Exercises Load and Run the following projects: LedPrd: Change main in that way, the push on DIP switch will light the LED with the same number LedPrd: Change main in that way, the push on DIP switch will light the LED with the same number SWItest: Open MessageLog and check results SWItest: Open MessageLog and check results slice: (1) Change priority of TSK1 from 1 to 5, (2) add new object – TSK_switch with priority of 8 which check DIP switches every 100mSec (use command TSK_sleep(100) ), (3) Change the function task in that way, the LED 1 will flash with frequency 2.5 Hz (200mSec – On, 200mSec –Off) slice: (1) Change priority of TSK1 from 1 to 5, (2) add new object – TSK_switch with priority of 8 which check DIP switches every 100mSec (use command TSK_sleep(100) ), (3) Change the function task in that way, the LED 1 will flash with frequency 2.5 Hz (200mSec – On, 200mSec –Off) The projects can be found in the site in Lab4 session

Chapter 4 DSP/BIOS Part 4 - Real-Time Data Exchange

Chapter 4, Slide 67 Learning Objectives  Introduction.  Example: Send data from the target (DSK6416) to the host (PC).

Chapter 4, Slide 68 RTDX: Real-Time Data Exchange PC TMS320 DSP IEEEJTAG EMU H/W R T D X USER CODE Third Party Display CCS Display  User  TI  3rd Party  MS COM  RTDX enables non-obtrusive two-way communication between the host PC and the DSP (during IDL).  Since it runs in IDL (by default), it runs lower priority than your real-time code.  RTDX is used by DSP/BIOS RTA, but it is also available directly to DSP programmer (useful for testing or if end-equipment is PC resident).  Transfer speed limited by:  JTAG connection type (parallel, PCI, etc.).  DSP activity level.

Chapter 4, Slide 69 RTDX: Flow of Data  Code Composer Studio controls the flow of data between the host (PC) and the target.

Chapter 4, Slide 70 RTDX: Example (1)  In this application a program is written for sending data from the DSK6416 to the host.  Code location: \Bios_Lab3 DSK6416 bios_lab3.pjt Host s1l1.cs1l1.exe Host TargetDSK6416

Chapter 4, Slide 71 RTDX: Example (2) - Testing the Code (1)Connect and power up the DSK. (2)Envoke CCS and load the program (bios_lab3.out). (3)Enable the RTDX as shown opposite. (4)Run the code. (5)Run the host code “s1l1.exe” and observe the output. The DSP C code is shown in: Main3_RTDX.pdf Main3_RTDX.pdf

Chapter 4, Slide 72 FeaturesBenefits Easy to useSaves development time Small Footprint (<2Kw)Easily fits in limited memory systems Fast Execution Ideal for real time systems Real-Time Analysis View system parameters while system is executing without breakpoints and without additional overhead - “Test what you fly and fly what you test” Set of Library FunctionsUse only what you need to minimize footprint ExtensibleFull featured kernel allows additional OS functions in future DSP/BIOS Feature Summary

Chapter 4, Slide 73 DSP/BIOS Summary  At present DSP/BIOS does not support multiprocessors.  The “VSPWorks” operating system from WindRiver Systems does support multiprocessing. 

Chapter 4, Slide 74DSP/BIOS  Code location:  Bios_lab_1-3.pjt  Further Reading: (1)Use the help provided with the CCS (Help also includes tutorials: dsk6416). (2)TMS320C6000 DSP/BIOS: User Guide. (3)TMS320C6000 DSP/BIOS: Application Programming Interface (API) SPRU403. (4)Application Report: DSP/BIOS II Timing Benchmarks on the TMS320C6000 DSP SPRA662. SPRA662 (5)Application Report DSP/BIOS II Sizing Guidelines for the TMS320C62x DSP SPRA667. SPRA667

Chapter 4 DSP/BIOS - End -