8/8/2019 Y2m001f
1/22
1
POCKET PC COMPILER
MINI PROJECT REPORT
MASTER OF COMPUTER APPLICATIONS
BY
AMIT KUMAR SINHA
Under the Guidance of
Dr. V.K. GOVINDAN
DEPARTMENT OF COMPUTER ENGINEERING
NATIONAL INSTITUTE OF TECHNOLOGY CALICUT
NIT CAMPUS P.O, KOZHIKODE 673601, KERALA
8/8/2019 Y2m001f
2/22
2
National Institute of Technology Calicut
Department of Computer Engineering
CERTIFICATE
This is to certify that the work reported in this project report entitled POCKET PC
COMPILER is a bonafide record of the work done by AMIT KUMAR SINHA
(Y2M001), a student in the Department of Computer Engineering, National Institute
of Technology Calicut .
Head of the Department: Project Guide:
Dr.V.K.Govindan Dr.V.K.Govindan
Professor & HOD Professor & HODDept. of Computer Engineering Dept. of Computer EngineeringNIT, Calicut NIT, Calicut
8/8/2019 Y2m001f
3/22
3
ACKNOWLEDGEMENT
I am deeply indebted to my project guide Dr. V. K. Govindan, Head of the Department,
Department of Computer Engineering, National Institute of Technology, Calicut, for his
encouraging support and guidance through out my project work.
I express my heartiest thanks to Dr. Vineeth Kumar Paleri, Asst. Professor, Department
of Computer Engineering, National Institute of Technology, Calicut, for the co-operation
rendered by him during the period of my project work.
I would also like to thank Dr. Priya Chandran, Asst. Professor, Department of
Computer Engineering, National Institute of Technology, Calicut, for her valuable
suggestions.
Last but not the least, I would like to sincerely thank all my friends , for their moral
support, valuable suggestions and help during the course of this work.
AMIT KUMAR SINHA
8/8/2019 Y2m001f
4/22
4
ABSTRACTThe study of the feasibility analysis of the implementation of a Compiler in Pocket
PC with considering various constraints, if possible implementation of it. Analysis
mainly focuses on the running the system rather than starting it from the scratch.
The project work shows that it is possible to develop compiler for the concerned
device.
8/8/2019 Y2m001f
5/22
5
Table of Contents
1. Introduction6
1.1 Problem Definition6
2. System Overview.7
3. Design Consideration..8
3.a Assumption and Dependencies.8
3.b General constraints..10
3.c Goal and Guidelines..12
3.d Development Methods..13
4. Architectural Strategies....16
5. System Architecture
5.1 Sequence Diagram ..19
6. Conclusions..21
7. Policies and Tactics................................21
8. References 22
8/8/2019 Y2m001f
6/22
6
Introduction
Todays the market is being captured by small devices like PDA,
Pocket PC, Mobiles and different handheld devices. Still we dont have the
programming facilities in our smart devices. What is the reason behind it may be
due to architectural constraints due to memory size or due to less effort to
develop such an application. We do have so many compilers available. What is
the compatibility of others with the undertaken project compiler and other
related issues we will take into account? This project emphasis on these areas
and with the considered development a step forward to make a compiler for
Pocket PC.
Problem Definition:
The study of the feasibility analysis of the implementation of a
Compiler in Pocket PC with considering various constraints, if possible
implementation of it. Analysis mainly focuses on the running the system rather than
starting it from the scratch.
8/8/2019 Y2m001f
7/22
7
System Overview
Pocket PC Compiler as any other application running in the
Pocket PC or with the help of Cross Compiler must compile the corresponding
Source program and generate a machine object code according as the Processor
installed in the Pocket PC set. Here we are free to use any source language as well as
implementation language as we will first develop the compiler into PC and after
compiling it with the emulator the object code corresponding to it will be installed
into the memory area of Pocket PC.
Up to yet there is no facility exits that gives end user to compile his
programs on the Pocket PC itself for the considered model of Pocket PC. Compaq
ipaq provides a UNIX type shell through which compilation of any program like
written in C is possible
8/8/2019 Y2m001f
8/22
8
Design Considerations
Before going to detail description of the system
implementation all the constraints and assumptions are written below.
Assumptions and Dependencies
Related software or hardware
First of all due to varieties of Pocket PC we must beconfined to a particular set. Here in my implementation I have consideredToshiba e740
Operating System: Microsoft Mobile Software for Pocket PC
2003 Premium Edition
Processor: Intel PXA263, 400 MHz
Installed RAM: 128 MB SDRAM
ROM installed (max): 32 MB
Wireless connectivity: Integrated, Wi-Fi (IEEE 802.11b)
Audio input: Microphone
Audio output: Speaker(s)
Expansion slot(s): total (free) 1 (1 ) x SD Memory
8/8/2019 Y2m001f
9/22
9
Card, 1 ( 1 ) x CompactFlash Card - type 2
For design process we may consider any integrated development environment
according as the easiness and availability of the software.
Microsoft eMbedded visual Tools 3.0----IDE for mobile application
Microsoft eMbedded Visual C++ 3.0 --offers native code C++ compiler for
Windows mobile based developments
Visual Studio .NET 2003---Smart device programming feature
Sybase Pocket PowerBuilder ---4GL Integrated Development Environment(IDE). Supports Microsoft Pocket PC
SQL Anywhere Studio----Power full data base server supports Window CE
environment.
SuperWaba-- Java based development tools
Due to different vendors offering different types of Pocket PC architecture still
Microsoft Current Pocket PC hardware partners expected to continue their
support with Pocket PC 2002 include Casio Computer Corp., Cesscom, Compal
Electronics Inc., Compaq Computer Corp., Hewlett-Packard Co., HTC, HTW,
Intermec Technologies Corp., Legend, Mitsubishi Electric Corp., Sagem, Symbol
Technologies and Toshiba Corp.
8/8/2019 Y2m001f
10/22
10
General Constraints
These are some general constraints imposed
before developing the aforementioned system.
Hardware or software environment:
The Toshiba e800 contains Intel XScale architecture is
compliant with the ARM Version 5TE ISA instruction set, excluding the floating-
point instruction set. So the machine code generated must follow the above
instruction set.
End-user environment:
End use will have some editor in which the program will
be written and with the help of the compiler he/she will be able to compile his/her
programs.
Availability or volatility of resources.
As far as if the system is installed in to CompactFlash
Card it will be available always but if it is in RAM then after the discharge of the
battery the object code of the compiler will also be lost.
8/8/2019 Y2m001f
11/22
11
Standards compliance:
There must be linker and loader to relocate it in the memory
if it is not programmed it into ROM. Window CE provides bootstrap loader but
there is no shell in the Toshiba Pocket PC on which this application can run like
UNIX system.
Interface/protocol requirements:
Some Pocket PC supports MIPS architecture and some ARM
instruction set but the compiler may be design independent of these entire if
appropriate Interface is being used. Pocket PC 2003 (Window CE .NET 4.xOS)
contains the Compact Framework saved in ROM and is supported by Visual
Studio.NET 2003 SDK. Eliminate the problem of developers having to learn
different APIs for each different device.
Memory and other capacity limitations:
We wont have hard disk in Pocket PCbut the system
must have ROM.Only 32 processes can run in this operating system .RAM is
divided into two areas Program memory and Program execution space.
8/8/2019 Y2m001f
12/22
12
Other means of addressing quality goals:
We can directly think of designing the system with the
help of assembly language programming in the Pocket PC itself without using
any IDE and also it would be tougher to implement as there is no shell to run
this type of application. All the modules in the OS are application specific. There
is no direct interaction with the kernel.
Goals and Guidelines
Feasibility study of the Pocket PC Compiler and
with considering all constraints like time available, architectural constraints of the
hardware and IDE availability trying to develop a compiler for a simple and user
friendly language. The project provides a report on the various issues which would
be gone thoroughly before going to actual development.
8/8/2019 Y2m001f
13/22
13
Development Methods
For the development of the compiler we use bootstrapping
methodology. With the help of existing compiler of the implementation language for
the concerned compiler we will get the first compiler which will give the target
program code and using this compiler again to compile the concerned compiler. We
will get our desired compiler which can run on the specified processor.
For developing a compiler for the specified target program we have to mainly
manipulate the code generation part of two phase compiler, and according as the
instruction set of the processor we have to generate the assembly code. The
generated code of the compiler with the aforementioned technique can be ported
into the ROM of the Pocket PC.
C ARM C ARM
C
P
P
C ARM C ARMARM
CC
P
ARM
We dontwant this
Com iler
We want thiscompiler which
can be ported tothe Pocket PC with
ActiveSync
8/8/2019 Y2m001f
14/22
14
Reusable software:
So any existing compiler can be used for the feasibility analysis.
For the easiness and simplicity I have taken my own Compiler which was written
for the SIL language and the machine code was for the SIM machine in the starting.
But bootstrapping C source language compiler is required.
Front End Code
Optimizer
Code
generator
Target Program
Be simple to check it easily like
SIL (SL) and C (IL)
ARM Instructions Set
Source
Program
Implementation language
Intermediate Code
Intermediate
Code
8/8/2019 Y2m001f
15/22
15
Interface Used:
We can use Windows CE .NET compiler drivers to compile
specified source files into an object file. We can also compile and link specified
source files, object files, and libraries into an executable file or a dynamic-link
library (DLL). The compilers produce Common Object File Format (COFF) object
files. The linkers produce executable files or dynamic-link libraries (DLLs). The
compiler programs compile each source file and, unless otherwise specified, create
an object file for each compile. The compilers automatically include the options
listed at the command line (CL), in the CL environment variable, and any specifiedresponse files. The compiler-driver programs automatically invoke the linker after
compiling, unless we specify otherwise. The compiler provides the names of the
object files and libraries to the linker. The linker uses options listed in the LINK
environment variable together with any linker options provided on the command
line. If conflicts occur, options from the command line override those in the LINK
environment variable.
Execution:
In a Window CE system, ROM based programs can be
designated as Execute in place (XIP). That is they are executed directly from the
ROM instead of being loaded into program RAM and then execute. The fact that
the code is executed directly from ROM means that the program code doesnt takeup valuable program RAM. Also since the program doesnt have to be copied into
RAM before its launched, it takes less time to start an application.
8/8/2019 Y2m001f
16/22
16
Architectural Strategies
C may be taken as the Source language and also for the
implementation language as the Visual Studio .Net Support the language. .NET
Compact Framework may be used for the development of the above application.
Perl can also be considered for implementation language as it is more power full for
generating regular expressions. Microsoft eMbedded C++ is also a nice Tool for
developing application for Pocket PC as it provide Emulator for that. ActiveSync
supplies following features for Windows CE based devices:
Backing up and restoring device data
Installing and removing Po cket PC applications
ActiveSync supports the interactions between desktop computers and
Windows CE based devices through add-ins called Service Providers which
runs within the ActiveSync framew ork.
8/8/2019 Y2m001f
17/22
17
System Architecture
System Architecture is depicted with the help of
UML sequence diagram and Language processing system below
UML Sequence Diagram for different compilation phases:
First the initial environment is set up. Next theparseProgram method ofC_Parser is
called which returns the root of theAST(Abstract Syntax tree) that was constructed
during this step.On the root node of the AST (an object of type CompilationUnitNode
), Main () invokes thetypeCheck method. Each node propagates thetypeCheck call
down the AST according to its own type checking logic. If no error occurred during
the type checking phase, Main () calls thetranslate method on the root node of the
ASTwhich triggers the generation. Again, each node propagates the translate call
down the AST if required by its translation rules.
8/8/2019 Y2m001f
18/22
18
Language Processing System:
Skeletal source program
preprocessor
Source program
Compiler
Target assembly program
Assembler
Relocatable machine code
Loader/linker-editor
Absolute machine code
Library,relocatable
object files
8/8/2019 Y2m001f
19/22
19
Main () C_Parser Compilation Unit
Node
execute
define initEnv
ParseProgram
ParserSource
and build
Up AST
create
type
Type Checkis propagateddown the
AST
translate
8/8/2019 Y2m001f
20/22
20
Imlementaion:
Reusing my existing compiler I have changed the code generation par
but as it doesnt support various features so I have also started the work on SmallC
Compiler. As I couldnt get any ARM emulator or Pocket PC emulator thegenerated code couldnt be tested. Due to different mode of operation as well as
different format of instruction makes the code generator part tougher. But RISC
processors provide fully 32-bit instruction set that makes the advantage.
If we will use any IDE then there would be less effort required to
develop the concerned application. GCC compiler also gives some CPU settings
facilities for the ARM processors. We can check the developed system to correctly
know the design path of the system.
8/8/2019 Y2m001f
21/22
21
Conclusions:
Feasibility analysis shows that implementation of a compiler in Pocket
PC can be continued because:
a) There is enough memory space for the existence of this application.
b) As far as the Operating system is concerned it provides some modules and
DLL which can be used to execute the executable of the compiler.
c) As it is possible to compile other application in the Pocket PC and also
Hello program is possible to compile it is advisable to use Visual
Studio.NET 2003 to make the executable file for the compiler.
d) There are some Compilers which are based on the instruction set of ARM
core.
e) Development of the Compiler can started wit h reuse based engineering and
with the help of core ARM emulator it can be checked. But this project is a
long term project so need more work force to develop
f) It would be a great advantage for the end use if this system is being
developed.
Policies and Tactics
Aforementioned system is designed for the academic
purpose and only the student and the faculty members of this institute are themembers to check and upgrade the system. Any part of this document and
system reuse or producing in any form is illegal.
8/8/2019 Y2m001f
22/22
References:
[1] AHO A.V. And R. Sethi[2003] Compiler Principles, Techniques and Tools Pearson
Education.
[2] Beck L. Leland. System Software An introduction to System Programming Pearson
Education Asia.
[3] Ian sommerville. Software Engineering Pearson Education.
[4] http://support.intel.com/design/Pentium4/components/
[5] http://www.codeproject.com/ce/
[6] http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dnnetcomp/html/netcfppctoce.asp