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
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.
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?
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?
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
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
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
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/
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
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
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.
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
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
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