Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Developing with Oracle Java Embedded Technology...

marakana
August 23, 2012

Developing with Oracle Java Embedded Technology for the Raspberry Pi

Hinkmond Wong and Gary Collins of Oracle are going to introduce you to developing for the Raspberry Pi using Java Embedded technology.

marakana

August 23, 2012
Tweet

More Decks by marakana

Other Decks in Programming

Transcript

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

    2 Developing with Oracle Java Embedded Technology for the Raspberry Pi Hinkmond Wong Consulting Member of Technical Staff Gary Collins Senior Member of Technical Staff
  2. 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.
  3. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

    4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Program 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  Open Discussion  Demo  Conclusion  Q&A
  4. 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?
  5. 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?
  6. 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?
  7. 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
  8. 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?
  9. 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
  10. 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
  11. 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
  12. 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/
  13. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

    16 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  Customization (Our 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
  14. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

    17 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
  15. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

    18 Installation/Customization (cont)  Customization – Optimize SD card partitions in /etc/fstab  add entry "/dev/mmcblk0p2 / auto rw,noatime,nodiratime,errors=remount-ro 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.
  16. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

    19 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.  Chose ARMv6/7 Linux - Headless 31.54 MB ejre-7u4-fcs-b20-linux- arm-vfp-client_headless-12_apr_2012.tar.gz
  17. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

    20 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
  18. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

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