Writing software for an embedded system


2012-04-25Publicerad av Sven-Åke Andersson

Introduction


We didn't design our embedded system to run the "Hello World" program but to control some hardware on the board. Let's find out how we can achieve this task. Here is a good introduction from the FPGA design from scratch blog.

The LEDtest program


To make things simpler but still cover the main objectives we will write a program that controls the LEDs on the board. We will add a new C-project called LEDtest. Here is the system.mss file generated.




 
 

The board support package


This is what the BSP file structure looks like:

 



To examine the board support package we select <Board Support Package Settings> from the <Xilinx Tools> menu in SDK and choose the right BSP.

 




 

 Here are the software drivers for all the IP cores in the embedded system.



 

 
Program examples


Lazy as usual we start looking for some example files and find them in the Xilinx Design Suite installation: /opt/Xilinx/13.4/ISE_DS_EDK/sw/XilinxProcessorIPLib/drivers.

 

 

To control the LEDs we will use the GPIO interface.
 

Low level C-program


Let's study the c-program xgpio_low_level_example.c and make our own LEDtest.c program. Here it is:

 



 

After building, loading and running the LEDtest program we will see the four LEDs on the board counting up.