Developing Software for Embedded Systems on FPGAs

 Hi I’m Nathan Knight, an embedded applications engineer at Altera Corp.  FPGA’s are becoming more common in embedded design.  If you haven’t already, you’re likely to see on in a future project.   Fortunately, the software development protocol, for an FPGA processor is similar to what you’re used to with an off the shelf processor.  Today I’m going to show you how easy it is to develop software for an FPGA based embedded system.  I’m going to do this by using the ES2 embedded evaluation kit.  The ES2 is a configurable 32 bit processor.  Because it configurable you can select the exact set of set CPU’s and interfaces that you need for your application.  So let’s get started.  First let’s turn on the ES2 embedded evaluation kit.  This kit is perfect for developers that are new to FPGA’s.  The kit includes hardware and software development tools, design examples, tutorials and all the documentation you’ll need to get started.  Everything is in the box.

The first thing you’ll see when the kit powers up is the application selector.  This displays all the applications that are pre-loaded on the SD card.  Let’s look at the system (DEMO).

Another unique capability of this kit is how the applications are loaded.  The board contains an FPGA with a NIOS2 processor, an SD memory card and a flash memory device.  To reconfigure first the processor copies the hardware image from the SD card to the memory device.  It does the same thing with the software image, and then the process instructs the FPGA to reconfigure itself from the flash memory. The new configuration with contains a nios2 processor then boots form the flash memory device.  The application starts.

This demonstration calculates the Mandelbrot fractal using two methods.  First, using hardware accelerators.  Normally you’d need a processor that is much higher speed, but by using much higher accelerators NIOS2 can achieve this performance by running at only 80MHz.  The hardware accelerators in this example were created by the Altera NIOS2 cetaH compiler.  This compiles AnzCC code into accelerators. As a comparison, this is the performance you can see when the accelerators are removed, which, as you can see, is much slower.  Now I’ll show you how to build your own application. 

The software development flow is probably similar to what you’re used to.  First, your hardware engineer hands off a file that contains a description of your NIOS2 system.  Next, the NIOS2 software development tools automatically generate a vsp from this input.  If your hardware designs changes, you only need to generate a new vsp.  You do not need to change your application software.  NIOS2 tools also make it easy to program your design for flash by providing a flash program or utility.  This utility also inserts a boot copier that boots your system from flash and copies the software to ram.  We provide examples that show you this entire flow. For this demonstration, a hard design has been created for us and we’ve generated a vsp.  This is typical C code we are building.  I could build the project right from NIOS2 IDD, but for this demo I’m going to build it from the command line.  

To build the project from the command line, just type MAKE.  After finishing the build we have an elf file, which is the executable file that we’ll be downloading for the board.  Loading the file can be done a couple of ways.  We’ll be using a USB cable.  First, we configure the FPGA to our hardware design.  Next we download the software application to RAM and run it.  You’ll see the spinning cube app running on the board.  You can also copy the hardware and software files to an SD card which will allow you app to appear in the application selector the next time you power up the board.  

To learn more or to order your own kit go to www.altera.com/nios2eval

Related videos

Latest Videos

Sorry, your filter selection returned no results.

We've updated our privacy policy. Please take a moment to review these changes. By clicking I Agree to Arrow Electronics Terms Of Use  and have read and understand the Privacy Policy and Cookie Policy.

Our website places cookies on your device to improve your experience and to improve our site. Read more about the cookies we use and how to disable them here. Cookies and tracking technologies may be used for marketing purposes.
By clicking “Accept”, you are consenting to placement of cookies on your device and to our use of tracking technologies. Click “Read More” below for more information and instructions on how to disable cookies and tracking technologies. While acceptance of cookies and tracking technologies is voluntary, disabling them may result in the website not working properly, and certain advertisements may be less relevant to you.
We respect your privacy. Read our privacy policy here