Presentation is loading. Please wait.

Presentation is loading. Please wait.

Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment.

Similar presentations


Presentation on theme: "Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment."— Presentation transcript:

1 Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment

2 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller2 / 28 Lab. 1 -- this afternoon Recipe for Just in time knowledge  Need a dollop of “C++” code from assignment 1 main( ), HelloWorldTest( ), MeasureTemperature( ) Hopefully you’ve just handed-in working code at the start of the class  A smizzen of knowledge to build the simplest possible Blackfin assembly language for-loop  A pinch of Window’s Experience  And a bowl to put the ingredients in (a computer account with password) and somebody else to do all the clean-up (a partner) and a desk in Labs ICT318 and 318.

3 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller3 / 28 VisualDSP++ IDE  Analog Devices’ integrated development environment (IDE) ENCM415 – Assembly language and interfacing (2004) ENCM491 – Real Time Systems (2003) ENCM505 – Multi-processor course (2004) ENCM515 – Comparative Processor Architectures for DSP (Since 1999) Dr. Smith has been awarded the Analog Devices’ University Ambassadorship for 2001/2002, 2002/2003, 2003/2004

4 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller4 / 28 Just enough to know  Build U:/ENCM415/Lab1 Directory  Activate VisualDSP++ 16-bit processor Family simulator session and activate a Blackfin simulator session  Build a Blackfin Project, add to your directory  Add your Assignment1 C++ files to the project  Compile, Link and Run using the equivalent commands as with Microsoft Visual Basic, Visual Studio etc  If time today will do a demo.

5 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller5 / 28 Blackfin C++ code STUB A function stub has just enough code to Compile, link and run int main(void) { unsigned short int timeUsed1, timeUsed2; HelloWorld(FRANCE); timeUsed1 = UseTime(0x5000); timeUsed2 = UseTimeASM(0x5000); }

6 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller6 / 28 Valid main stub int main(void); void HelloTest(const short int); typedef unsigned short int ushort; // Define a variable type ushort UseTime (ushort int); extern “C” ushort UseTimeASM(ushort int); #define FRANCE 5 void int main(void) { ushort timeUsed1, timeUsed2; HelloTest(FRANCE); timeUsed1 = UseTime (0x5000); timeUsed2 = UseTimeASM(0x5000); }

7 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller7 / 28 HelloTest  You provide the stub needed for the “C++” function HelloTest( )  Note that you don’t need to know any details of the function (other than its prototype) to build a stub

8 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller8 / 28 ushort UseTime(ushort);  This routine is written in “C++”  It must return a value When first developing the code – return an error value  You write the stub

9 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller9 / 28 ushort UseTimeASM(ushort);  The customer wants this written (for some reason) in assembly code  It is “assembled” and not “compiled” However activating the compiler will cause the assembler to be activated automatically  Place in a file with extension “.asm” and add to your project – UseTimeASM.asm  Have you seen the expression “extern C” used in a program before?  What does the stub look like? See Lab. 1 web pages for more detail  Why does the stub look like that?

10 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller10 / 28 Assembly code Stub in file UseTimeASM.asm #include #include.section program;.global _UseTimeASM;.align 2; #define UseTimeASMSTACK 16 _UseTimeASM: // unsigned short int UseTimeASM(unsigned short int timeToUse) { LINK UseTimeASMSTACK; // Code goes here and replaces next line R0 = 0; // return 0; P0 = [FP + 4 ]; UNLINK; JUMP (P0); // } _UseTimeASM.end:

11 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller11 / 28 Code for ushort UseTime(ushort);  First thing – compile and link the stubs, check that they work (run).  Provide the “C++” code for ushort UseTime(ushort); It must return the parameter passed to it It must “waste time” accurately – meaning that UseTime(2000) must take twice as long to execute as UseTime(1000) (to within a certain error limit)  Then develop the simplest code needed – get that to work How can you “check” that it works?  Then “refactor” the code -- and add quality to the code – check that still works  Don’t use a “for loop” – since we know from MIPS experience that assembly code does not support “for loops” Actually the Blackfin BF5xx processor family DOES support a maximum of 2 hardware loops in assembly code – but that is not many

12 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller12 / 28 Code for ushort UseTimeASM(ushort);  First thing – compile and link the assembly code stubs, check that they work (run).  Get the “C++” code for ushort UseTime(ushort); to work  Now translate that code (one line at a time) into assembly code ushort UseTimeASM(ushort); using the “C++” code as “comments”. Techniques for Control Code (CC) Bit Management are detailed in Section 6 of the Blackfin Processor Instruction Set Reference.Blackfin Processor Instruction Set Reference Arithmetic operations are detailed in Section 10 of the Blackfin Processor Instruction Set Reference.Blackfin Processor Instruction Set Reference More details can be found in Task 6 of Laboratory 1

13 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller13 / 28 VisualDSP – working example  Now lets put some of these ideas together as a working demo  Note – more slides walking you through setting up a VisualDSP session follow – your responsibility  A little hint for the laboratories Check the performance of the simulator before and after code optimization – that is “DEBUG MODE” (before) and “RELEASE MODE with DEBUG information” (after)

14 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller14 / 28 Activating VDSP environment Hold CONTROL key down while activating to ensure that you get a choice of session to use Lab. 1 session – Blackfin Family simulator

15 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller15 / 28 Activate required session

16 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller16 / 28 Select new project, save.dpj file

17 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller17 / 28 Project Options

18 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller18 / 28 Say no here – or start again

19 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller19 / 28 Add your main.cpp file to the project

20 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller20 / 28 Display in window and set Editor tab

21 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller21 / 28 Build project Build file in window, if the file is in the project Build project (only changed files rebuilt and will cause load if successful) Rebuild all files whether changed or not Click here to jump to error in source file

22 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller22 / 28 Build, Load, Run

23 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller23 / 28 After running NOTE: Disassembly window shows that program has found the C++ stop here option DON’T ACTIVATE “RUN” AGAIN String in output window

24 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller24 / 28 Mixed mode allows you to see “C++” source and equivalent assembly code RIGHT-CLICK IN SOURCE WINDOW

25 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller25 / 28 Mixed mode allows you to see assembly source code and assembly Debug assembler option must be ON

26 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller26 / 28 Other useful VisualDSP++ options MEMORY DISPLAY REGISTER DISPLAY PLOT WINDOW

27 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller27 / 28 Tackled today  Just enough information to activate a simulator session for Lab. 1

28 M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller28 / 28  Information taken from Analog Devices On-line Manuals with permission http://www.analog.com/processors/resources/technicalLibrary/manuals/ http://www.analog.com/processors/resources/technicalLibrary/manuals/  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.


Download ppt "Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment."

Similar presentations


Ads by Google