Upload
doanque
View
214
Download
0
Embed Size (px)
Citation preview
1
DarmstadtUniversity ofTechnology
Java Technology forEmbedded Systems
Eng. Leandro Soares Indrusiak, M. [email protected]
2
DarmstadtUniversity ofTechnology
n Electrical Engineer, UFSM, Santa Maria, 1995n Master in Computer Science, UFRGS, Porto Alegre, 1998n Assistent Professor, PUCRS, Uruguaiana, since 1998
n PhD. Candidate, UFRGS, Porto Alegrez Advisor : Prof . Dr. Ricardo Reis
n Guest Researcher, TUD, Darmstadtz Advisor : Prof .Dr.Dr.h.c. mult. Manfred Glesner
3
DarmstadtUniversity ofTechnology
Outline
n Motivationn Embedded Systemsn Java Technology
z languagez application programming interfacez virtual machine
n Java in Embedded Systemsz advantages and disadvantagesz execution possibilitiesz virtual machine options
n Perspectives
4
DarmstadtUniversity ofTechnology
Motivation
n „By the year of 2002, it is estimated that moreinformation appliances will be sold to consumers thanPCs“ (Business Week)
5
DarmstadtUniversity ofTechnology
Motivation
n „700 million cell phones to be sold worldwide in 2003,about 80% of them offering connections to the Internet“(Gartner Group)
6
DarmstadtUniversity ofTechnology
Motivation
n Telecommunicationn Networkingn PDAsn Automotive Electronicsn Aerospace industryn Multimedia (digital cameras, digital
audio players)n Home automation (domotics)n Internet appliancesn Toys and games
7
DarmstadtUniversity ofTechnology
Embedded Systems
n Embedded systems:z a set of pre-defined, specific functions to be performedz the resources available (e.g., memory, power, processor
speed, computational functionality) are constrained
n Special-purpose computer built into and integral to adevice, used to control, monitor or assist an operation
8
DarmstadtUniversity ofTechnology
Embedded Systems
n Until recently the vast majority of the embeddedsystems used 8- and 16-bit microprocessors,requiring little in the way of sophisticatedsoftware development tools
n The breaking of the $5 threshold for 32-bitprocessors drove an explosion in high-volumeembedded applications
n A new trend towards integrating a full system-on-a-chip (SOC) promises a further dramaticexpansion for 32-bit embedded applications
9
DarmstadtUniversity ofTechnology
Java Technology
n Development started in early 90‘s under theGreen Project at Sun Microsystems
n Initial goals included reliable software forconsumer electronics
n With the popularization of Internet, the mainfocus moved to web based programs(Applets and Servlets)
n As the market for embedded systems grows,and as the embedded system designbecomes complex, Java is turning back to itsinitial objective and it is being used to boostthe development of several products
10
DarmstadtUniversity ofTechnology
Java Technology
n Java Technology may bedivided in four building blocks[VENNERS 98]z Java programming languagez class file formatz Java API (Application
Programming Interface)z Java Virtual Machine (JVM)
Java Source Java API
Compiler
Java class files
Java Virtual Machine
Target Platform
11
DarmstadtUniversity ofTechnology
Java Language
n Features described in the Java Language Whitepaperreleased in 1995:z simple, familiar - looks like C++, but without its unnecessary
complexities
z object oriented - designed to be OO from ground up,implementing elegantly the OO concepts (inheritance,polymorphism, encapsulation, dynamic linking)
z robust, secure - compile-time and runtime code checking,simple memory management model, exceptions, sandboxsecurity model
12
DarmstadtUniversity ofTechnology
Java Language
n Features described in the Java Language Whitepaperreleased in 1995:
z high performance -JIT compilers, native code interface, garbagecollectionrunning as backgorund task
z threaded - allows multiple concurrent lightweight processes andprovides synchronization facilities
z dynamic - compiler is strict in its compile-time static checking,but the run-time system is dynamic in ist linking stages
z architecture neutral, portable - intermediate code format(bytecodes) can be executed in several platforms through JVM,data types and arithmetic operations behavior are standardized
13
DarmstadtUniversity ofTechnology
Java API
n Class libraries covering a wide range of subjects:
z graphic user interfacez 2D and 3D graphicsz threads and syncz i /oz data structuresz networkingz cryptographyz data compressionz multimedia
z e-commercez appletsz servletsz XMLz distributed systemsz telephonyz speech recognitionz database connectionz text processing
and more...
14
DarmstadtUniversity ofTechnology
Java API
n The first versions of the Java Development Kit had asingle, standard API (JDK 1.0 and JDK 1.1)
n When the Java 2 platform was released (JDK 1.2 andJDK 1.3), different flavors of the API were defined:
J2SETM J2EETM J2METM
15
DarmstadtUniversity ofTechnology
Java API
n Java 2 Platform, Standard Edition (J2SETM) - tools,runtimes, and APIs for developers writing, deploying,and running applets and applications
n Java 2 Platform, Enterprise Edition (J2EETM) -architecture with an Application Programming Model andCompatibility Test Suite for building enterprise-classserver-side applications
n Java 2 Platform, Micro Edition (J2METM) - highlyoptimized Java runtime environment targeting a widerange of consumer products, including pagers, cellularphones, screenphones, digital set-top boxes and carnavigation systems
16
DarmstadtUniversity ofTechnology
Java Virtual Machine
n The JVM is the key point on Java‘s platformindependency
n It lays between the application and the target system,making it possible to run Java code in mostcombinations of hardware/OS
Java Application
JVM for Unix
UnixWorkstation
Java Application
JVM forWindows
WindowsWorkstation
Java Application
JVM for Palm
Palm Handheld
17
DarmstadtUniversity ofTechnology
Java Virtual Machine
class load subsystem
runtime memory area
methodarea
Javacodestack
heapregs.PCs
nativemethod
stack
executionengine
nativemethodsinterface
nativemethodslibrary
18
DarmstadtUniversity ofTechnology
Java Virtual Machine
class load subsystem
runtime memory area
methodarea
Javacodestack
heapregs.PCs
nativemethod
stack
executionengine
nativemethodsinterface
nativemethodslibrary
•binary code load•security verification•reference resolution
19
DarmstadtUniversity ofTechnology
Java Virtual Machine
class load subsystem
runtime memory area
methodarea
Javacodestack
heapregs.PCs
nativemethod
stack
executionengine
nativemethodsinterface
nativemethodslibrary
• method code storage
20
DarmstadtUniversity ofTechnology
Java Virtual Machine
class load subsystem
runtime memory area
methodarea
Javacodestack
heapregs.PCs
nativemethod
stack
executionengine
nativemethodsinterface
nativemethodslibrary
• frame allocation stackfor each thread
21
DarmstadtUniversity ofTechnology
Java Virtual Machine
class load subsystem
runtime memory area
methodarea
Javacodestack
heapregs.PCs
nativemethod
stack
executionengine
nativemethodsinterface
nativemethodslibrary
• object alocation
22
DarmstadtUniversity ofTechnology
Java Virtual Machine
class load subsystem
runtime memory area
methodarea
Javacodestack
heapregs.PCs
nativemethod
stack
executionengine
nativemethodsinterface
nativemethodslibrary
• program counter
23
DarmstadtUniversity ofTechnology
Java Virtual Machine
class load subsystem
runtime memory area
methodarea
Javacodestack
heapregs.PCs
nativemethod
stack
executionengine
nativemethodsinterface
nativemethodslibrary
• bytecode instructionexecution engineimplemented insoftware, hardware orboth
24
DarmstadtUniversity ofTechnology
Java Virtual Machine
n Java programs comprehend oneor more threads, and each ofthem has its own stack and PC
n The stack is divided in frames,which contain the status of theinvoked methods
n The frame has separate areasfor storing the method localvariables, pointers for theinvoker of the method and theoperand stack
local variables
invoker info
operand stack
local variables
invoker info
operand stack
25
DarmstadtUniversity ofTechnology
Java Technology Overview
26
DarmstadtUniversity ofTechnology
Java in Embedded Systems
n Based on its motto for Java - „Write once, runeverywhere“ - Sun Microsystems is pushing Java back tothe embedded software develoment
n One particular API (J2ME) and two specifications(Embedded Java and Personal Java) address the subject
n Another API (JavaCard API) may also be consideredsuitable for embedded systems with limited processingand memory resources - it is designed to run in 100kb
27
DarmstadtUniversity ofTechnology
Java in Embedded Systems
n Advantages on using Java as embedded softwarez simpler programming, when comparing to C/C++ or assembly
z OO paradigm behind Java language enforces modularity, dataabstraction and thus design reuse
z rich and useful APIs (one standard and several custom)
z portability
z pointer safe
z array indexing check
z exceptions
z code compactness
28
DarmstadtUniversity ofTechnology
Java in Embedded Systems
n Disadvantages on using Java as embedded softwarez resources for runtime environment
z garbage collection
z no direct access to hardware
29
DarmstadtUniversity ofTechnology
Java in Embedded Systems
n The execution possibilities of Java code depends onseveral architectural optionsz integration with the rest of the system
y native method call
y separate set of threads
z storage and execution of Java bytecodes
y host machine
y target
z executable code generation
y interpreter
y AOT compiler
y JIT compiler
y bytecode execution
30
DarmstadtUniversity ofTechnology
Java in Embedded Systems
n integration with the rest of the system
APIs Java ThreadsC/C++ Tasks
JVM
Native Methods Multitasking OS
Hardware
31
DarmstadtUniversity ofTechnology
Java in Embedded Systems
n integration with the rest of the system
Thread 1
Thread 2
Garbage Collector
Virtual Machine
Task A
Task B
Operating System
32
DarmstadtUniversity ofTechnology
Java in Embedded Systems
n storage and execution of Javabytecodesz bytecodes stored in target device, but
executed in host (not actually EmbeddedJava, but Embedded Server)
z bytecodes stored in host, but executed intarget device
z bytecodes stored and executed in targetdevice - there might not even be a host
host
target
33
DarmstadtUniversity ofTechnology
Java in Embedded Systems
n executable code generation
z interpreter - bytecodes translated at runtime
y slower
y requires memory and processing resources
y keeps with platform independency
z AOT compiler - native code generated at compile time
y faster
y don‘t need runtime environment
y platform dependent
34
DarmstadtUniversity ofTechnology
Java in Embedded Systems
n executable code generation
z JIT compiler - bytecodes translated at runtime, but withotimizations
y mid-term solution
y currently being used as default for Sun‘s JDK
z bytecode direct execution - requires hardware-implementedJava Virtual Machine
y faster
y some hardware solutions provide execution of both bytecode and regularinstruction set
35
DarmstadtUniversity ofTechnology
Perspectives
n picoJava core - licensed under Sun CommunityLicense
n WindRiver RTOS - uses special resources andAOT compilation to allow Java-implemented GUIs
n Esmertec JBed - RTOS + JVM, no additionalsoftware needed
n ARM 9 RISC Core - set of extensions tothe ARM RISC architecture lets an ARM9core directly execute Java bytecodes as ifthey were native instructions
n Kaffe - free and portable software JVM
n GCJ - Gnu AOT compiler for Java
36
DarmstadtUniversity ofTechnology
Perspectives
n Motorola iDEN series, Nokia 9210and DoCoMo's i503 iMode - first generationof cellular phones supporting J2ME
n Sega develops games for next generationMotorola Phones using J2ME
n JVM for Palm and Symbian OS forhandheld computers
37
DarmstadtUniversity ofTechnology
Perspectives
n TINI Board, Dallas Semiconductors
38
DarmstadtUniversity ofTechnology
Acknowledgement
z Ito, S.A. Projeto de Aplicacoes Especificas comMicrocontroladores Dedicados. PPGC, UFRGS.
z Stepner, D. Nagarajan, R., Hui, D. Embedded Application DesignUsing a Real-Time OS. DAC 99.
z Bothner, P. Compiling Java for Embedded Systems.
z www.netrino.comz java.sun.comz www.samsung.comz www.visteon.comz www.teletask.be
z www. motorola.comz www. embeddedjava.netz www.embedded.comz www. sony.comz www. artima.com