Intro_to_VDSP_transcript
Intro_to_VDSP_transcript
Chapter 1:Introduction
1a:Module Description
1b:CROSSCORE Products
Chapter 1: Introduction
Subchapter 1a: Module Description
Welcome to the training module for the introduction to Visual DSP++® Tools. My name is Nicole
Wright. I’m a staff engineer in the tools group and I will be presenting this module today.
This module will give you an overview of the Visual DSP++ Tools. For demonstration purposes
we’re going to be using the ADSP-BF537 EZ-KIT Lite® as a target. We’re also going to be using
Visual DSP++ 4.0 tools. We’re going to show you some quick tips on how to analyze your
application and fine tune them as well as some information about the tools.
In this module we’re going to give you information on the Blackfin ® CROSSCORE ®
Product offerings, we’re going to show you how to configure your EZ-KIT Lite. We’re going to
show you how to set up the hardware and how to configure the tools to use the EZ-KIT Lite. And
then we’re going to do a quick tour of the Visual DSP++ Tools. We’ll take you through creating a
project and we’ll also demonstrate the plotting feature, which is a useful debugging feature. Then
we’ll go on and cover performance improvement using features the of the chip. More specifically
we’ll be using cache, L1 memory and the voltage regulator. Finally we’ll be creating an Ethernet
application using the features of the tools. We have a template already set up for you to use
them.
First thing you’ll need to do is to plug in your power supply. Once that goes on you’ll see some
lights blinking on the board. The next thing you’ll need to plug in is your USB cable. The USB
cable for this demonstration is already been plugged in to the back of the PC. This is a direct USB
connection right into your PC. Once this gets plugged in you’ll get a message saying that it’s
found new hardware. All you need to do is click the next button on the hardware wizard and your
EZ-KIT device drivers will automatically be loaded on to your system. Now that I’ve shown you
how to set up the hardware I’m going to show you how to configure the tools so you can use them
with this target.
can see that we have some folders that have been already created for us. These folders are
where you keep your source file, your linker file, and any header files you may create. Today
we’re just going to create a simple C file. So what we’re going to do is ‘file’ off of the ‘new’ to
create a new file. We’re going to just do #include and we’re going to include our standard IO
library, so we can get our printf. We’re going to have a main function, now we’re going to put our
code for our main, which is just going to be a printf with a typical hello world. And let’s close out
that function, now we’ll save our file. Notice the ‘file saved’ comes up in your project menu,
project directory excuse me, that’s where we want to be. So we’re just going to call this ‘hello.c’
and save our project. At this point we have our project but our file has not been added to the
project. So let’s go ahead and add that file to the project by doing ‘project, add to project’, and
we’re going to add a file. You’ll also notice off the project menu this is where we build our project,
you can select your project options, and set your project to do what you want. You can update
your dependencies, export or make file, you can build a batch file, set your configurations, and if
you’re using source control this is where you set up your source control. The file we want to add
is ‘hello.c’, and you’ll notice that once we add it there’s a + by our source file to indicate that
there’s a file in there. So if we expand the folder you’ll see the hello.c file. Now what I’m going to
do is the next step is to build your file. So you do your project, ‘build project’. And you’ll note we
have the ‘build’ window down here, and that’s going to give you the status of what happens
during your build. When your build is completed successfully it’s going to load it on to the target.
This is a project, an options preference that we have in the tools already. And by default this load
upon build is set for you. A few other things you might notice is that we’re at the printf statement,
and it’s in blue, this is to indicate where the program counter currently is. You’ll also notice the
arrow indicating that as well. We also have the red button which shows that there’s been a
breakpoint automatically set there for you. This again is another user preference that you can set
yourself. So now that we’ve got everything built, let’s just run it and see what happens. I’m going
to use the ‘run’ icon, and if you just watch you’ll see the ‘hello world’ printing in your console
window. So so far we’ve created a project and we’ve run it just to give you a brief idea of the flow
of what you need to do to create an application.
going to configure a plot menu. So we that’s off of a ‘view’ menu, debug windows, and you notice
you have disassembly, trace, locals, expressions, just your typical debug windows that you want
to see as well as the plot. We’re going to create a new plot window, we’re going to do a line plot,
but as you can see from the pull down there’s several other plot types that are available to you.
We’re just going to call this plot ‘bubble’ since it’s the data from the bubble that we’re looking at,
the bubble sort. We’re going to call our data set ‘data set 1’, we’re going to look at the Blackfin
memory and the address that we’re going to use is the address the address for our array, which
you can see right here in our program it’s out_b, I’m just going to put the address right there. Our
count, we’re going to go for a 128 and our stride is 128 elements in our array that’s the count of
how many memory spaces, and then our stride 1, then for our data type we know that’s an
integer, so we want to look at the integer values of that. So the key thing here is you need to
remember to hit the add button to add your data set before you leave this dialog box. So we’ve
added our data set, we’re going to hit the ‘okay’ button. And at this point you’ll see our plot come
up. Right now there’s nothing in our array it’s all been initialized to zero. What I’d like to do is I’m
going to set a break point right before we start the bubble sort because as you can see we have a
randomized array function before the bubble sort. So the randomized array will randomize the
data in our array, then we’ll do the bubble sort and then you’ll see that the data has been sorted.
To create a breakpoint you can do it one of two ways you can click on the line where you are and
then click in the gutter, double click, there you go and you have your break point. Or you could do
it from the icon. So we’re going to run to this point and that’s off of your Debug menu. You can
see now that our data has changed, it’s all randomized, our variables are all over the board, this
is before we do the sort but because we started. Now what we’re going to do is I’m going to run
the program to completion and you’ll see at the end that we’ll be all set with our sorted variables.
Again debug, run. There you go now you can see the bubble plot, our data is sorted, and this is a
very good way for you to look at the values in your memory. This saves me having to actually
print out or having it go into the memory window and look at every single item in there and check
by hand. It’s a good visual indicator of making sure that your data is as you like it. So there you
go we’ve just completed the tour, quick tour of the Visual DSP++ tool, and the plotting feature.
project that has been created for you, it’s in the kit and we’ll go over that, I’ll show you where that
is later on. Again this is just a simple variation on our sort. One of the things that I’m going to
show you that allow you to see how your project is doing is the statistical profiler. Now let’s bring
that up, ‘tools’, statistical profiling, and do ‘profile’. There you go. I’m just going to get this
running because this is an unoptimized version of this program. Everything is running in external
memory so we’ll have a little time to talk about things as it’s running. So let’s build and load our
application, again you’ll see in the build window you’ve got some information and you can see
that we’re loading, and we’re completed loaded. One thing I’d like to show you here is in the
console window if you right click you can clear the contents of the console window. Since we had
some stuff in there I’m going to be looking at the output here in the console window it’s a lot
easier to see it when it’s cleared . I’m just going to run this project. The statistical profiler polls the
chip hundreds of times per second to see what is running in your application. So as you can see
in our histogram most of the time is spent in our bubble sort since this is a slower sort than the
quick sort this is what you’d expect. You’ll also notice that we’re running very slow because we’re
not optimized. You can see that we’re running by the running in the bottom of your screen here.
And again everything is running external memory so this is going to be kind of slow, we’ve
purposely made it this way. Another thing about this statistical profiler is that as it polls the chip
it’s not intruding on your program. It’s running in the background, there was no special code that
we had to add.
Here we go we’ve completed our application. And you can see that our unoptimized application
completed in 38 seconds, and it took over 9,000 million cycles to complete. Most of those cycles
you can see from the histogram were spent in the bubble sort, 70%. The quick sort, spent some
time there.
Then the next part of this demonstration, I’ll close some windows so that we’ve got a much better
view of what’s going on, we’re going to use cache. Which is the reserved memory on your chip,
the Blackfin allows you to put instructions in that reserved memory. And the way that we do that is
we go to ‘project, options’ and you’ll notice if you scroll down you can set the options here for your
compiler, your assembler, your linker and other options. What we want to do is go to the start up
code. What we’re going to do is we’re going to look at the cache and memory protection section.
It’s very easy to set your instruction cache, you just go right here, select an option, ‘instruction
cache’ and hit okay. And again this will run our project in the reserve memory, which will be much
faster then running from external memory as we did before. One thing you need to remember to
do when you do this is to rebuild your project. I’m going to rebuild my project for those actions to
take effect, again we’ve done no programming, it’s totally all through the GUI. Our histogram has
blanked itself out because we’re not running anything, and again let’s just look at this, it took 38
seconds our first time through. Now let’s run this, we should get much better performance this
time around. Again you’ll notice from the histogram that we’re still spending a lot of time in the
bubble sort as opposed to quick sort. If we look down in the output window we just completed
that program in 3 seconds and just over 700 million cycles, which is much faster then what we
had before.
to float this in the main window. I’m going to close the disassembly window just to give us some
screen real-estate, and I’m going to open up this sort window. Before we look at the code, since
this is going to take a while to build, I’m just going to build this application. I’m going to use the
‘rebuild all’ icon. So with Blackfin 537 you can set the voltage and frequency using the system
services library. When you set the voltage the frequency for the chip is set to maximum frequency
for that voltage. And that is done as I said by through system services library. What we’re doing
here in this demonstration is we have an array that we’re passing in and we’re using 4 voltage
levels. And again when we set our voltage to .85 the system service library is automatically going
to set that internally to the highest frequency. So since this is going to take a while to run, let’s
run this because we’re doing it at three different speeds, and I’ll show you a bit about where the
calls are and how that’s done. So we’re going to show what the voltage is set at, the number of
seconds it takes to run, and the number of cycles it takes to run. And again we have our 4 voltage
settings that we’re going to use. If we scroll down a bit we can see that we’re using one call to
the system services library to accomplish this. The call is adi_ power_init. Again if you’d like
more information on this I suggest you go to the help system and you can look up the specifics of
how to use this. For the purposes of demonstration we’ve set this up for you, and you can see
we’re starting to get some results. With our voltage at .85 it takes 30 seconds to run this simple
sort. And again our cycles are very important to watch because as we’re changing the voltage
and the frequency our cycles are not changing but the speed at which we run the application is.
There you go, so you can see that we cut the seconds almost in half by just a .10 voltage change.
But our cycles stayed the same. And again you can see that we’re running by the running
indicator on the bottom of the screen. There we go our next application, next setting, and you
can see here another thing you might want to look at, here’s some more, we set command pairs
for ez_kit-init this is the ez_kit_init which is again a system service library feature, very nice to
use. Okay we’ve completed our application running. One quick thing to note that when our
applications do terminate they terminate in the disassembly window at lib_prog_term and you’ll
also know that your application has stopped running by the halted message in the bottom of the
status screen. Let’s just take a quick look at our results, again you can see that they’ve proved
what we’ve been talking about, as the voltages change and our frequency has been set to the
maximum amount for that voltage, our seconds to run the program, have decreased, but yet our
cycles have stayed the same.
In this section of the demonstration we’ve talked about three ways that you can optimize your
program. You can use instruction cache, you can use L1 Memory, and you can set the voltage
and frequency internally on your chip. Depending on how you’d like your application to run you
may choose to use just one of these quick optimizations, or you may use a combination of them,
it’s totally up to you. But now you have the information on what you need to know for some quick
things to try and get your application optimized quickly.
our link has been established, and that we have an IP address. One quick thing I want to show
you in our thread before we go any further, you can see, you’ll see where the printf’s come from.
Then we started the stack for you, we put some kind of Cliff Notes in here for you. There you go
you can see right here after the printf for IP address it’s kind of giving you a clue this is where
you’ll want to add your application code. So the template is very user friendly, you’ll be able to
pick out from where the printf’s are, what you add to your code, and do a little debugging in case
you have a problem at this end.
Well now we have our IP address but let’s test to make sure that our Ethernet connection is
working correctly. What I’d like to do at this point, is I’m going to bring up a DOS window. What
we’re going to do is we’re going to use the DOS ping command to go out and transmit data to the
board via Ethernet and see how our transmission is going. We’re going to use the IP address
that’s in the console window, you just type ‘ping’. And again this is a standard DOS application so
you should be able to do this on your machine. So we’re going out into our mini little network
here and you can see that we are getting data back and forth. So that our Ethernet application is
indeed running correctly, we just didn’t print something up for you, we actually did do the work
and it is working as expected.
So this concludes the Ethernet portion of our demonstration. So so far just to wrap things up a bit,
we’ve gone through, we’ve shown you what our CROSSCORE product offerings are. We’ve given
you information on how to set up the hardware board and how to configure the tools to use the
board. We’ve also gone through and done a quick demonstration of how to set up an application
and a plotting feature. We’ve moved on to show you how to optimize your application using the
product features of the chip. And then lastly we’ve shown you our Ethernet functionality that we
have already in the template.
Now that we’ve concluded the demonstration portion of this module, I’d like to give you some
places where you can go to get additional information. All of the sort projects used today are
covered in the Getting Started with the ADSP-BF537 EZ_KIT Lite Manual. The tools manuals are
provided in the online help to give you information about specific tools or using the tools
themselves. You can also go to the Analog website; www.analog.com to find information on tools,
tools update, engineering information. We also have two email support addresses available for
you. If you have questions regarding the use of the tools we suggest that you send email to;
[email protected]. And if you have questions regarding the processor that
you’re using, please send them to; [email protected]. Or you can simply click the
‘ask a question’ button in this demonstration.