Introduction to Test Driven Development (To be used throughout the course)

Similar documents
Generating Rectify( ) Test driven development approach to TigerSHARC

Automated Testing Environment

Working with the Compute Block

Laboratory 1 Manual V1.2 1 st September 2007 Developing a Blackfin GPIO interface using an automated embedded testing environment

TigerSHARC processor and evaluation board

The Concept of Sample Rate. Digitized amplitude and time

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #29 Arrays in C

These are notes for the third lecture; if statements and loops.

CSE / ENGR 142 Programming I

Credit where Credit is Due. Lecture 29: Test-Driven Development. Test-Driven Development. Goals for this lecture

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Programming in C++ Indian Institute of Technology, Kharagpur

Agile Manifesto & XP. Topics. Rapid software development. Agile methods. Chapter ) What is Agile trying to do?

WELCOME! (download slides and.py files and follow along!) LECTURE 1

ENCM511 Assignment 1 Version 16 September 2012

Building a COFFEE POT simulation on CCESS for Blackfin BF533

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #44. Multidimensional Array and pointers

Section 2 Introduction to VisualDSP++

VisualDSP ADSP and ADSP EZ-Boards Release Notes Revision 1.0 March 25, 2010

Documentation Nick Parlante, 1996.Free for non-commerical use.

Coding Workshop. Learning to Program with an Arduino. Lecture Notes. Programming Introduction Values Assignment Arithmetic.

Overview. State-of-the-Art. Relative cost of error correction. CS 619 Introduction to OO Design and Development. Testing.

Data Structure Series

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Week 02 Module 06 Lecture - 14 Merge Sort: Analysis

Fraction Arithmetic. A proper fraction is a fraction with a smaller numerator than denominator.

Chapters 1 & 2 Programming and Programs

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop

Templating functions. Comp Sci 1570 Introduction to C++ Administrative notes. Review. Templates. Compiler processing. Functions Overloading

Chapter 2 Basic Elements of C++

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

C++ Support Classes (Data and Variables)

(Refer Slide Time: 1:27)

Test-Driven Development

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)

The Software Stack: From Assembly Language to Machine Code

INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS

REPORT MICROSOFT PATTERNS AND PRACTICES

Data Structures Lecture 2 : Part 1: Programming Methodologies Part 2: Memory Management

All you need is fun. Cons T Åhs Keeper of The Code

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #17. Loops: Break Statement

C Pointers 2013 Author Riko H i

CS61C : Machine Structures

Chapter 4 Defining Classes I

Overview. CSE 101: Design and Analysis of Algorithms Lecture 1

Project Report Number Plate Recognition

Organization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?

IMASK FIO_FLAG_S FIO_DIR SIC_IMASK FIO_EDGE FIO_POLAR ILAT FIO_BOTH TCOUNT FIO_FLAG_D FIO_ENEN PF_STATUS_D

Overview of C++ Support in TI Compiler Tools July 2008

Test Driven Development (TDD)

CMSC 104 -Lecture 6 John Y. Park, adapted by C Grasso

Outline: System Development and Programming with the ADSP-TS101 (TigerSHARC)

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

Test Driven Development TDD

How to approach a computational problem

Review! * follows a pointer to its value! & gets the address of a variable! Pearce, Summer 2010 UCB! ! int x = 1000; Pearce, Summer 2010 UCB!

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

CS61C : Machine Structures

LESSON 13: LANGUAGE TRANSLATION

CS 241 Data Organization. August 21, 2018

Comp 11 Lectures. Mike Shah. June 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures June 26, / 57

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

Object Oriented Programming

Introduction to Programming using C++

Scientific Computing: Lecture 1

Design Approaches for Concurrent Systems. CSCI 5828: Foundations of Software Engineering Lecture 08 02/09/2012

Technical Questions. Q 1) What are the key features in C programming language?

Lecture 6: Assembly Programs

CS 251 Intermediate Programming Java Basics

Contents. Slide Set 1. About these slides. Outline of Slide Set 1. Typographical conventions: Italics. Typographical conventions. About these slides

COMP 122/L Lecture 1. Kyle Dewey

Introduction to Scientific Computing

Introduction to C++ with content from

8.882 LHC Physics. Analysis Tips. [Lecture 9, March 4, 2009] Experimental Methods and Measurements

DEVELOPING WINDOWS APPLICATIONS WITH MICROSOFT VISUAL STUDIO 2010

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Week - 01 Lecture - 04 Downloading and installing Python

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 15 Testing

Why study algorithms? CS 561, Lecture 1. Today s Outline. Why study algorithms? (II)

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur


EEM870 Embedded System and Experiment Lecture 4: SoC Design Flow and Tools

The purpose of the Risk Log is to provide a list of risks confronted during the Tempus project.

CS-3410 Systems Programming Spring 2013

(Refer Slide Time 04:53)

DDMD AND AUTOMATED CONVERSION FROM C++ TO D

Using the DSK In CalPoly EE Courses - Dr Fred DePiero

Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

Heap Arrays. Steven R. Bagley

User-defined Functions Case study

MITOCW watch?v=0jljzrnhwoi

Pointers as Arguments

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

The C Programming Language Guide for the Robot Course work Module

A framework for automatic generation of audio processing applications on a dual-core system

Testing, code coverage and static analysis. COSC345 Software Engineering

Are Fit / FitNesse Appropriate for Biomedical Engineering Research?

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics

Scalable Software Engineering What is it? Why and How?

PSK Propagation Reporter DLL Documentation 2013-Mar-10 Philip Gladstone

CS 64 Week 0 Lecture 1. Kyle Dewey

Transcription:

Introduction to Test Driven Development (To be used throughout the course) Building tests and code for a software radio Concepts Stages in a conventional radio Stages in a software radio Goals for the long term project Concept of test driven development Digital rectification Tests for integer array rectification Tests for float array rectification (C++ compiler) Tests for rectification in assembly code More details of test driven development 2/ 28 Conventional AM radio Antenna Pickup Local Oscillator RF STAGE Mixer IF STAGE Rectifier AUDIO STAGE + amplifier Audio out Review of AM radio operation Analog Version Incoming signal @ frequency 1010 khz IF-STAGE Local (tunable) oscillator @ 660 khz Mixed with incoming signal (multiplication) Get sum and difference frequencies 350 khz and 1670 khz filter to get constant frequency for remainder of audio date at 350 khz AUDIO STAGE Rectify signal to get AM modulation Rectification means that you spread the signal over a wide band of frequencies filter to get required audio range 50Hz to 7 khz 3/ 28 4/ 28

Software AM radio concept Software FM radio concept RF STAGE Antenna Pickup AUDIO STAGE RF STAGE AUDIO STAGE Mixer Rectifier + amplifier Antenna Pickup What ever is needed Rectifier + amplifier Local Oscillator IF STAGE Audio out Audio out Most stages handled with high speed software Most stages handled with high speed software 5/ 28 6/ 28 Real software radio Looking at RF stage to bring in wireless signal Software radio is the rest of it Update communication protocols Change noise suppression characteristics on the fly Etc. Dr. Gannouchi is doing research in this area Joint M. Sc. student Andrew Kwan Excellent topic for pair presentation (12 minute talk 14 slides max at the end of term). Exact details to be given later. A basic example for the coding practices adopted through the term Going to use the rectification stage of this softradio as a code example all through the course. We may also look at single-side band modulation (involves IIR filtering) as a second code example followed all though the term. 7/ 28 8/ 28

Customer Requirements Wants to get product out of the door as fast as possible Less time spend on development the better, but it has to work Developing in C++ is easier than developing in assembler code, but is it fast enough Risk analysis take one representative part of the code and explain the differences between the speeds from C++ code (Debug and Release Mode) and assembly code Expected relative advantages Compiler debug mode Slow but easy to understand the code flow when doing very low level debug at assembly level (A real NO-NO) Compiler release (optimized) mode Faster than debug mode Optimized, possibly out of order instructions, difficult to follow US assembly mode Probably faster than compiler debug Gain skills needed to handle optimized assembly US optimized assembly mode Time consuming; use only after profiling the compiler code Faster than compiler when we understand the special situations that arise Probably based on trying assembly code to see where the issues are, then optimizing the output from the release compiler version 9/ 28 10 / 28 Standard testing practice Test Driven Development Heavy on documentation Describe Requirements Design Solution Build Solution Test Solution Analysis Document Design Document Test Plan Document TLD Test Last Development Requires automated testing framework High Level customer tests for embedded systems personally find these hard to do. This example is an exception because we have really knowledgeable customer. Done in consultation with customer. Even better if customer writes the tests. Doing research into developing a process for this. Read paper handed out Developer Tests for embedded systems E-TDD Have found many advantages research and teaching Being used by local firm 11 / 28 12 / 28

Test Driven Development Work with customer to check that the tests properly express what the customer wants done. Iterative process with customer heavily involved Agile methodology. CUSTOMER DEVELOPER Describe Requirements Design Solution Acceptance Tests Unit Tests Lets apply TDD to rectification issue Overall technique Decide on a particular test action with the customer the test(s) the simplest possible code to satisfy the test(s) Refactor the code to improve quality Definition of quality is unclear in the literature Ease of use or reuse of code Reliable to use robust My additional idea meets speed requirements for the embedded situation Build Solution Test Solution See paper handed out for more details 13 / 28 14 / 28 Express Customer Requirements as tests using E-TDD Tests Now expand the Customer Tests to do what the customer has requested 15 / 28 16 / 28

Note that writing the tests has automatically generated the function interface information Floating point version of the Tests Essentially a cut-and-paste version of integer code Why int* and float* rather than just void as you are passing in the address of the output Design decision sort of standard with C to pass back a pointer to thing being changed 17 / 28 18 / 28 Stage 1 Compile / Link the tests Obviously the Link is not going to work as the code for functions HalfWaveRectifyXXX( ) have not been written If obviously going to fail WB (why bother)? Basically You are TESTING THE TESTS Are you calling the functions you expect to call. Better handled by doing Code Review first, and then use compiler / linker to CHECK the Code Review did not miss something (PSP personal software process). C++ can overload function names (done via name mangling). What are the name-mangled names needed for the assembly code? This stage will show you. Name mangled names can be seen from linker C++ name as used The name mangled name generated by in C++ code by the C++ compiler in response to function overloading. These are the assembly code names 19 / 28 20 / 28

Next step: just enough code to satisfy the linker C++ stubs Problems uncovered The following unanswered question has been raised when developing the C++ code How does the processor know how to run a function in debug mode or in release mode? Explain later compiler option which you will use during Assignment 1 Just how do you write an assembly code stub? 21 / 28 22 / 28 assembly code using a couple of techniques Assembly code stubs assemble (compile) but generate 200 linker error messages Use knowledge of what you need to do from other assembly code functions Need to specify section of memory where the code will be placed Need to specify name of function (linker told us that) Need to do a return to C Cheat -- use mixed mode in IDDE Compile and link a C++ function with the same name (in debug mode). Load the code into the processor Bring up the source code window, right click and select MIXED MODE 23 / 28 24 / 28

Understanding the error messages TigerSHARC is a high speed processor designed for 32-bit operation 68K designed for 8-bit and 16-bit. Can do 32-bit but much slower Blackfin designed for 16-bit and 32-bit. Can do 8-bit but slower. Strings are normally handled as 8-bit characters TigerSHARC has two character modes CHAR8 bit like normal C++ string, minimizes space usage, but slow. CHAR32 bit Maximizes speed, but storage area is larger C++ compiler (debug mode) normally generates CHAR32 type of strings so we must do that in our assembly code. Fix the code for CHAR32, and run the tests We lost control of the processors in the debug environment. 25 / 28 26 / 28 Why did we lose control? IDDE environment uses a boundary scan approach to debug (another lecture) That s the ICE interface discussed in Tuesday s class It is possible to get the IDDE environment (on the PC) out of sync with the processors (on the evaluation board). I find this happens when I generate poor code, or when I spent a lot of time coding before down loading anything to the board Recovery process Don t lose control write good code Do incremental builds so you are continually writing and testing code E-TDD encourages this write a test, then write just enough code to satisfy the tests If you lose control Try selecting each processor (DSPA then DSPB) in processor window. Then select DEBUG HALT If that fails, then in this order (easier restart process) 1. Exit from E-TDD GUI, 2. Exit from VisualDSP IDDE 3. Power down the board 4. Walk-around your chair twice (or count to 10) 5. Power up board, then reactivate VisualDSP IDDE and the GUI 27 / 28 28 / 28

We accidentally pass some tests without writing any code With the GUI running, we can just click on failed test to see details 29 / 28 30 / 28 Concepts covered Stages in a conventional radio Stages in a software radio Goals for the long term project Concept of test driven development Digital rectification Tests for integer array rectification Tests for float array rectification (C++ compiler) Tests for rectification in assembly code More details of test driven development 31 / 28