07Extra JustenoughInformation

Information about 07Extra JustenoughInformation

Published on November 28, 2007

Author: Chan

Source: authorstream.com

Content

Just enough information to program a Blackfin:  Just enough information to program a Blackfin Familiarization assignment for the Analog Devices’ VisualDSP++ Integrated Development Environment Slide2:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 2 / 27 This will help to get ahead on the assignments Tackled today:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 3 / 27 Tackled today Recipe for Just in time knowledge  Need a dollop of “C++” code A smizzen of knowledge to build the simplest possible Blackfin assembly language for-loop { } and while { } 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 320. VisualDSP++ IDE:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 4 / 27 VisualDSP++ IDE Analog Devices’ integrated development environment (IDE) has been used in the following courses Blackfin – ADSP-BF533 ENCM415 – Assembly language and interfacing (2004) ENSF413 – Switching to Blackfin for 2008 ENCM491 – Real Time Systems (2003) ENCM511 – New project oriented microcontroller course (2008) ENEL619.23 -- High speed embedded system architectures (2004) ENEL583/589 – Many 4th year team projects (2004) TigerSHARC – ADSP-TS201 ENCM515 – Comparative Processor Architectures for DSP (Since 1999) ENEL619.23 -- High speed embedded system architectures (2004) Just enough to know:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 5 / 27 Just enough to know If time today will do a demo. Build a directory <HOME>:/ENCM415/Assignment Remember to insert the BF533 board power plug (check that lights on board flash) Activate VisualDSP -- Log into a station and use Analog devices CONFIGURATOR to set up a “BF533 session” to connect to the hardware Use VisualDSP++ and activate a Blackfin BF533 session – lights should pause Build a Blackfin Project, add to your directory Add your C++ files to the project Compile, Link and Run using the equivalent commands as with Microsoft Visual Basic, Visual Studio etc Add your assembly ASM files to the Blackfin project Compile, Link and Run using the equivalent commands as with Microsoft Visual Basic, Visual Studio etc Don’t forget to add some tests so that you know the code is working Analog Devices CONFIGURATOR:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 6 / 27 Analog Devices CONFIGURATOR Run VisualDSP – Add New Project:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 7 / 27 Run VisualDSP – Add New Project WRITE main.cpp, ADD to Project :  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 8 / 27 WRITE main.cpp, ADD to Project Then BUILD (which causes a LOAD):  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 9 / 27 Then BUILD (which causes a LOAD) Build and load Then Debug | Run the code:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 10 / 27 Then Debug | Run the code Prepare for Assignment – C++ result:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 11 / 27 Prepare for Assignment – C++ result C++ Version of an assignment :  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 12 / 27 C++ Version of an assignment “auto-increment” of a pointer. Here is how to “try” to get compiler to do it :  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 13 / 27 “auto-increment” of a pointer. Here is how to “try” to get compiler to do it Prepare main( ) to call assembly code and CHECK the results:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 14 / 27 Prepare main( ) to call assembly code and CHECK the results Build WITHOUT ADDING assembly code file Error message is VERY SPECIAL:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 15 / 27 We thought we needed to build the function Assignment1_ASMversion( ) However the linker is worried about not finding _Assignment1_ASMversion__Fv Build WITHOUT ADDING assembly code file Error message is VERY SPECIAL Standard Format “Assembly code” stub assignment1ASM.asm:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 16 / 27 Standard Format “Assembly code” stub assignment1ASM.asm Header info Prologue Code to return value Epilogue A “stub” provides “just enough code” not to crash the development system. It acts as a “test” for the correct call from “main()” Result using “Assembly code” stub:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 17 / 27 Result using “Assembly code” stub Exactly the result we expected Keyword – R0 – 32-bit Data Register:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 18 / 27 Keyword – R0 – 32-bit Data Register R0 = 7; // This returns value 7 … Assembly code comment End of line marker 32 bit data register -- R0, R1, R2, R3, R4, R5, R6, R7 Keyword – P0 – 32-bit pointer Register:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 19 / 27 Keyword – P0 – 32-bit pointer Register 32 bit pointer register -- P0, P1, P2, P3, P4 Careful – when not in the assembler, the linker may give errors which mention p0 which stands for processor 0. The blackfin hardware can come in multi-core version (p0 and p1 for BF561) or multi-processor version. Keyword 32-bit Frame pointer:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 20 / 27 Keyword 32-bit Frame pointer 32 bit Frame pointer -- FP As on many processors LINK and UNLINK instructions involve hidden operations on FP and SP (stack pointer) More on that in a later class Keyword – Memory operations:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 21 / 27 Keyword – Memory operations 32 bit memory read [ ] – long-word access R0 = [FP + 4]; If FP contains the value 0x20000000 then fetch the 32-bit value starting at memory location 0x20000004 and place in data register R0 Keyword – Memory operations:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 22 / 27 Keyword – Memory operations 16 bit memory read W[ ] –word access R1.H = W[FP + 28]; If FP contains the value 0x20000000 then fetch the 16-bit value starting at memory location 0x20000028 and place in data register R1.H which is the UPPER part of the register R1 (R1.H and R1.L) Keyword – Memory operations:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 23 / 27 Keyword – Memory operations 8 bit memory reads are also possible B[FP + 4]; Slide24:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 24 / 27 Perhaps time for a working example Programmer’s model:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 25 / 27 Programmer’s model 32 bit data register R0, R1, R2, R3, R4, R5, R6, R7 16 bit data register R0.H, R1.H, R2.H, R3.H ……. R7.H R0.L, R1.L, R2.L, R3.L ………. R7.L 32 bit Pointer register (“address”) P0, P1, P2, P3, P4 NO 16 bit Pointer (“address”) registers You need to have 32 pointers to access 16-bit values stored ANYWHERE in the memory 32 bit Frame Pointer -- FP 32 bit Stack Pointer -- SP Memory access MUST be done via a Pointer register:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 26 / 27 Memory access MUST be done via a Pointer register 32-bit Memory access Place value 0x2000 into register P1 THEN R0 = [P1] accesses (reads) the 32-bit value at 0x2000 and leaves P1 unchanged (P1 still equals 0x2000) R0 = [P1 + 4] accesses (reads) the 32-bit value at 0x2004 and leaves P1 unchanged (P1 still equals 0x2000) R0 = [P1++] accesses (reads) the 32-bit value at 0x2000 and autoincrements P1 by the size of a long word (4 bytes) (P1 NOW equals 0x2004) Memory access MUST be done via a Pointer register:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 27 / 27 Memory access MUST be done via a Pointer register 16-bit Memory access Place value 0x4000 into register P2 THEN R0 = W[P2] accesses (reads) the 16-bit value at 0x4000 and leaves P2 unchanged (P2 still equals 0x4000) R0 = W[P2 + 4] accesses (reads) the 16-bit value at 0x4004 and leaves P2 unchanged (P2 still equals 0x4000) R0 = W[P2++] accesses (reads) the 16-bit value at 0x4000 and autoincrements P2 by the size of a word (2 bytes) (P2 NOW equals 0x2002) Just enough to know:  M. Smith -- ENCM415 Assembly Language and Interfacing on the Blackfin ADSP-BF533 microcontroller 28 / 27 Just enough to know If time today will do a demo. Build a directory U:/ENCM415/Assignment Remember to insert the BF533 board power plug (check that lights on board flash) Activate VisualDSP Log into a station and use Analog devices CONFIGURATOR to set up a “BF533 session” to connect to the hardware Use VisualDSP++ and activate a Blackfin BF533 session – lights should pause Build a Blackfin Project, add to your directory Add your C++ files to the project Compile, Link and Run using the equivalent commands as with Microsoft Visual Basic, Visual Studio etc Add your ASM files to the project Compile, Link and Run using the equivalent commands as with Microsoft Visual Basic, Visual Studio etc Don’t forget to add some tests so that you know the code is working

Related presentations


Other presentations created by Chan

10 Arthropod
04. 01. 2008
0 views

10 Arthropod

Chapter Six Fat Vitamins
05. 03. 2008
0 views

Chapter Six Fat Vitamins

Turkey Trivia game
26. 11. 2007
0 views

Turkey Trivia game

Identifying Failing Systems2
08. 11. 2007
0 views

Identifying Failing Systems2

Sponsorship Powerpoint
04. 12. 2007
0 views

Sponsorship Powerpoint

Hinduism my version
05. 12. 2007
0 views

Hinduism my version

TN Research
06. 12. 2007
0 views

TN Research

AFNORTH Briefing
31. 10. 2007
0 views

AFNORTH Briefing

speciaissuesmay12006
06. 11. 2007
0 views

speciaissuesmay12006

m220w04
07. 11. 2007
0 views

m220w04

GCSPNORO
06. 11. 2007
0 views

GCSPNORO

Jyoti Sagar IPR
23. 11. 2007
0 views

Jyoti Sagar IPR

reportpower
26. 11. 2007
0 views

reportpower

301 admin
13. 12. 2007
0 views

301 admin

cbrn threats
28. 12. 2007
0 views

cbrn threats

1ki7r36cnl3vuyj
28. 12. 2007
0 views

1ki7r36cnl3vuyj

Ionic Conductivity
30. 12. 2007
0 views

Ionic Conductivity

ElaineYau munsell
02. 01. 2008
0 views

ElaineYau munsell

SWING07 Day4 Buttyan
23. 12. 2007
0 views

SWING07 Day4 Buttyan

revolutions
07. 01. 2008
0 views

revolutions

thirtle1101b
07. 01. 2008
0 views

thirtle1101b

28b
02. 01. 2008
0 views

28b

gischner
06. 11. 2007
0 views

gischner

3303
03. 12. 2007
0 views

3303

Biferale lecture
29. 10. 2007
0 views

Biferale lecture

clp2
18. 12. 2007
0 views

clp2

SFpubs
07. 12. 2007
0 views

SFpubs

RomeI
01. 11. 2007
0 views

RomeI

CBoL 2007 Eizirik
19. 11. 2007
0 views

CBoL 2007 Eizirik

Economides
20. 02. 2008
0 views

Economides

rivalry
24. 02. 2008
0 views

rivalry

prairie chicken
22. 11. 2007
0 views

prairie chicken

Nair
25. 12. 2007
0 views

Nair

1361 1
30. 12. 2007
0 views

1361 1

romanowski commercial future
14. 03. 2008
0 views

romanowski commercial future

wacs
27. 03. 2008
0 views

wacs

Jack DeHovitz 9 11 07
04. 01. 2008
0 views

Jack DeHovitz 9 11 07

HikeEverest
30. 03. 2008
0 views

HikeEverest

PAH Lung Transplant FRACP 2007
02. 11. 2007
0 views

PAH Lung Transplant FRACP 2007

OIL SEMINAR jrw
13. 04. 2008
0 views

OIL SEMINAR jrw

Read Only Faries
24. 10. 2007
0 views

Read Only Faries

NW IP Telephony and the VCS
30. 11. 2007
0 views

NW IP Telephony and the VCS

IBP
12. 12. 2007
0 views

IBP

WP3 Pierini
12. 11. 2007
0 views

WP3 Pierini

steinhoff
03. 10. 2007
0 views

steinhoff

slab june2002
30. 10. 2007
0 views

slab june2002

cushman
10. 12. 2007
0 views

cushman

lecture7comp
27. 09. 2007
0 views

lecture7comp

hill
28. 09. 2007
0 views

hill

gridpp13 atlas
31. 10. 2007
0 views

gridpp13 atlas

200791918397805
01. 11. 2007
0 views

200791918397805

Tiffen
28. 12. 2007
0 views

Tiffen