+ All Categories
Home > Documents > Introduction: What is Java SE Embedded?files.meetup.com/1401221/CLE-JUG-Java-Embedded... · Best...

Introduction: What is Java SE Embedded?files.meetup.com/1401221/CLE-JUG-Java-Embedded... · Best...

Date post: 04-Jun-2020
Category:
Upload: others
View: 28 times
Download: 0 times
Share this document with a friend
36
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 1
Transcript

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 1

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 2

Developing with Oracle Java Embedded Technology for the Raspberry Pi

Scott Seighman Principal Sales Consultant Oracle

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 3

Safe Harbor The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Agenda Introduction: What is Java SE Embedded?

Developing w/Java for Embedded

Best Practices w/Java for Embedded

Downloading and Installing Java SE Embedded Platform

Demos

Conclusion

Q&A

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 5

Introduction:

Proven & Stable, Huge Developer Base, Rapid Application Development Fully Object Oriented, Runs on a Virtual Machine Memory Management, Portability, Cross Platform … Multi-Thread, -Process and -CPU/Core support Security Networking

What is Java SE Embedded?

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 6

Introduction: (cont)

Fully implements Java SE specification – Significant memory optimizations

Smaller persistent (ROM/disk) and volatile (RAM) – Runtime optimizations

What is Java SE Embedded?

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 7

Developing for Java Embedded

Embedded Devices Smaller memory and lower powered CPUs Wirelessly networked Headless or small screens Limited input (touchscreen or keypad)

Where is it used?

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 8

Java Everywhere

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 9

The Spectrum of Java

Servers Desktop Embedded TV Mobile Card

Java Language

Java SE Java ME Java Card

Java EE Java TV

BD-J

JavaFX MSA

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 10

Best Practices for Java Embedded

Managing limited memory – Static initializers – Lazy memory allocation

Limiting static footprint size – Ahead-of-Time Compilation

Limiting use of threads Dealing with lower powered CPUs

– ARM devices

How is it best used?

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 11

Java SE Embedded – Current Product Releases SE 7u4, 6u32 – Latest: GA Apr 26, 2012

Processor Operating System

Headless or Headful FPU Java SE Version

ARMv5 Linux Headless Soft 6u32, 7u4

ARMv6/v7 Linux Headless & Headful (v7) VFP 6u32, 7u4

ARMv7 (Server JIT) Linux Headless VFP 7u4

PowerPC e600 core Linux Headless Classic HW FP 6u32, 7u4

PowerPC e500v2 core Linux Headless Embedded FP 6u32, 7u4

x86 Linux Headless X86 6u32, 7u4

* All configurations dynamically detect and support single or multi-core processors

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 12

Downloading and Installing

What is a Raspberry Pi? Where can we buy a Raspberry Pi? Installation/Customization Setup How do we download Java SE Embedded? Demo: Simple testcase showing Java running

Steps for running Java apps on a Raspberry Pi

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 13

What is a Raspberry Pi? It’s a Single board computer developed in the UK by the Raspberry Pi Foundation with

the intention to stimulating the teaching of basic computer science in schools. Specs:

– 700 MHz ARM1176JZF-S core , Broadcom VideoCore IV, OpenGL ES 2.0 – 256MB RAM – HDMI, DSI, Composite VideoCore IV, 3.5 mm Audio Jack – 2 USB 2.0, SD / MMC / SDIO, 10/100 Ethernet – 8 x GPIO, UART, I2C Bus, SPI bus – 3.5Watts@ 5v – Cost: $35 + Shipping – 2 Models, Rev A 1 USB and NO Ethernet, Model B currently shipping

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 14

What is a Raspberry Pi? (cont)

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 15

Where can we buy a Raspberry Pi?

Resources to buy a Raspberry Pi – Premier Farnell/Element 14

http://www.element14.com/community/groups/raspberry-pi – RS Components

http://www.alliedelec.com/RaspberryPi/ Cost: $35 plus shipping

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 16

What else do I need? Power Supply

– Powered USB hub or 5V/1A (Micro USB) SD Card

– 4GB or larger Keyboard/Mouse

– USB or wireless HDMI or Composite Video cable List of ‘tested’ components:

– http://elinux.org/RPi_VerifiedPeripherals

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 17

Installation & Customization Installation

– Follow the Raspberry Pi Easy SD Card Setup for Debian http://elinux.org/RPi_Easy_SD_Card_Setup

– Demo is also based Debian 6.0.5 – Win32DiskImager (For Windows) or dd (for Linux/Unix) – PuTTY (For Windows) or any other SSH client

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 18

Installation & Customization (cont) Customization

– Modify R Pi to auto start the Desktop Change default from 2 5 in /etc/inittab

– Enable Static IP addressing to improve management of embedded devices Add “hwaddress ether XX:XX:XX:XX:XX:XX” to /etc/network/interfaces

file – Fix Package update sources.list to a region closer to you. Change default ”ftp.uk.". We changed to America's ”ftp.us." in /etc/apt/sources.list

– To enable sound Add the following entry “snd_bcm2835” to end of file for /etc/modules

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 19

Installation & Customization (cont)

Customization (these steps may not fit all use cases. This setup allows GUI & SSH daemon to start automatically.)

– Resize rootfs for SD card to use all space available +/- a few bytes – Fix ssh startup. sudo update-rc.d -f ssh defaults 20 – Fix TimeZone, Localization, Console Keyboard settings sudo dpkg-reconfigure tzdata, dpkg-reconfigure -p low locales, dpkg-

reconfigure keyboard-configuration

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 20

Installation/Customization (cont) Customization

– Optimize SD card partitions in /etc/fstab add entry "/dev/mmcblk0p2 / auto defaults,noatime,nodiratime 0 1"

between p1 & p3 mount points. – *noatime means "Don't record 'last accessed' time". For frequently

accessed files, it can improve performance. – *nodiratime is the same for directories

Uncomment swap partition 3 so you can use swap after next reboot. – Install Iceweasel, sudo apt-get install iceweasel Default browser was known to crash a lot for me. Others may find it

fine.

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 21

Installation & Customization ‘Wheezy’ Install

– New recommended image – Based on Raspbian optimized version of Debian, uses Raspbian installer

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 22

Misc

Backup – Win32DiskImager (read) May encounter some issues reading SD card partitions

– dd Nice script here:

http://www.raspberrypi.org/phpBB3/viewtopic.php?t=12079&p=129974 GPIO

– Many projects emerging

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 23

ARM Architecture for Raspberry Pi Hard-Float vs Soft-Float

– Hard-floats use an on-chip FPU – Soft-floats emulate FPU in software – Floating point operations on the Pi’s processor can use the "Hard Float"

mechanism, which is faster – Debian image (original, “Squeeze”) is compiled using "Soft Float" allowing

it to be compatible with earlier processor generations – Does not use of the Pi's processor's floating point hardware – Raspbian “Wheezy” was adjusted to produce optimized "hard float" code – Significantly faster performance for applications that make heavy use of

floating point arithmetic operations

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 24

Can I have some Java with my Raspberry Pi? Download Java SE Embedded 7u4 from URL:

– http://www.oracle.com/technetwork/java/embedded/downloads/javase/ Select ARMv6/7 Linux - Headless EABI, VFP, SoftFP ABI, Little Endian.

Fill out the online questionnaire. Once submitted you will receive an email with Download URL. Choose ARMv6/7 Linux - Headless 31.54 MB ejre-7u4-fcs-b20-linux-arm-vfp-client_headless-12_apr_2012.tar.gz

(You’ll need to complete an online form first)

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 25

Other Java VM Options OpenJDK 7

– Server a.k.a Zero VM (default VM) Interpreter-only port of OpenJDK that uses no assembler and therefore can

trivially be built on any Linux system Shark is a JIT compiler for Zero

– Cacao cacaovm is a JVM which uses JIT compilation to execute Java methods natively

cacaovm uses GNU Classpath, OpenJDK or phoneME as Java runtime library java –cacao …

– Jam VM OpenJDK compatible version of JamVM is supported by IcedTea

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 26

Can I have some Java with my Raspberry Pi? Install Java SE Embedded 7u4 JRE

ssh [email protected] mkdir -p /export/java scp ejre-7u4-fcs-b20-linux-arm-vfp-client_headless-12_apr_2012.tar.gz

[email protected]:/export/java ssh [email protected] cd /export/java; tar -zxvf ejre-7u4-fcs-b20-linux-arm-vfp-client_headless-

12_apr_2012.tar.gz Time to test Java

/export/java/ejre1.7.0_04/bin/java –version java version “1.7.0_04” Java™ SE Runtime Environment for Embedded (build 1.7.0_04-b20, headless) Java Hotspot™ Embedded Client VM (build 23.0-b21, mixed mode)

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 27

Can I have some Java with my Raspberry Pi? Install OpenJDK 7

sudo apt-get install openjdk-7-jdk sudo apt-get install openjdk-7-demo (if you want some demo apps)

Time to test Java /usr/bin/java -version

java version “1.7.0_03” OpenJDK Runtime Environment (IcedTea7 2.1.1) (7~u3-2.1.1-1+rpil) OpenJDK Zero VM (build 22.0-b10, mixed mode)

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 28

Demos

•Squeeze & Wheezy •Hardware Status (Embedded Java SE) •OpenJDK 7 •Glassfish •Apache Tomcat •JBoss

Presenter
Presentation Notes
HardwareStatus Demo: One method call to file, then retrieve all data and put in an array, and later access array from Socket file to send back data to url:port (5000).� Added small section to code to get info around /proc/cpuinfo JBoss Demo: Why is this important This may seem a bit silly but it shows that modern JEE 6 application servers are in no way heavyweight and you can easily run a full JEE6 stack in less than 100Mb of RAM on a $30 ARM board. So forget the heavyweight claims.� The second things this shows is that thanks to Oracle's release of the embedded JDK for ARM which is a full JDK as opposed to a mobile profile it is possible to run very complex Java applications on low powered ARM chips ( the PI apparently draws less than 3W power when running flat out). I can see a huge future in new server platforms containing large numbers of ARM chips running application servers like JBoss.

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 29

SciMark2 Benchmark Using “Squeeze”

Presenter
Presentation Notes
SciMark is a composite Java benchmark measuring the performance of numerical codes occurring in scientific and engineering applications Reports a composite score in approximate Mflops (Millions of floating point operations per second).

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 30

SciMark2 Benchmark Using “Wheezy”

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 31

Java SE Embedded Resources

Java SE Embedded Technical Article: Getting Started with Raspberry Pi http://www.oracle.com/technetwork/articles/java/raspberrypi-1704896.html

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 32

Raspberry Pi Resources

Main site – http://raspberrypi.org

Wiki – http://elinux.org/RaspberryPiBoard

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 33

Misc Resources

These vendors have a variety of electronic components, jumper wires, kits, etc, to extend the reach of your Raspberry Pi and help you experiment:

– Adafruit: http://adafruit.com/ – SparkFun: http://adafruit.com/ – Robot Shop: http://www.robotshop.com/store – Odd Wires: http://www.oddwires.com/ – Cool Components: http://www.coolcomponents.co.uk/ – Arduino: http://www.arduino.cc/

Parts/Components/Other

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 34

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 35

Q&A

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 36


Recommended