Lab Report Zeb A
Lab Report Zeb A
LAB REPORT
REAL TIME EMBEDDED SYSTEM(AES-631)
Under Guidance of:
Dr. Kota Solomon Raju
Sh. Pramod Tanwar
Nancy
Submission Date: 1/4/2014
Submitted To:- Submitted By:-
Dr. kota Solomon Raju Zeba Khanam
(RCS & WSN Lab) PGRPE-13
Experiment No: 01
Objective: - Implementation of matrix operations by creating DKM, RTP images using
VxWorks.
Tools: - Wind River Workbench 2.5
Theory: Wind River Workbench is an Eclipse based development suite that provides an efficient
way to develop real time and embedded application with minimal intrusion on the target system.
Wind River workbench provides cross development tools to write a code for target hardware on
different system called Host. By cross development features we can write a code on system i.e.
Windows, linux etc. and produce application that run on hardware.
VxWorks Image project: Image Project(VIP) is used to configure, scale and build a VxWorks kernel to
boot the target. Using this type of project we can configure the kernel components as per the requirement
of the application and hardware. A VIP can be a complete application or can also contain projects of other
types like Downloadable Kernel Module (DKM), Real Time Process (RTP), Shared Libraries, VxWorks
ROMFS file system projects.
Downloadable Kernel Module Project:-this type of project to manage and build modules that will exist
in the kernel space. Using this feature we can separately build the modules,run and debug them on a target
hardware/simulator running VxWorks, loading, unloading, and reloading on the fly. After completion of
application development, the module can be statically linked into the kernel or we can also use a file
system if one is present.
Real Time Process projects(RTP):- Vx Works Real Time process projects are used to manage and build
the modules that exist outside the kernel space. The RTP is stored in form of executable with extension
.vxe which can be build, run, debugged separately. A run-time, the executable file is downloaded to a
separate address space to run as an independent process. The binary produced from a VxWorks Real-time
Process project will need to be stored on a target-
Steps:-
Creating anVxWorks Image Project:-
1. Creating New VxWorks Image Project by going on new>VxWorks Image Project
1. Enter the project name proj_1 and select the project location.
2. For project setup select BSP as simpc and tool chain diab
3. For Options, configuration profile and static analysis leave the options as default.
4. By clicking on finish button; finish the image project creation
5. After finishing of VxWorks image project the application development window appear like
6. Kernel configuration. This exercise was executed on simulator so kernel configuration we only
include the Real Time Process Component.
7. Rebuild. proj_1.
8. After successful build the following screen will appear
Creating a VxWorks Downloadable Kernel Module Project:
1. In the application development window click on file -> new -> VxWorks Downloadable Kernel
Module Project
2. Enter the project name mat_operation and leave other thing default
3. Project structure is used to create the subproject or to give the reference to the project.For this
problem leave things default.
4. Leave the Build setup and default and Build support option default and click next.
5. Select the available build specifications. In this SIMNTdiab is selected for simulator. Optionally
I had chosen the debug mode. If target board is to be used then PPC32diab should be selected
for the available board
6. Leave the Build target window with build tool linker as default
7. Leave the static analysis window checked as shown and click finish
8. Add the application program by right clicking on the mat_opeartion in project navigator -> new
->file
9. Enter the file name mat_oper.c
10. Write the application program in the mat_oper.c
11. Build the mat_operation project
12. After completion of build operation we get mat_operation.out file which can be directly
downloaded to the kernel
Starting simulator:-
1. In the application development window from the target management click on create a new
connection
2. Select Wind River VxWorks 6.x Simulation Connection and click next
3. Copy the image file location to the VxWorks kernel image
4. Leave VxSim Memory option default and click next.
5. Leave VxWorks Simulator Miscellaneous options default and click next.
6. Leave Target server option default and click next.
7. Leave Object path mappings default and click next.
8. Leave Target state refresh default and click next.
9. See the Connection Summary and click
10. After simulator setting simulator window open and Shell window appear.
11. Download mat_operation.out into simulator
12. Select SIMNT(VXSIM0) and click ok
13. In the simulator shell enter the function name matprt and press enter
14. Enter the matrix input values and observe the result
Creating a RTP (Real time process) project:-
1. In the application development window click on file -> new -> VxWorks Real Time Process
Project.
2. Create a project having name mat_add_rtp and for this case select Create project in work
space
3. Leave Project setup , Options , configuration Profile , Static analysis Default and finish
the RTP creation.
4. Choose the build specification SIMPENTIUMdiab_RTP and click next
5. Leave the build target name and build toll as default setting
6. Leave the basic configuration settings checked and click finish. This finishes the RTP creation.
7. Add the application program by right clicking on the mat_add_rtp in project navigator -> new -
>file
8. Enter the file name mat_add.c
9. Write application code for Matrix addition in c language
10. Build the mat_add_rtp
11. Build the RTP project this will create a mat_add_rtp.vxe executable file in the RTP project
directory
12. Repeat the step 1 - 11 for creating a new RTP for matrix multiplication name it mat_mult_rtp
13. After building mat_mult_rtp an executable file mat_mult_rtp.vxe is created
14. These two executable files may be added to ROMFS file system and associated with kernel
image
Creating ROMFS file system:-
1. Choose Choose to File -> New ->VxWorks ROMFS file system project in the application
window
2. Enter the project name problem1_romfs and set the location as workspace and click next
3. Click next in project structure with default setting and finish the static analysis with default
setting.
4. Drag and drop the problem1_romfs project into the problem_1 image project
5. Rebuild the image project problem_1
6. Start the simulator connection which was earlier created
7. When shell appears on the type devs it shows the directories. romfs is one of the directory
8. Change the current directory by typing the command cd /romfs the screen appears as
9. use ls command to list all the .vex file
10. Execute the RTP projects using command rtpSp rtp_project_name
Conclusion and observation:In this project VxWorks image project, Downloadable Kernel module
project, Real Time Process Project and ROMFS file system projects are created. In this matrix operation
like addition and multiplication of two matrix had been performed. In the RTP projects scanf function is
not working because as it is a real time project predectibality must be high thus if input needs to be taken
from the surrounding then the predictibilty is reduced. However if the function is called in simulator scanf
can be used
Experiment No: 2
Objective:Implementation of Matrix operation by creating tasks(Task Creation, deletion,
task suspend and priority) with DKM,RTP projects.
Tools used:-Wind River Workbench2.5
Theory:-
Task: - Tasks are basic unit of execution in VxWorks. An application in the VxWorks may
contain a number of tasks. VxWorks task has following states:-
1) READY state: The task is not waiting for any resource other than the CPU.
2) PENDING state: The task is blocked due to the unavailability of some resource.
3) DELAYED state: The task is a asleep for a duration
4) SUSPENDED state: The task that is unavailable for execution (but not pended or
delayed). This state is used primarily for debugging. Suspension does not inhibit state
transition, only execution.
Task creation:- in VxWorks tasks are created using function taskSpawn().This function
creates and activates a new task with a specified priority and options and returns a system-assigned ID.
Int taskSpawn (
char * name, /* name of new task (stored at pStackBase) */
int priority, /* priority of new task */
int options, /* task option word */
intstackSize, /* size (bytes) of stack needed plus name */
FUNCPTR entryPt, /* entry point of new task */
int arg1, /* 1st of 10 req'd task args to pass to func */
int arg2,
int arg3,
int arg4,
int arg5,
int arg6,
int arg7,
int arg8,
int arg9,
int arg10 )
Task delete:- task can be deleted using the routine taskDelete(inttask_id). This routine
causes the specified task with task_id to deallocates the stack and task control block(TCB)
resources. This routine returns OK if task is deleted and ERROR is task is not deleted.
Suspending a task:- A ready task can be suspended by calling taskSuspend(inttask_id)
routine. Suspension is additive, thus task can be delayed and suspended, or pended and
suspended. Suspended, delayed tasks whose delays expire, remain suspended. A task can be
suspended regardless of their current state
Resuming a task:- A task which is in suspended state can be resumed using routine
taskResume(inttask_id). Resumed task can be placedin ready state or running state
depending upon their priority. A delayed and pended task is resumed if delay is expire and
resources are avialabel.
Task priority:- Priority of any task can be set by calling routine taskPrioritySet(inttask_id,
intnew_priority). Priority ranges from 0(highest priority) to 255(lowest priority). Current
priority of any task can be examined using routine taskPriorityGet(inttask_id, int
*pPriority). This routine copies the current priority of the task with task_id to the integer
pointed by pPriority
Steps:-
1. Create a VxWorks image project with BSP as simpc. Steps of image creation were followed
from experiment1.
2. Build the image project.
3. Create a Downloadable Kernel Module Project with SIMANTdiab as build specification.
Steps are same as that of the experiment no1.
4. Add an new file to the DKM with name task_mat.c
5. Write the application program of task creation, priority setting in the file mat_task.c
6. Build the DKM project
7. Copy the image file location of the problem_2 image file into the vsim1 simulator properties.
8. Start the simulator vsim1 and download task_mat.out
9. Type the project name main into the simulator and press enter
Observation and conclusion :In this experiment I performed the task related operation i.e. task creation,
task deletion, task suspend, task resume, task priority setting for matrix application. In the RTP project
task priority setting cannot be done.
Experiment no: 3
Objective: - Implementation of Semaphores, Mutex , event creation, interrupt and exception
handling for matrix operation.
Tools: - Wind River Workbench 2.5
Theory: -Inter task communication: tasks communicate and synchronize themselves by using inter
task primitives which are the kernel objects for facilitating the synchronization and
communication between two or more tasks. VxWorks kernel provides some intertask
communication mechanisms like shared memory for simple sharing of data, semaphores for
task synchronization and basic mutual exclusion, mutexes and conditional variables for
mutual exclusion and synchronization, message queues and pipes for intertask message
passing within CPU and VxWorks events for communication and synchronization
Semaphores:- semaphores are the highly optimized tool for inter task communication which
is used for both mutual exclusion and synchronization. There are three types of semaphores:
1) Binary semaphore:- Binary semaphore has the value either 0 or 1. When the value is 0,
semaphore is considered as empty or unavailable. When its value is 1 then it is
considered as full or available. Binary semaphore is first created by using
semBCreate(SEM_Q_PRIORITY/SEM_Q_FIFO,SEM_FULL/SEM_EMPTY) as empty
or full semaphore. Binary semaphores are global resource and can be shared across all the
tasks which needs them, also it can be released by any task which may or may not
previously acquired it
2) Counting Semaphores:- it uses a count to allow to be acquired and released multiple
times. Count must be provided to the counting semaphores during its creation. If initial
count is zero then semaphore is unavailable and if initial count is nonzero then count
number of semaphores is available. One or more task can acquire a token from the
counting semaphore until it is available. This can be created using
semCCreate(SEM_Q_PRIORITY/SEM_Q_FIFO,COUNT_VAL).
3) Mutual exclusion Semaphores (MUTEX):-Mutexes are the special binary semaphores
that supports ownership, recursive access, task deletion safety and safeguard against the
priority inversion. Mutex states are locked and unlocked(1 and 0 respectively). A mutex
is initially created in unlocked state, in which it can be acquired by the task and go into
locked state. It can be created using semMCreate(options). Options can be
SEM_Q_PRIORITY,SEM_Q_FIFO,SEM_DELETE_SAFE,SEM_INVERSION_SAFE.
Because of feature of recursive access it can be taken more than once by the task that
owns it before finally being released. Recursion is useful for a set of routines that need
mutually exclusive access to a resource, but may need to call each other.
Procedure:-
1. Create a VxWorks image project with BSP as simpc. Steps of image creation were followed
from experiment1.
2. Build the image project.
3. Create a Downloadable Kernel Module Project with SIMANTdiab as build specification. Steps
are same as that of the experiment no1.
4. Add an new file to the DKM with name sem_pro.c
5. Write the application program of task creation, priority setting in the file sem_pro.c
6. Build the DKM project
7. Copy the image file location of the Lab_2 image file into the vsim1 s imulator properties.
8. Start the simulator vsim2
9. Download the sem.out file of DKM project to the simulator
10. Type the project name main into the simulator and press enter
Experiment 4
AIM: Implementation of PPC based embedded system for controlling input and output
using custom IP(standalone).
Apparatus: Xilinx EDK 10.1,Xilinx- ISE, Xilinx Virtex II-Pro Development Kit
Procedure:
Step 1: Cick on Xilinx Platform Studio (XPS) and go to File ->New project to create new
project using BSB wizard
Step 2: Select board vendor and board name and version.
Step 3: PowerPC processor core has to be selected
Step 4: Uart_1 is only selected as peripheral which needs to be selected .
Step 5: Memory size of XPS BRAM IF CNTRL needs to be changed to maximum
Step 6:RS232_Uart_1 need to be STDIN and STDOUT for device
Step 7: Memory test and peripheral test needs to be done as a part of configuration
Step 7: Generate Address
After Finish you will get the following screen.
Step 5:Go to Hardware->Generate Net list
Step 6:Go to Hardware-> Generate Bit stream
Step 7:Go to start->All Programs-> Xilinx ISE Design Suite 10.1->ISE->Project
Navigator
And window appears like below.
Step 8:Go to File->New project
Step 9:Click on New source
Step 10:Press Finish
Step 10:CHECK syntax.
Step 11:Synthesize-XST
Go to XPS
Hardware->create or import peripheral
Step 12:
Got to: D:\zeba_edk\jlkolk\iseiproj\iseipproj and copy iseipfile.vhd into
D:\zeba_edk\jlkolk\iseiproj\pcores\peripheralfile_v1_00_a\hdl\vhdl
Step 13:
Go to: D:\zeba_edk\jlkolk\iseiproj\pcores\peripheralfile_v1_00_a\hdl\vhdl\user_logic.vhd
open file in notepad
port
(
-- ADD USER PORTS BELOW THIS LINE ------------------
--USER ports added here
LED1 : out STD_LOGIC_VECTOR (3 downto 0);
SWITCH1 : in STD_LOGIC_VECTOR (3 downto 0);
-- ADD USER PORTS ABOVE THIS LINE ------------------
architecture IMP of user_logic is
--USER signal declarations added here, as needed for user logic
component iseipfile
Port ( SWITCH : in STD_LOGIC_VECTOR (3 downto 0);
LED : out STD_LOGIC_VECTOR (3 downto 0);
bus_ipclk : in STD_LOGIC);
end component ;
--USER logic implementation added here
iseipfile1 : iseipfile port map(SWITCH1,LED1, Bus2IP_Clk);
------------------------------------------
-- Example code to read/write user logic slave model s/w accessible registers
Go to:
D:\zeba_edk\jlkolk\iseiproj\pcores\peripheralfile_v1_00_a\hdl\vhdl \peripheralfile.vhd
file and edit the following code
-- ADD USER PORTS BELOW THIS LINE ------------------
--USER ports added here
SWITCH2: in STD_LOGIC_VECTOR (3 downto 0);
LED2: out STD_LOGIC_VECTOR (3 downto 0);
-- ADD USER PORTS ABOVE THIS LINE ------------------
-- MAP USER PORTS BELOW THIS LINE ------------------
--USER ports mapped here
LED1=>LED2,
SWITCH1=>SWITCH2,
-- MAP USER PORTS ABOVE THIS LINE ------------------
Go to: D:\zeba_edk\jlkolk\iseiproj\pcores\peripheralfile_v1_00_a\data\
peripheralfile_v2_1_0.pao and open it and add this line,
lib peripheralfile_v1_00_a iseipfile vhdl
Step 14: Go to Xilinx-ISE and open D:\Exp4\implementation\system.ucf
And copy the following file
## IO Devices constraints
Net peripheralfile_0_LED2_pin<0> LOC=AC4;
Net peripheralfile_0_LED2_pin<0> IOSTANDARD=LVTTL;
Net peripheralfile_0_LED2_pin<1> LOC=AC3;
Net peripheralfile_0_LED2_pin<1> IOSTANDARD=LVTTL;
Net peripheralfile_0_LED2_pin<2> LOC=AA6;
Net peripheralfile_0_LED2_pin<2> IOSTANDARD=LVTTL;
Net peripheralfile_0_LED2_pin<3> LOC=AA5;
Net peripheralfile_0_LED2_pin<3> IOSTANDARD=LVTTL;
Net peripheralfile_0_SWITCH2_pin<0> LOC=AC11;
Net peripheralfile_0_SWITCH2_pin<1> LOC=AD11;
Net peripheralfile_0_SWITCH2_pin<2> LOC=AF8;
Net peripheralfile_0_SWITCH2_pin<3> LOC=AF9;
Step 15:
Adding the custom IP
Go to XPS
Hardware->create or import peripheral
And press yes. If there is any syntax errors it will show here only.
Step 18: Add IP in IP catalogue:
Step 19:Select plb0 in SPLB in bus interface section.
Step 20:Select 64K in addresses section and click generate addresses.
Step 20:Make ports as external in IP added in ports section.
Step 21:Go to Device configuration->Update Bitstream
Step 22:Go to Device Configuration->Download Bitstream
Step 23:Check the output by varying the dip switches.
Experiment 5
Objective:-Implementation of PPC based embedded system with file handling using compact
flash card
Tools and Board used:-Xilinx EDK, Xilinx VirtexII Pro Development board
Theory: - Xilinx Embedded Development Kit (EDK) provides the libraries and device
drivers for standard C library functions as well as function to access peripherals. The
ED K libraries are automatically configured by Libgen for every project based on
Microprocessor Software specification(.mss) file. The organization of PPC based system is
shown as:
File accessing from the Flash memory is done using LibXilFATFileSystem library.The XUP
board has the SystemACE controller and CompactFlash connector hardware for interfacing the
Flash memory. SyatemACE controller supports FAT16 file format. File operation using
Compact Flash is done using xilfats Library.The xilfats provides the read and write routines to
access files storedon a FAT16 file format. The header file which provides the required routines
is: "sysace_stdio.h"
Procedure:
1. Open Xilinx Platform Studio
2. Click File>New Project
3. Create New XPS project using BSB
4. Create New Design using BSB. This gives opportunity to the designer to select the
peripheral it needs.
5. Select the appropriate board (XUP virtex II pro in our case)
6. Processor to selected ( PowerPC for this experiment)
7. Select the required IO devices to be used.
8. Select maximum memory size for the xps BRAM controller
9. Select RS 232 UART as the standard input-output and xps_bram_cntrl for the boot
memory
10. This step generates the summary of the system created thus clearly giving the base
address and higher address generated:
11. After successful Generation of the embedded system
BLOCK DIAGRAM:
12. Include library xilfats library from Software platform settings
13. Generate Library and BSP
14. Generate NETLIST
15. Generate Bitstream
16. Add application Software Project
17. Mark to Initialize BRAM
18. Add NEW FILE in Source
19. Add *.c File
20. Write the code in cflash.c
21. Build the project
22. Update Bitstream
23. Download Bitstream
24. Output at Hyper Terminal
Experiment 6
Objective:-Implementation of PPC based system with file handling using DDRAM
Tools and Board Used: -Xilinx EDK,XilinxVirtexII Pro Development Board, External 256 MB DDR
Memory
Procedure: -
1. Open Xilinx platform studio>>New>>Project
2. Create new project using BSB wizard
3. Block Biagram Generated can be viewed and DDRAm_SDRAM constitute a part of MPMC
module Interface and is connected to Processor core using ppc405_0_dplb1 bus
4. Generate Software Library to select the xilmfs memory system to be included in the project.Then
Generate Net List and then BitStream
5. Add software application project
6. Mark to initialize BRAM
7. Add new Source file
8. Write the code
NOTE: - For initialization of DDRAM access the parameters from Software Platform Settings
9. Build All User Application
10. Update Bitstream and then Download Bitstream
OUTPUT:- See the concerned output on the hyper terminal