Session Report - Java on the Raspberry Pi

Posted by Janice J. Heiss on Oracle Blogs See other posts from Oracle Blogs or by Janice J. Heiss
Published on Fri, 5 Oct 2012 19:37:32 +0000 Indexed on 2012/10/06 3:44 UTC
Read the original article Hit count: 328

Filed under:
On mid-day Wednesday, the always colorful Oracle Evangelist Simon Ritter demonstrated Java on the Raspberry Pi at his session, “Do You Like Coffee with Your Dessert?”. The Raspberry Pi consists of a credit card-sized single-board computer developed in the UK with the intention of stimulating the teaching of basic computer science in schools. “I don't think there is a single feature that makes the Raspberry Pi significant,” observed Ritter, “but a combination of things really makes it stand out. First, it's $35 for what is effectively a completely usable computer. You do have to add a power supply, SD card for storage and maybe a screen, keyboard and mouse, but this is still way cheaper than a typical PC. The choice of an ARM (Advanced RISC Machine and Acorn RISC Machine) processor is noteworthy, because it avoids problems like cooling (no heat sink or fan) and can use a USB power brick. When you add in the enormous community support, it offers a great platform for teaching everyone about computing.”

Some 200 enthusiastic attendees were present at the session which had the feel of Simon Ritter sharing a fun toy with friends. The main point of the session was to show what Oracle was doing to support Java on the Raspberry Pi in a way that is entertaining and fun.

Ritter pointed out that, in addition to being great for teaching, it’s an excellent introduction to the ARM architecture, and runs well with Java and will get better once it has official hard float support. The possibilities are vast.

Ritter explained that the Raspberry Pi Project started in 2006 with the goal of devising a computer to inspire children; it drew inspiration from the BBC Micro literacy project of 1981 that produced a series of microcomputers created by the Acorn Computer company. It was officially launched on February 29, 2012, with a first production of 10,000 boards. There were 100,000 pre-orders in one day; currently about 4,000 boards are produced a day.

Ritter described the specification as follows:

* CPU: ARM 11 core running at 700MHz
  • Broadcom SoC package
  • Can now be overclocked to 1GHz (without breaking the warranty!)
* Memory: 256Mb
* I/O:
  • HDMI and composite video
  • 2 x USB ports (Model B only)
  • Ethernet (Model B only)
  • Header pins for GPIO, UART, SPI and I2C

He took attendees through a brief history of ARM Architecture:

* Acorn BBC Micro (6502 based)

  • Not powerful enough for Acorn’s plans for a business computer

* Berkeley RISC Project

  • UNIX kernel only used 30% of instruction set of Motorola 68000
  • More registers, less instructions (Register windows)
  • One chip architecture to come from this was… SPARC

* Acorn RISC Machine (ARM)

  • 32-bit data, 26-bit address space, 27 registers
  • First machine was Acorn Archimedes

* Spin off from Acorn, Advanced RISC Machines

Next he presented its features:
* 32-bit RISC Architecture
–  ARM accounts for 75% of embedded 32-bit CPUs today
– 6.1 Billion chips sold last year (zero manufactured by ARM)
* Abstract architecture and microprocessor core designs
– Raspberry Pi is ARM11 using ARMv6 instruction set
* Low power consumption
– Good for mobile devices
– Raspberry Pi can be powered from 700mA 5V only PSU
– Raspberry Pi does not require heatsink or fan

He described the current ARM Technology:
* ARMv6
– ARM 11, ARM Cortex-M
* ARMv7
– ARM Cortex-A, ARM Cortex-M, ARM Cortex-R
* ARMv8 (Announced)
– Will support 64-bit data and addressing

He next gave the Java Specifics for ARM:

Floating point operations
* Despite being an ARMv6 processor it does include an FPU
– FPU only became standard as of ARMv7
* FPU (Hard Float, or HF) is much faster than a software library
* Linux distros and Oracle JVM for ARM assume no HF on ARMv6
– Need special build of both
– Raspbian distro build now available
– Oracle JVM is in the works, release date TBD

Not So RISC
Performance Improvements
* DSP Enhancements
* Jazelle
* Thumb / Thumb2 / ThumbEE
* Floating Point (VFP)
* NEON
* Security Enhancements (TrustZone)

He spent a few minutes going over the challenges of using Java on the Raspberry Pi and covered:
* Sound
* Vision
* Serial (TTL UART)
* USB
* GPIO

To implement sound with Java he pointed out:
* Sound drivers are now included in new distros
* Java Sound API
– Remember to add audio to user’s groups
– Some bits work, others not so much
* Playing (the right format) WAV file works
* Using MIDI hangs trying to open a synthesizer
* FreeTTS text-to-speech
– Should work once sound works properly

He turned to JavaFX on the Raspberry Pi:
* Currently internal builds only
– Will be released as technology preview soon
* Work involves optimal implementation of Prism graphics engine
– X11?
* Once the JavaFX implementation is completed there will be little of concern to developers-- It’s just Java (WORA).

He explained the basis of the Serial Port:
* UART provides TTL level signals (3.3V)
* RS-232 uses 12V signals
* Use MAX3232 chip to convert
* Use this for access to serial console

He summarized his key points. The Raspberry Pi is a very cool (and cheap) computer that is great for teaching, a great introduction to ARM that works very well with Java and will work better in the future. The opportunities are limitless.

For further info, check out, Raspberry Pi User Guide by Eben Upton and Gareth Halfacree.

From there, Ritter tried out several fun demos, some of which worked better than others, but all of which were greeted with considerable enthusiasm and support and good humor (even when he ran into some glitches).

 All in all, this was a fun and lively session.



© Oracle Blogs or respective owner

Related posts about /JavaOne 2012