section 8 section 8
play

Section 8 Section 8 Programming a 8-1 1 Software Development - PowerPoint PPT Presentation

Section 8 Section 8 Programming a 8-1 1 Software Development Flow Software Development Flow Linker Description File Code Generation (.LDF) Generate Assembly Assembler Source (.ASM) Software Linker and / or Build System Generate


  1. Section 8 Section 8 Programming a 8-1 1

  2. Software Development Flow Software Development Flow Linker Description File Code Generation (.LDF) Generate Assembly Assembler Source (.ASM) Software Linker and / or Build System Generate C Process Verification C Compiler Source (.C) Hardware Evaluation EZ-Kit Lite VisualDSP Software Simulator Verification Target Verification ICE NO YES Working Code? ROM Production LOADER a 8-2 2

  3. Project Development • Create a project – All development in VisualDSP++ occurs within a project. – The project file (.DPJ) stores your program’s build information: source files list and development tools option settings – A project group file (.DPG) contains a list of projects that make up an application (eg ADSP-BF561 dual core application) a 8-3 3

  4. Select Target Processor Select Target Processor a 8-4 4

  5. Startup Code Startup Code a 8-5 5

  6. Finish Finish a 8-6 6

  7. C/C++ Project - - Startup Code Startup Code C/C++ Project For pure assembly code applications, select ‘NO’ option. For C/C++ applications, select ‘YES’ to customize a run time header for you application. a 8-7 7

  8. Setup of Configurable Memory Blocks in L1 Setup of Configurable Memory Blocks in L1 a 8-8 8

  9. Wizard is Done Wizard is Done At a later time, the CRT Header can be modified by selecting Project Options/Startup Code Settings and making changes. When finished, the wizard creates a customized C Run Time Header. a 8-9 9

  10. Project Development Steps • Create project source files – A project normally contains one or more C, C++, or assembly language source files. – After you create a project and define its target processor, you add new or existing files to the project by importing or writing them. – The VisualDSP++ Editor lets you create new files or edit any existing text file a 8-10 10

  11. Project Development Steps • Define project build options – A project’s configuration setting controls its build. By default, the choices are Debug or Release. – Debug • Typically has more debug options set for the tools. • compiler generates debug information to allow source level debug. – Release • Typically has fewer or no debug options set for the tools • builds are usually optimised for performance a 8-11 11

  12. VisualDSP++ Menu Reload the project Build the project Add source, header and .ldf files to your project. File specific options: Select file, press right mouse button, choose: File Options a 8-12 12

  13. Software Development Flow Software Development Flow What Files Are Involved? What Files Are Involved? Source Files Object Files Executable (.C and .ASM) (.DOJ) (.DXE) Debugger (In-Circuit Emulator, Simulator, or EZKIT ) Linker Compiler & Assembler Loader / Splitter Boot Image Boot Code Boot Code Linker Linker (.LDR) (.DXE) (.DXE) Description Description File (.LDF) File (.LDF) a 8-13 13

  14. Software Development Flow Software Development Flow What Files Are Involved? What Files Are Involved? Source Files Object Files Executable (.C and .ASM) (.DOJ) (.DXE) Debugger (In-Circuit Emulator, Simulator, or EZKIT ) Linker Compiler & Assembler Loader / Splitter Boot Image Boot Code Boot Code Linker Linker (.LDR) (.DXE) (.DXE) Description Description File (.LDF) File (.LDF) a 8-14 14

  15. Software Build Process Software Build Process Step 1 - - Compiling & Assembling Compiling & Assembling Step 1 Source Files Object Files (.C and .ASM) (.DOJ) cFile1.DOJ C - Compiler C - Compiler asmFile1.DOJ cFile1.C .S Assembler asmFile1.ASM a 8-15 15

  16. Software Build Process Software Build Process Step- -1 Example: Assembly Source 1 Example: Assembly Source Step asmFile1.DOJ asmFile1.ASM Object Section = data1 array[0] .section data1; array[1] ... .var array[10] ... array[9] .section code1; Assembler start:r0 = 0x1234; Assembler Object Section = code1 r1 = 0x5678; start: r2 = r1 + r2; r0 = 0x1234; jump start; r1 = 0x5678; r2 = r1 + r2; jump start; a 8-16 16

  17. Software Build Process Software Build Process Step- -1 Example: C Source 1 Example: C Source Step cFile1.C cFile1.DOJ main() Object Section = program { _main: C-Compiler int j = 12; C-Compiler . . . int k = 0; r2 = r3 * r4; r0 = r0 + r2; k += j * 2; dm( _k ) = r0; func1(); ccall _func1; .S } _func1: r1 = dm( m3, i6 ) void func1(void) r1 = r1 + 1; . . . { int var1; Assembler Object Section = stack Assembler foo = 1; _j : 12 foo ++; _k : 0 } _var1: 1 a 8-17 17

  18. Software Build Process Software Build Process Step 1 Example: C Source with Alternate Sections Step 1 Example: C Source with Alternate Sections foo.DOJ foo.C section (“extern”) int array[256]; Object Section = extern section (“foo”) void bar(void) { _array [00] int foovar; _array [01] … foovar = 1; _array [255] foovar ++; } Object Section = foo _bar : r0 = dm(_foovar); Assembler C-Compiler r0 = r0 + 1; Assembler C-Compiler Object Section = stack _foovar: 1 a 8-18 18

  19. Directives Directives • Preprocessor Directives − #define - define a macro or constant − #undef - undo macro definition − #if, #endif - conditional assembly − #else, #elif - multiple conditional blocks − #ifdef, #ifndef - condition based on macro definition − #include - include source code from another file − #error - report an error message • Assembler directives − .ALIGN - specify alignment for code/data − .BYTE | .BYTE2 | .BYTE4 - define and initialize one-, two-, and four- byte data − .VAR - define and initialise 32-bit data object − .EXTERN - allow reference to global variable − .GLOBAL - change symbols scope to global − .SECTION - mark beginning of a section a 8-19 19

  20. Assembler Assembler • Assembler operators − ~ - ones complement − - - unary minus − * - multiply − / - divide − % - modulus − + - addition − - - subtraction − << - shift left − >> - shift right − & - bitwise AND (preprocessor only) − | - bitwise inclusive OR − ^ - bitwise exclusive OR (preprocessor only) a 8-20 20

  21. Assembler Assembler • Assembler operators (cont’d) − ADDRESS(symbol) - address of symbol − BITPOS(constant) - bit position − symbol - address pointer to symbol − LENGTH(symbol) - length of symbol a 8-21 21

  22. Assembler Assembler • Assembler command line switches − -Dmacro [definition] - define macro − -g - generate debug information − -h - output list of assembler switches − -i directory - search directory for included files − -l filename - output named listing file − -li filename - output named listing file with #include files − -M - generate dependencies for #include and data files − -MM - generate make dependencies for #include and data files − -Mo filename - write make dependencies to file − -Mt filename - specify the make dependencies target name a 8-22 22

  23. Assembler Assembler • Assembler command line switches (cont’d) − -micaswarn - treat multi-issue conflicts as warning − -o filename - output the named object file − -pp - run preprocessor only (do not assemble) − -proc processor - specify processor − -sp - assemble without preprocessing − -v - display information on each assembly phase − -version - display version information for assembler − -w - remove all assembler-generated warnings − -Wnumber - suppress any report of the specified warning a 8-23 23

  24. Assembler Assembler file Header file Data File .asm .h .dat Preprocessor Intermediate .is Assembler Listing File Object File .doj (binary) .lst (ASCII) a 8-24 24

  25. Assembler Property Page If you want to get the #include <defBF533.h> intermediate .is file, select #include “myheader.h” here #ifdef mydef R0 += 1; If chosen, you #else are able to mydef R0 += -1; debug in the source code #endif Depending on If chosen, a definitions, you listing file can select will be different codes created a 8-25 25

  26. Section ections in Assembler Files s in Assembler Files S • The .SECTION directive marks the beginning of a logical section − data and code form the content of a section − Multiple sections may be used within a single source file − Any section name may be chosen .SECTION data_a; .BYTE data_array[N]; .SECTION data_b; .VAR coeff_array[N]; .VAR x = 0x12345689; .SECTION program; _main: P0.H=data_array; P0.L=data_array; L0=length(data_array); . . . a 8-26 26

  27. The defBF533.h Header Files The defBF533.h Header Files • Allows Programmer to Use Symbols for Memory Mapped Registers • Located in: \\VisualDSP\Blackfin\include\ To include it use: #include <defBF533.h> or #include <defLPBlackfin.h> Example: P0.L = LO(TIMER0_CONFIG); P0.H = HI(TIMER0_CONFIG ); R0 = 0x2345(Z); W[P0] = R0.L; // Write 0x2345 to TIMER0_CONFIG • Operators LO( expression ) and HI (expression) must be used to load the 32-bit macros that are #define‘d in defBF533.h into 16-bit registers. NOTE: expression can be symbolic or constant a 8-27 27

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend