Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assignment 4 / Lab. 3 Convert C++ ISR to ASM AND GET IT TO WORK Doing Assignment 4 / Lab. 3 the Test Driven Development way.

Similar presentations


Presentation on theme: "Assignment 4 / Lab. 3 Convert C++ ISR to ASM AND GET IT TO WORK Doing Assignment 4 / Lab. 3 the Test Driven Development way."— Presentation transcript:

1 Assignment 4 / Lab. 3 Convert C++ ISR to ASM AND GET IT TO WORK Doing Assignment 4 / Lab. 3 the Test Driven Development way

2 Step 1 Modify tests for SWI Task 4 to make Task 8 testable 3/8/2016 Motorola Blackfin Comparison Part 1, Copyright M. Smith, ECE, University of Calgary, Canada 2 Lab2Task8

3 Step 2 Modify tests for Task 5 to make Task 8 testable 3/8/2016 Motorola Blackfin Comparison Part 1, Copyright M. Smith, ECE, University of Calgary, Canada 3 Lab2Task8

4 Next Steps 1. Make Task 8 software interrupt testable – check test works 2. Make Task 8 hardware interrupt testable – check test works – do regression test 3. Clean up all code in Task 8 to make sure that there is nothing left over from Task 6 and Task 2 4. Regression test that code still works 3/8/2016 Motorola Blackfin Comparison Part 1, Copyright M. Smith, ECE, University of Calgary, Canada 4

5 5A – Convert C++ ISR into C++ ISR and C++ subroutine EX_INTERRUPT_HANDLER(Task8_ISR) { DoThis( ); DoThat( ); Do Something Else ( ); } 3/8/2016 Motorola Blackfin Comparison Part 1, Copyright M. Smith, ECE, University of Calgary, Canada 5

6 5B – Convert C++ ISR into C++ ISR and C++ subroutine – check code still works void Task8Subroutine( ) { DoThis( ); DoThat( ); Do Something Else ( ); } EX_INTERRUPT_HANDLER(Task8_ISR) { Task8Subroutine( ) } 3/8/2016 Motorola Blackfin Comparison Part 1, Copyright M. Smith, ECE, University of Calgary, Canada 6

7 6 – Convert C++ ISR into ASM ISR – check code still works _Task8_ISR__NM: [--SP] = ASTAT; [--SP] = FP; [--SP] = R0; [--SP] = R1, R2, R3 [--SP] = P0, P1, P2 LINK 16; Saves RETS as bonus CALL _Task8_Subroutine__; UNLINK; P2, P1, P0 = [SP++]; ditto R3, R2, R1, R0 Get order correct FP = [SP++]; ASTAT = [SP++]; RTI 3/8/2016 Motorola Blackfin Comparison Part 1, Copyright M. Smith, ECE, University of Calgary, Canada 7

8 7 – Convert C++ Subroutine into ASM Subroutine – check code still works _Task8_Subroutine__NM: LINK 16 Call _DoThis_NM; Call _DoThat__NM; Call _DoSomethingElse__NM; UNLINK; RTS; (less efficent P0 = [FP+4]; unlink; jump (P0); potential for faster) 3/8/2016 Motorola Blackfin Comparison Part 1, Copyright M. Smith, ECE, University of Calgary, Canada 8

9 Final steps 8) Merge Task8_ISR and _Task8_Subroutine__NM: Check code still works 9) Identify unnecessary saving of things to stack and remove that stuff – make sure that stack load and stack empty match Check code still works 10) Totally optimize the code Check code still woks 3/8/2016 Motorola Blackfin Comparison Part 1, Copyright M. Smith, ECE, University of Calgary, Canada 9


Download ppt "Assignment 4 / Lab. 3 Convert C++ ISR to ASM AND GET IT TO WORK Doing Assignment 4 / Lab. 3 the Test Driven Development way."

Similar presentations


Ads by Google