[riot-devel] HotSpot JVM on RIOT-OS?
zharvey at pobox.com
Wed Aug 12 13:36:56 CEST 2015
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!
On 8/12/15 6:05 AM, Francisco Javier Acosta Padilla wrote:
> 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.
> On Tue, 2015-08-11 at 22:38 -0400, Zac Harvey wrote:
>> Thanks Marc, I appreciate the candid input. I have a few final (I
>> promise) followups here that are more for my edification/learning than
>> anything else.
>> You say that RIOT is meant for *small* systems, and I think I'm
>> beginning to understand what that means. But regardless of what RIOT is
>> *typically* used for, are there any inherent limitations in RIOT that
>> would prevent me from deploying/flashing it to a sophisticated MCU that
>> *could* run Java? In other words, say I have an MCU that has a crazy
>> amount of ROM/RAM on it that has the stats to handle a full bore JVM
>> app...does RIOT itself have any limitation/constraints that would
>> prevent me from choosing it (nevermind *why* I would choose it in the
>> first place!)?
>> Also, I get that MCU ROM is the memory where the executable is flashed
>> to. And I understand that because of this, in order for a non-running
>> executable to "fit" on an MCU, it must have a file size that is smaller
>> than the amount of ROM (obviously). But I'm still not understanding why
>> the RAM (that is, the memory allocated to the running executable) can't
>> be scalable by somehow attaching additional storage (flash/whatever) to
>> the MCU. In other words, if the sam3x8e has 512KB ROM and only 96KB RAM,
>> if my entire JVM executable (which includes *everything*) is somehow
>> magically less than 512KB, it will fit on the MCU. So why can't I then
>> "get around" the 96KB RAM limitation by (somehow) integrating that
>> onboard 96KB RAM with, say, an 8GB solid state drive, or something
>> thereabouts. I just feel like there *must* be a way to scale the RAM
>> and perhaps even the ROM. Ideas?
>> Thanks again, if I can get answers to these I should be all set!
>> On 8/11/15 5:19 PM, Marc Sissom wrote:
>>> Hi Zac,
>>> Have you looked at the sam3x8e datasheet? Right on the front page it says it has 512KB of flash (AKA ROM or nonvolatile program and data storage). The chip has 96KB of RAM. Looking into task manager on Windows 7 I see a javaw.exe that is occupying 133MB of RAM and my JRE takes up 153MB of disk. Admittedly this is not a perfect comparison, but surely these numbers mean something to you.
>>> RIOT is meant for *small* systems. Not SMALL or S M A L L but small systems. Some of these systems are so small that they can't do "Hello World" because the "printf" code takes up too much space.
>>>> Thoughts? Criticisms? Hate mail?
>>> In other words, you're nuts!
>>> Given that, here's a true Java bytecode chip that I worked with a few years back:
>>> Here's an FPGA core:
>>> And an ARM product:
>>> In other words, you are not the first to think of this, and in some cases it's not a bad idea. On the other hand, I think you can safely forget Akka on RIOT.
>>> You also mentioned Python; have a look here:
>>> Marc Sissom
>>> Krypton Solutions
>>> -----Original Message-----
>>> From: devel [mailto:devel-bounces at riot-os.org] On Behalf Of Zac Harvey
>>> Sent: Tuesday, August 11, 2015 3:23 PM
>>> To: RIOT OS kernel developers
>>> Subject: Re: [riot-devel] HotSpot JVM on RIOT-OS?
>>> Thanks Kaspar and Joakim,
>>> I'm not trying to be difficult here (I promise!) I'm just trying to see the forest through the trees.
>>> When you say that "The OpenJDK would probably require many megabytes of both ROM and RAM, this means it will not run on the sam3x8e...", why? Is it because it would require "many megabytes", or because it requires ROM, which I'm guessing isn't supported by RIOT-OS?
>>> And yes, I will definitely dive into Darjeeling/LLVM, but am trying to see if I can't brute force an easier solution first. :-)
>>> Thanks again!
>>> devel mailing list
>>> devel at riot-os.org
>> devel mailing list
>> devel at riot-os.org
> devel mailing list
> devel at riot-os.org
More information about the devel