HotSpot JVM on RIOT-OS?

Hey,

there are JVMs running on Smartcards, but obviosly with a microscopic subset of a full flagged JVM for x86/amd64 systems. But probably this [1] and this [2] may be interesting to have a look at.

Best regards, Martin

[1] http://www.oracle.com/technetwork/java/embedded/javacard/overview/index.html [2] https://en.wikipedia.org/wiki/Java_Card_OpenPlatform

Hi all,

I experienced a similar problem as Zac's, so I will try to answer the questions from my own experience.

I had an application that could be very easily wrote using Java, however, as you already noticed, for this *small* devices a complete JVM is not a realistic option. But why?

First of all, because this *small* devices are very constrained in memory, but offer something that is very valuable in the IoT: they can run with batteries for a considerable amount of time.

This said, I will try to answer the question: Why it's not possible to add lots of external memory? Well, because for instance DDRX RAM is VERY energy consuming. Just to have an idea, make a comparison between the typical energy consumption of a Raspberry Pi with only 512MB of RAM and any Cortex MCU.

During my research, I was looking for the biggest MCU with lots of RAM and ROM to be as less constrained as possible for my developments. I found a Renesas MCU with 384KB of RAM, which seemed the biggest at that time (2013), but also very energy consuming, that would not last more than a day with added radio communication capabilities.

However, I found a ST Cortex-M4F with 256KB of RAM and 2MB of ROM, with a reasonable energy consumption. This MCU has a SRAM 32-bit controller that is able to manage external SRAM. With this you could say "oh great! I will add lots of RAM and run my JVM"! but again, take a look to the energy consumption of any external SRAM chip. A similar situation comes with the use of any external ROM chip, like a SD card or similar, the energy needed to use it is huge.

The conclusion is, if you want to run a complete JVM (i.e. openJDK) you will need lots of ROM/RAM, which is not available in MCUs (I didn't find any commercially available MCU with such amount of memory), but you still have the SoC option, like a Raspberry Pi or similar.

As of my knowledge, RIOT itself will not limit you in any way to implement a JVM, but if you're using a RPi you would prefer linux as OS.

So, if the energy consumption is not an issue for you, I would recommend to use any SoC based device commercially available, if you don't want to use a PC. Otherwise, the only option you have is the very limited JVM that were developed for research purposes, such as Darjeeling, Maté or any improved version of them. But still, take into account that running a JVM will need energy, that is consumed constantly even if your applications are doing nothing, compared to a native application that consumes only when running.

I hope this answer some of your questions.

Best,

Francisco

Thank you so much for the in-depth, thorough answer here Fransisco. I think I'm definitely revisiting my thinking and heading towards an SoC option, but am still planning on using RIOT-OS if it all possible.

Thanks again for sharing your war stories!

Hey,

While I applaud the idea of getting something as heavyweight as a JVM to run on the type of devices that most of us on this list are targeting have you thought about non-JVM languages? I’ve often wondered how small of a system Erlang could be persuaded to running on.

Kaspar & Adam,

Thanks for the ideas (lejos and non-JVM langs). I am already in touch with the lejos admin.

All,

An earlier suggestion was to investigate SOCs like Raspberry Pi or BeaglBoard. At first I thought: OK this is exactly what I need! But now that I’m really thinking about it, there’s something that leaves me feeling uneasy here.

So the main argument against the ARM SAM3X8E for a JVM is that it only has 512KB ROM and 96KB RAM. But after researching the RaspberryPi, the later models are using an ARM Cortex-A7 CPU that, according to Wikipedia it has 1MB RAM. So this doesn’t make sense: why is RaspberryPi touted as a JVM-capable ARM-based SOC, whereas SAM3X8E is totally incapable of such a feat (nothing in the modern Java landscape will run on 1MB).

Clearly I’m missing something here, but: what is the difference between RapsberryPi’s ARM processor vs SAM3X8E that makes it capable of running a Java app?!?

Thanks, Zac

You misread. https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications RPi2 has 1 Gigabyte RAM, not Megabyte.

/JG

Also, for what its worth, it looks like ARM SAM3X83 supports EMIF. Here they state:

“The 16-bit external bus interface supports SRAM, PSRAM, NOR and NAND Flash with error code correction.”

So to me it seems feasible that I could connect a SAM3X8E MCU to external memory and therefore store a large (JVM) binary “on” it (well, using integrated memory that is) and hook it up to, say, a 4GB heap.

Just keeping interested parties updated on my R&D…

RIOT can support larger processors with more RAM. I recently ported RIOT to a Zynq FPGA containing ARM Cortex A9 with 512MB RAM. It is unlikely that this would ever be used as a IoT device due to the cost and power consumption however it is a fantastic development/prototyping platform. https://github.com/RIOT-OS/RIOT/pull/3491

Simon