Presentation is loading. Please wait.

Presentation is loading. Please wait.

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?

Similar presentations


Presentation on theme: "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?"— Presentation transcript:

1 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?

2 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada2 / 28 To be tackled today Lab. 2 – Concepts to be understood and demonstrated Test driven development approach Design the tests THEN the code Overview of Lab. 2 Details of Lab. 2 Task 1 Setting up the SMALLEST TV IN THE WORLD – MANUALLY OPERATED Details of Lab. 2 Task 2 Setting up the testing environment for Lab. 2 Details of Lab. 2 Task 3 Test Last Approach to check that Task 1 functions really work

3 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada3 / 28 Show understanding of what concepts? 1. How to write up a “valid” (working) “C++” interrupt service routine for the timers on a microcontroller. 2. How to set up a timer to be able to cause an interrupt. 3. How to set-up the “C++” to handle a new interrupt without crashing 4. Demonstrate “multi-tasking” – a main program and a background “interrupt” routine 5. Using a test driven development approach to demonstrate validation of the other concepts

4 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada4 / 28 Demonstration of these concepts - 1 1. Set up THE SMALLEST TV IN THE WORLD – manually operated by switches Two new functions (around 6 C++ lines) developed 2. Set up the “Testing environment” for Lab. 2. – basically downloading files 3. Use the “testing environment” (in a “test last approach”) to valid the new functions developed in Task. 1 above Mainly downloading files and modifying cut-and-pasted code (around 20 C++ lines modified) These concepts are done as Assignment 3 where Task 1 must be done in assembly code and tested (Task 3), making good practice for Post Lab. 1 Quiz and cutting down time spent during Lab. 2

5 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada5 / 28 Demonstration of these concepts - 2 4. Use a test driven development approach to set up core timer to known values withy ability to stop-and-start the core time (C++ and ASM approach). 5. Use a test driven development approach to set up and test core timer interrupts. Demonstrate the SMALLEST VCR IN THE WORLD (C++ and ASM approach). 6. Put everything together so that the SMALLEST VCR (in the world) and the SMALLEST TV (in the world) work together with or without human intervention

6 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada6 / 28 Small TV in the world – white picture This slide is brought to you by the letter “M” Pixels become activated as the electron gun “paints” the various pixels on the screen Repainted every 1/30 s Persistence of vision makes it appear “there all the time”

7 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada7 / 28 Small TV in the world This slide is brought to you by the letter “M” 7 rows of pixels Pixels become activated as the electron gun “paints” the various pixels on the screen Repainted every 1/30 s Persistence of vision makes it appear “there all the time”

8 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada8 / 28 Small TV in the world – SW1 This slide is brought to you by the letter “M” 7 rows of pixels MANUAL TV PRESS SW1 to clear screen

9 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada9 / 28 Small TV in the world – Press SW2 This slide is brought to you by the letter “M” 7 rows of pixels MANUAL TV PRESS SW2 to display each line

10 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada10 / 28 SMALLEST TV IN THE WORLD – This slide is brought to you by the letter “M” 1 row of pixels PRESS SW1

11 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada11 / 28 SMALLEST TV IN THE WORLD – PRESSING SW2 This slide is brought to you by the letter “M” 7 rows of pixels PRESS SW2

12 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada12 / 28 ENOUGH PRESSES ALREADY

13 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada13 / 28 Lab. 2 Task 1 – Basic hardware test

14 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada14 / 28 L2 T1 – Code for the “TV frame buffer” Displayed using WriteLEDASM( ) This slide is brought to you by the letter “A”

15 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada15 / 28 L2 T1 – Final main( ) Press SW1 to clear the screen APPARENT INFINITE LOOP INFINITE LOOP AVOIDED SINCE VOLATILE VARIABLE start_picture_again IS BEING CHANGED ELSE WHERE

16 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada16 / 28 L2 T1 – Final main( ) Press SW2 repeatedly to display “picture”

17 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada17 / 28 Lab. 2 Task 1 – New Code needed void StartPictureCommand(void); changes the volatile variable start_picture_again defined in main.cpp (meaning its external to this file) to 1 when switch 1 is held down and then released. void NextLineCommand(void); changes the volatile variable next_line to 1 when switch 2 is held down and then released.

18 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada18 / 28 ERRORS AND DEFECTS We have some new functions developed in Task 1 TLD - Test last development Need a systematic way to ensure that those functions work now “Regression Testing” and a systematic way to ensure that they work in the future after modification “Defect free” development environment By discovering all the mistakes (called ERRORS) before developing any further code based on these functions we can ensure that no hidden mistakes (CALLED DEFECTS) are present Errors are easier, and less costly, to fix as you are in that part of the code where they have been introduced – you know where to look

19 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada19 / 28 L2 T2 – Setting up test environment This test environment is automated Makes it easy for you to run the tests often Many provided testing files that you can just download Only work if you have called the functions you develop exactly what is specified in the web pages Imagine that this is in industry, and you are working with a colleague (“me”) as part of the team. This is meant to be a supportive relationship. Expect an occasional typo in the test or test documentation. These occur when I make some minor changes to the pages during the laboratory development. Get a model in your head of what is “supposed to happen next”. That model will often get you past an apparent road block in the web pages

20 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada20 / 28 L2 T2 – Setting up test environment I will be providing you with project files to download (.prj) to download and automatically link to your code and tests Only works if you have called the files you develop exactly what is specified in the web pages. There are simple “work arounds” supplied by the VisualDSP tool functionality to overcome this problem – which would be fairly common industry. Learn to use this feature.

21 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada21 / 28 Required LAB Directory Environment

22 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada22 / 28 Required Files From Lab. 1 and Lab1Tests

23 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada23 / 28 Required Files – Lab2 and Lab2Tests and GUI set-up

24 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada24 / 28 Lab. 2 Task 3 Test 1 -- SW1 control Testing StartPictureCommand()

25 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada25 / 28 Lab. 2 Task 3 Test 2 -- SW1 control Testing StartPictureCommand()

26 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada26 / 28 Lab. 2 Task 3 Test 3 -- SW1 control REFACTORING StartPictureCommand() Problems like this being found and solved P0.H = hi(_name); P0.L = hi(_name); TEMPORARY DEBUG FIX -- REMOVE WHEN PROBLEM SOLVED

27 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada27 / 28 Lab. 2 Task 3 Tests for SW2 control NextLineCommand() You are responsible for setting up these test Basically a cut-and-paste job of the tests for SW1 This is where I expect you to be when you come into the Lab. 2 Also see “Assignment 3” which combines “practice for post-lab Quiz 1” and getting ready for Lab. 2 Effectively Assignment is worth around 2% of the course (because of the Lab. 2 component) when handed in as part of Lab. 2. However there are no marks directly associated with Assignment 3.

28 6/14/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada28 / 28 Tackled today Lab. 2 – Concepts to be understood and demonstrated Test driven development approach Design the tests THEN the code Overview of Lab. 2 Details of Lab. 2 Task 1 Setting up the SMALLEST TV IN THE WORLD – MANUALLY OPERATED Details of Lab. 2 Task 2 Setting up the testing environment for Lab. 2 Details of Lab. 2 Task 3 Test Last Approach to check that Task 1 functions really work


Download ppt "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?"

Similar presentations


Ads by Google