EE516: Embedded Software Project 1 EE516: Embedded Software Project 1. “Setting Up Environment for Projects” Dong Jae Shin, PhD student 2016. 09. 01.
Contents Introduction to Projects of EE516 Tasks Setting Up Environment Virtual Machine Environment Ubuntu Linux OS Installation Environment for Development 1. Shell Script 2. Simple C Programming 3. Makefile Report Problems Source code submission & Screenshot General Grading Policy
Introduction to Projects Project 1: Setting up Environment for Project “Development” Project Project 2: Linux Fundamental Project 3: System Call and Synchronization Project 4: File System Project 5: Device Driver for Embedded H/W Especially, including “BeagleBoard Development”
Environment Overview Through this course,,, We will use Ubuntu LINUX as the base OS for the projects. Do we need new machine for Ubuntu LINUX? We usually use Windows OS for our own machine The answer is NO! We have “Virtual Machine Environment”! Such as VMware Player
Environment Overview What is “Virtual Machine Environment”? Software Stack of “Virtual Machine Environment” Ubuntu (Guest OS) Others … VMware Player (Virtualization Layer from VMware) Host OS (e.g. Windows) (Your host OS installed on the machine) Physical Resources of Your own machine (CPU, MEM, STORAGE, NETWORK ..)
Install Virtual Machine Monitor “Virtual Machine Environment” Download VMware Player (https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_workstation_player/12_0) or (http://core.kaist.ac.kr/~djshin/VMware-player-12.0.0-2985596.exe) Depends on your OS Windows-64bit Linux-64bit You need 64-bit Operating System. If you don’t have, please contact TA.
Install Virtual Machine Monitor Install VMM Install the product following the instructions of the installer Installation Path Enter your e-mail Run VMware Player
Install Guest OS We’ll use Linux OS for Guest Linux made by Linus Torvalds in 1991 Free software for replacing Unix Many usages - servers, desktops, mobile devices(Android) Linux Distributions Operating Systems based on Linux Kernel Linux Kernel : Core of Linux Scheduling, File System, Device Drivers System Software : Compilers, Libraries, User Interface User Program : Office, DB, Web Server, Web Browser, Mail …
Install Guest OS Download Ubuntu Linux http://www.ubuntu.com/download/desktop ubuntu-14.04.3-desktop-amd64.iso or http://core.kaist.ac.kr/~djshin/ubuntu-14.04.3-desktop-amd64.iso
Install Guest OS Create your own Virtual Machine Select New Virtual Machine Downloaded File Path Login Password
Install Guest OS Virtual Machine Properties Disk Size : 20GB is enough Need free space in HDD Main Memory Size for VM more than 1GB Number of processor for VM
Install Guest OS Initialize Ubuntu Desktop it takes several minutes. log-in with your password open terminal (ctrl + alt + T)
Install Guest OS Get root account & password root account : the highest level account for administrator It is needed when change system configuration install programs execute system-level program cannot reboot create root password you are the root now
Shell Script Shell Types of Shell A command line interpreter Accepts input from the user Executes the command that is given Types of Shell Command Line Interface (CLI) shell Based on text Graphic User Interface (GUI) shell Based on graphic e.g. x-window system in linux CLI GUI
bash shell : Ubuntu default Shell Script Various CLI Shells Bourne Shell (1977) == sh Developed by Steve Bourne @ AT&T Bell lab. First shell of UNIX system Bourne-again shell (1989) == bash Developed by Brain Fox Basis of shells on UNIX/LINUX type system Recent systems also use bash bourne shell (sh) bash shell : Ubuntu default
Shell Script CSH (C shell) TCSH (Tenex C shell) Developed by Bill Joy C-language-like shell interpretation TCSH (Tenex C shell) Tenex: OS from Carnegie Mellon Univ. Enhanced version of CSH for Tenex system
Shell Script Command execution on Shell ls : List information about file(s) cat : Display the contents of a file echo : Print string mkdir : Create new folder(s) rmdir : Remove folder(s) pwd : Display current directory cd : Change current directory cp : Copy one or more files to another location mv : Move or rename files or directories rm : Remove files
Writing a Shell Script Text Editor gedit : GUI based text editor vi, vim : CLI based text editor apt-get install vim you can use any text editor install vim ubuntu:~$ gedit ubuntu:~$ vim test.sh
Writing a Shell Script Writing a Simple Script Shell Script Guide $ vim test.sh or $ gedit test.sh save file $ chmod 755 test.sh $ ./test.sh $ ./test.sh something Shell Script Guide http://linuxconfig.org/bash-scripting-tutorial simple source code execution
tree -d
Writing a C Program Writing a C Program C Program Guide $ vim hello or $ gedit hello.c save file $ gcc hello.c -o hello $ ./hello C Program Guide http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.pdf https://classes.soe.ucsc.edu/cmpe013/Spring10/notes/C%20Programming%20Guide.pdf simple source code compile & execution
Make Utility Utility for automatically building executable programs and libraries from source code Help build programs from numbers of source code files Manage dependency among source code files and compiling method Prevent mistake $ gcc –o hello hello.c Correct $ gcc –o hello.c hello.c source code will be gone!
This empty space should be “tab” not “space” Make Syntax Syntax <Target>: <dependency> <Compile command> $ make program Will compile “program” After all compilation of others because of dependency This empty space should be “tab” not “space”
Makefile Example
Macro of Makefile Similar as “#define” of C programming Useful for repeated expression Below will do same compilation as previous slide $ make all : compile every BINs $ make clean : delete every BINs
Task1. Tree Script Write a bash shell script that shows tree structure of the directories and files included in you own home directory. Example of Task1
Task2. Simple C Program Benchmark We can make File System Benchmark! Computer program in order to assess the relative performance of an object, normally by running a number of standard tests and trials against it We can make File System Benchmark! with Sequential Access and Random Access Sequential Access Random Access Access Order 1 2 3 4 5 6 7 2 5 3 1 4 7 6 Logical Block 1 2 3 4 5 6 7 1 2 3 4 5 6 7 Example of Task1
Task2. Simple C Program Sample code is here http://core.kaist.ac.kr/~djshin/fsbench_sample.c File create Sequential Write Sequential Read Random Write Random Read File Delete End You should Implement 3 functions You can refer “file_write_sequential()” function void file_read_sequential() : about 20 lines void file_write_random() : about 25 lines void file_read_random() : about 25 lines Example of Task1
Implement 3 operations : Sequential Read, Random Write, Random Read Task2. Simple C Program Compile & Execute Sample Code Implement 3 operations : Sequential Read, Random Write, Random Read
Task2. Simple C Program Example of Task2
Task3. Makefile Write a Makefile for the source code of Task2 Test cases make all make clean Example Result of Task3
Submission Contents Submission Source Code Report Answer to the questions Key point of your Source Code Screenshots (Task 1, 2, 3) Page Limit : about 5 page (except figures) Submission Due Date : Sept. 19 ,PM 23:59 E-mail : w.j.kim@kaist.ac.kr [EE516] student_number.zip (various compression format is allowed)
General Grading Policy Ratio of Grading Tasks : 70% Code operation(exception handling), Code readability No errors and warnings Report : 30% Free-form Problems, Key point of your Source Code, Screenshots of Results Page Limit : about 5 page (except figures) Delay Penalty 10%/day (AM 00:00) Source Code Copying will deduct all of your points should mention if you referenced it
How to Transfer your files Compression and Extraction tar.gz $ tar -czvf compressed_file_name.tar.gz dir_name $ tar -xzvf compressed_file_name.tar.gz zip $ zip compressed_file_name.zip dir_name $ unzip compressed_file_name.zip File Transfer between Host Window and VM Just Copy and Paste Ctrl + C Ctrl + V