JOP Reference Handbook

  • View
    102

  • Download
    2

Embed Size (px)

DESCRIPTION

Building Embedded Systems with a Java Processor

Text of JOP Reference Handbook

JOP Reference HandbookJOP Reference HandbookBuilding Embedded Systems with a Java ProcessorMartin SchoeberlCopyright c (2009 Martin SchoeberlMartin SchoeberlStrausseng. 2-10/2/55A-1050 Vienna, AustriaEmail: martin@jopdesign.comVisit the accompanying web site on http://www.jopdesign.com/ andthe JOP Wiki at http://www.jopwiki.com/Published 2009 by CreateSpace,http://www.createspace.com/All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, ortransmitted in any form or by any means, electronic, mechanical, recording or otherwise, withoutthe prior written permission of Martin Schoeberl.Library of Congress Cataloging-in-Publication DataSchoeberl, MartinJOP Reference Handbook: Building Embedded Systemswith a Java Processor / Martin SchoeberlIncludes bibliographical references and index.ISBN 978-1438239699Manufactured in the United States of America.Typeset in 11pt Times by Martin SchoeberlForewordThis book is about JOP, the Java Optimized Processor. JOP is an implementation of theJava virtual machine (JVM) in hardware. The main implementation platform is a eld-programmable gate array (FPGA). JOP began as a research project for a PhD thesis. In themean time, JOP has been used in several industrial applications and as a research platform.JOP is a time-predictable processor for hard real-time systems implemented in Java.JOP is open-source under the GNU GPL and has a growing user base. This book iswritten for all of you who build this lively community. For a long time the PhD thesis,some research papers, and the web site have been the main documentation for JOP. A PhDthesis focus is on research results and implementation details are usually omitted. Thisbook complements the thesis and provides insight into the implementation of JOP and theaccompanying JVM. Furthermore, it gives you an idea how to build an embedded real-timesystem based on JOP.VAcknowledgementsMany users of JOP contributed to the design of JOP and to the tool chain. I also wantto thank the students at the Vienna University of Technology during the four years of thecourse The JVM in Hardware and the students from CBS, Copenhagen at an embed-ded systems course in Java for the interesting questions and discussions. Furthermore, thequestions and discussions in the Java processor mailing list provided valuable input for thedocumentation now available in form of this book. The following list of contributors to JOPis roughly in chronological order.Ed Anuff wrote testmon.asm to perform a memory interface test and BlockGen.java to con-vert Altera .mif les to Xilinx memory blocks. Flavius Gruian wrote the initial version ofJOPizer to generate the .jop le from the application classes. JOPizer is based on the opensource library BCEL and is a substitute to the formerly used JavaCodeCompact from Sun.Peter Schrammel and Christof Pitter have implemented the rst version of long bytecodes.Rasmus Pedersen based a class on very small information systems on JOP and invited my toco-teach this class in Copenhagen. During this time the rst version of the WCET analysistool was developed by Rasmus. Rasmus has also implemented an Eclipse plugin for the JOPdesign ow. Alexander Dejaco and Peter Hilber have developed the I/O interface board forthe LEGO Mindstorms. Christof Pitter designed and implemented the chip-multiprocessor(CMP) version of JOP during his PhD thesis. Wolfgang Puftsch rst contribution to JOPwas the nalization of the oating point library SoftFloat. Wolfgang, now an active de-veloper of JOP, contributed several enhancements (e.g., exceptions, HW eld access, datacache,...) and works towards real-time garbage collection for the CMP version of JOP.Alberto Andriotti contributed several JVM test cases. Stefan Hepp has implemented an op-timizer at bytecode level during his Bachelor thesis work. Benedikt Huber has redesignedthe WCET analysis tool for JOP during his Masters thesis. Trevor Harmon, who imple-mented the WCET tool Volta for JOP during his PhD thesis, helped me with proofreadingof the handbook.Furthermore, I would like to thank Walter Wilhelm from EEG for taking the risk to ac-cept a JOP based hardware for the Kippfahrleitung project at a very early developmentstage of JOP. The development of JOP has received funding from the Wiener Innova-tionsf oderprogram (Call IKT 2004) and from the EU project JEOPARD.ContentsForeword vAcknowledgements vii1 Introduction 11.1 A Quick Tour on JOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1.1 Building JOP and Running Hello World . . . . . . . . . . . . . . 11.1.2 The Design Structure . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 A Short History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3 JOP Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4 Is JOP the Solution for Your Problem? . . . . . . . . . . . . . . . . . . . . 61.5 Outline of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 The Design Flow 92.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.1.1 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.1.2 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.1.3 Xilinx Spartan-3 Starter Kit . . . . . . . . . . . . . . . . . . . . . 112.2 Booting JOP How Your Application Starts . . . . . . . . . . . . . . . . 122.2.1 FPGA Conguration . . . . . . . . . . . . . . . . . . . . . . . . . 122.2.2 Java Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.2.3 Combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.2.4 Stand Alone Conguration . . . . . . . . . . . . . . . . . . . . . . 142.3 The Design Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.3.1 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.3.2 Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.4 Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.5 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.5.1 JopSim Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . 192.5.2 VHDL Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . 20X CONTENTS2.6 Files Types You Might Encounter . . . . . . . . . . . . . . . . . . . . . . 212.7 Information on the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.8 Porting JOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.8.1 Test Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.9 Extending JOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.9.1 Native Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.9.2 A new Peripheral Device . . . . . . . . . . . . . . . . . . . . . . . 252.9.3 A Customized Instruction . . . . . . . . . . . . . . . . . . . . . . 262.9.4 Dependencies and Congurations . . . . . . . . . . . . . . . . . . 272.10 Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.10.1 The Java Sources for JOP . . . . . . . . . . . . . . . . . . . . . . 302.11 The JOP Hello World Exercise . . . . . . . . . . . . . . . . . . . . . . . . 302.11.1 Manual build . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302.11.2 Using make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312.11.3 Change the Java Program . . . . . . . . . . . . . . . . . . . . . . . 312.11.4 Change the Microcode . . . . . . . . . . . . . . . . . . . . . . . . 312.11.5 Use a Different Target Board . . . . .