Speciale Evaluering Af Java Til Udvikling Af Indlejrede
Total Page:16
File Type:pdf, Size:1020Kb
Speciale Teknisk Informationsteknologi / Distribuerede Realtidssystemer Evaluering af Java til udvikling af indlejrede realtidssystemer ved brug af en eksisterende ”Java Optimized Processor” af Jan Egberg Lauritzen Mads Pedersen 12. december 2005 ______________________________ Jan Egberg Lauritzen, studerende ______________________________ ______________________________ Mads Pedersen, studerende Finn Overgaard Hansen, vejleder Evaluering af Java til udvikling af indlejrede realtidssystemer ved brug af en eksisterende JOP Resumé I dette speciale er anvendeligheden af Java til udvikling af indlejrede realtidssystemer evalueret baseret på en ”Java Optimized Processor”-platform (JOP). Processoren er en implementation af en JVM i en FPGA. Evalueringen viser, at Java kan bruges til realtidskritiske applikationer ved at bruge JOP som platform, idet udførslen af et Java-program er deterministisk på denne platform. Der beskrives en proprietær realtidsprofil, der er udviklet til JOP og som er inspireret af Ravenscar-Java. Realtidsapplikationer kan optimeres ved at flytte tidskritiske programdele nærmere hardware ved at ud- nytte fleksibiliteten i JOP, da den er baseret på en FPGA-platform. I specialet gives et eksempel på dette hardware/software co-design, hvor der opnås en betydelig optimering målt i clock cycles brugt på pro- cesseringen. For at undersøge udvikling med JOP er der med succes implementeret en frekvenstæller som eksempel på et hardwarenært realtidssystem. Nøgleord: Indlejrede realtidssystemer, Java, RTSJ, Ravenscar-Java, Java Optimized Processor, JOP, FPGA, VHDL, HW/SW co-design. Abstract English title: Evaluation of Java for developing embedded real-time systems using an existing “Java Optimized Proc- cesor” In this Master Thesis, the usage of Java for developing embedded real-time systems is evaluated based on a “Java Optimized Processor” platform (JOP). The processor is an implementation of a JVM in an FPGA. The evaluation shows that Java is suitable for real-time critical applications using JOP as the platform, because executing a Java program is deterministic on this platform. A proprietary real-time profile developed for JOP and inspired by Ravenscar-Java has been described. Real-time applications can be optimized by moving time critical program parts closer to hardware by using the flexibility in JOP as it is based on a FPGA platform. In the Master Thesis, an example of this hardware/software co-design is made. A noticeable optimization measured in clock cycles used in the processing is achieved. For examining development with JOP, a frequency counter as an example of a hardware close real-time system has been successfully implemented. Key words: Embedded real-time systems, Java, RTSJ, Ravenscar-Java, Java Optimized Processor, JOP, FPGA, VHDL, HW/SW co-design. Jan Egberg Lauritzen og Mads Pedersen Side 1 af 131 Evaluering af Java til udvikling af indlejrede realtidssystemer ved brug af en eksisterende JOP Indholdsfortegnelse Resumé ...................................................................................................................................................... 1 Abstract ..................................................................................................................................................... 1 Indholdsfortegnelse .................................................................................................................................. 2 Forord........................................................................................................................................................ 5 Læsevejledning................................................................................................................................. 5 Ansvarsfordeling............................................................................................................................... 6 Medfølgende CD .............................................................................................................................. 6 1 Introduktion.................................................................................................................................... 7 1.1 Baggrund................................................................................................................................. 7 1.2 Java til indlejrede realtidssystemer ......................................................................................... 7 1.3 Hvorfor JOP? .......................................................................................................................... 8 1.4 Mål med specialet ................................................................................................................... 8 1.5 Fremgangsmåde ...................................................................................................................... 9 1.6 Definitioner........................................................................................................................... 10 1.7 Introduktion til JOP............................................................................................................... 11 1.8 Relateret arbejde ................................................................................................................... 12 1.9 Specialets struktur................................................................................................................. 14 2 Realtidssystemer ........................................................................................................................... 15 1.1. Indledning ............................................................................................................................. 15 2.1 Historie.................................................................................................................................. 15 2.2 Kategorisering af realtid .......................................................................................................15 2.3 Realtid i specialet.................................................................................................................. 16 2.4 Tidsbegreb............................................................................................................................. 16 2.5 Specifikation af realtid.......................................................................................................... 17 2.6 Skedulering ........................................................................................................................... 18 2.6.1 Procesbegreb............................................................................................................ 18 2.6.2 Prioritering af processer og preemption................................................................... 18 2.6.3 Skeduleringsalgoritmer ............................................................................................ 18 2.6.4 Priority inversion ..................................................................................................... 20 2.7 Opsummering mht. JOP........................................................................................................ 21 2.8 Sammenfatning ..................................................................................................................... 22 3 Java og indlejrede realtidssystemer............................................................................................ 23 1.2. Indledning ............................................................................................................................. 23 3.1 Historie og baggrund............................................................................................................. 23 3.2 Java-platformen..................................................................................................................... 23 3.3 Muligheder for eksekvering af Java...................................................................................... 24 3.4 Java til indlejrede systemer................................................................................................... 25 3.5 Java til realtidssystemer ........................................................................................................ 26 3.5.1 Java vs. C/C++ og assembler................................................................................... 26 3.5.2 Java og realtid .......................................................................................................... 26 3.6 Sammenfatning ..................................................................................................................... 30 4 FPGA og VHDL............................................................................................................................ 31 1.3. Indledning ............................................................................................................................. 31 4.1 FPGA .................................................................................................................................... 31 4.1.1 Historie og baggrund................................................................................................ 31 4.1.2 Arkitektur................................................................................................................. 31 Jan Egberg Lauritzen og Mads Pedersen Side 2 af 131 Evaluering af Java til udvikling af indlejrede realtidssystemer ved brug af en eksisterende JOP 4.1.3 Detaljer omkring FPGA-platformene