Core Timer Code Development How you could have done the Take- Home Quiz using a test driven development (TDD) approach.

Slides:



Advertisements
Similar presentations
Lab. 2 Overview. Lab. 2 and Assignment 3 Many Lab. 2 and Assignment 3 tasks involve “downloading” provided code, compiling and linking into a project.
Advertisements

Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Boot Issues Processor comparison TigerSHARC multi-processor system Blackfin single-core.
Daddy! -- Where do instructions come from? Program Sequencer controls program flow and provides the next instruction to be executed Straight line code,
6/2/2015 Labs in ENCM415. Laboratory 2 PF control, Copyright M. Smith, ECE, University of Calgary, Canada 1 Temperature Sensor Laboratory 2 Part 2 – Developing.
Thermal arm-wrestling Design of a video game using two programmable flags (PF) interrupts Tutorial on handling 2 Hardware interrupts from an external device.
Building a simple loop using Blackfin assembly code M. Smith, Electrical and Computer Engineering, University of Calgary, Canada.
Specialized Video (8-bit) and Vector (16-bit) Instructions on the Blackfin There is always a “MAKE-UP-YOUR-QUESTION-AND-ANSWER-IT” Question on a Dr. Smith.
Developing a bicycle speed-o-meter Part 2 A comparison between the Analog Devices ADSP-BF533 (Blackfin) and Motorola MC68332.
Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn.
Lab. 2 – More details – Tasks 4 to 6 1. What concepts are you expected to understand after the Lab. 2 is finished? 2. How do you demonstrate that you have.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415.
Specialized Video (8-bit) and Vector (16-bit) Instructions on the Blackfin Expand on these ideas for Q9 question and answer on the final.
LCD programming Design and implementation details on the way to a valid SPI-LCD interface driver.
Developing a bicycle speed-o-meter A comparison between the Analog Devices ADSP-BF533 (Blackfin) and Motorola MC68332.
Lab. 2 Overview 1. What concepts are you expected to understand after the Lab. 2 is finished? 2. How do you demonstrate that you have that knowledge?
Timers and Timing Signals Tutorial. 6/18/2015 Timer Control Copyright M. Smith, ECE, University of Calgary, Canada 2 / 31 Temperature Sensor -- Lab 3.
Understanding the Blackfin ADSP-BF5XX Assembly Code Format
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Developing a bicycle speed-o-meter Midterm Review.
Blackfin Timers Independent timers build into the processor Watchdog Timer is a major part of Lab. 2 (Code provided to you to use)
Blackfin Array Handling Part 2 Moving an array between locations int * MoveASM( int foo[ ], int fee[ ], int N);
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM511.
Lab. 2 Overview Move the tasks you developed in Lab. 1 into the more controllable TTCOS operating system Manual control of RC car.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Blackfin Array Handling Part 1 Making an array of Zeros void MakeZeroASM(int foo[ ], int N);
Lab. 2 Overview. Echo Switches to LED Lab1 Task 7 12/4/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada 2 / 28.
Mistakes, Errors and Defects. 12/7/2015Mistakes, Errors, Defects, Copyright M. Smith, ECE, University of Calgary, Canada 2 Basic Concepts  You are building.
12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 1 Automated Testing Environment Concepts.
The right and wrong ways for constructing tasks for the Labs and Assignment.
Building a simple loop using Blackfin assembly code If you can handle the while-loop correctly in assembly code on any processor, then most of the other.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415.
“Lab. 5” – Updating Lab. 3 to use DMA Test we understand DMA by using some simple memory to memory DMA Make life more interesting, since hardware is involved,
Developing a bicycle speed-o-meter
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Lab. 2 Overview.
A Play Core Timer Interrupts
Introduction to Test Driven Development
SPI Compatible Devices
Thermal arm-wrestling
DMA example Video image manipulation
The planned and expected
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Thermal arm-wrestling
Using Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Expand on these ideas for Q9 question and answer on the final
General purpose timers
Thermal arm-wrestling
Concept of TDD Test Driven Development
Explaining issues with DCremoval( )
Independent timers build into the processor Basis for Lab. 2
DMA example Video image manipulation
Developing a bicycle speed-o-meter
Independent timers build into the processor
Developing a bicycle speed-o-meter
Lab. 2 Overview Move the tasks you developed in Lab. 1 into the more controllable TTCOS operating system.
Developing a bicycle speed-o-meter
Thermal arm-wrestling
Building a simple loop using Blackfin assembly code
Developing a bicycle speed-o-meter Part 2
Mistakes, Errors and Defects
Developing a reliable communication between Blackfin and Slave device
Blackfin Syntax Moves and Adds
Blackfin Syntax Stores, Jumps, Calls and Conditional Jumps
Presentation transcript:

Core Timer Code Development How you could have done the Take- Home Quiz using a test driven development (TDD) approach

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada2 / 28 To be tackled today Test driven development example Customer requirements Possible system test provided by customer’s FAE (field application engineer) Development of your unit tests

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada3 / 28 Customer Requirements Long term goal is that we will be using devices that need to be activated at certain reliable times. Seems like we need a library of timer functions

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada4 / 28 Customer Test – example code Put system into known state We already have these LED utilities (Lab. 2) Here is the sort of thing we need This sort of test detail may indicate that FAE has already tried and failed. Be polite when you deliver code

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada5 / 28 Define the functions To be coded in assembly code Convention when dealing with hardware ulong SetCoreTimer(initial, reload, scale) Initializes the core timer registers, returns old control setting, places timer in low power mode, stops the clock void StartCoreTimer(void), void StopCoreTimer(void) Starts and stops the timer. When started the timer is to run continuously. ulong ReadCoreTimer(void) Returns current value from the timer bool CheckIfCoreTimerExpired(void) Determines whether or not the core timer registers have been reloaded

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada6 / 28 Step 1A – Get a main( ) and a test to compile and link – Design the test

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada7 / 28 Step 1B – Get a main( ) and a test to compile and link – Design main Bring a copy of your Take-Home Quiz code to compare

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada8 / 28 Recode till pasts the test

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada9 / 28 Step2A – Write the test for void StopCoreTimer(void);

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada10 / 28 Step 2B – Write and Test void StopCoreTimerASM(void); Bring a copy of your Take-Home Quiz code to compare

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada11 / 28 Step 2C – Fix the test

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada12 / 28 3A – Write a test -- unsigned long int ReadCoreTimer( )

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada13 / 28 3B – Write the code to pass the test Bring a copy of your Take-Home Quiz code to compare

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada14 / 28 4 Write the Test for void StartCoreTimerASM(void)

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada15 / 28 4 – Write the code to satisfy the test Bring a copy of your Take-Home Quiz code to compare

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada16 / 28 Test failed because

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada17 / 28 4 Rewrite the test – prefer new -- unsigned long int StartCoreTimer(void)

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada18 / Need to add unsigned long int SetCoreTimer(ulong, ulong, ulong)

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada19 / 28 Needed code – run the tests Bring a copy of your Take-Home Quiz code to compare

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada20 / 28 New tests pass – old tests now fail

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada21 / 28 Fix StopCoreTimer( )

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada22 / 28 Re-examine ReadCoreTimerASM

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada23 / 28 4 – Re-examine Test

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada24 / 28 Final Test

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada25 / 28 Customer Test Put system into known state We already have these LED utilities (Lab. 2) Here is the sort of thing we need This sort of test detail may indicate that FAE has already tried and failed. Be polite when you deliver code

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada26 / 28 Oops -- Still missing code for bool CheckIfCoreTimerExpiredASM( ) First – write the test

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada27 / 28 Oops - Still missing code for bool CheckIfCoreTimerExpiredASM( ) Now write the code

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada28 / 28 Tackled today Test driven development example Customer requirements Possible system test provided by customer’s FAE (field application engineer) Development of your unit tests You still need to design the test and the code for bool CheckIfCoreTimerExpiredASM(void);

6/3/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada29 / 28 Information taken from Analog Devices On-line Manuals with permission Information furnished by Analog Devices is believed to be accurate and reliable. However, Analog Devices assumes no responsibility for its use or for any infringement of any patent other rights of any third party which may result from its use. No license is granted by implication or otherwise under any patent or patent right of Analog Devices. Copyright  Analog Devices, Inc. All rights reserved.