Using JVM on 8051 Microcontrollers: Pros and Cons

  • Thread starter Thread starter ENGRedcupcake
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the feasibility and limitations of using a Java Virtual Machine (JVM) on 8051 microcontrollers for embedded programming projects. Participants explore the implications of using Java compared to more traditional languages like C/C++, particularly in the context of specific applications such as an automated coffee maker and a vending machine.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant questions the practicality of fitting a JVM into an 8051 microcontroller, noting the lack of a Memory Management Unit (MMU) as a significant challenge.
  • Another participant mentions J2ME (Java 2 Micro Edition) as a potential solution for embedded environments, but expresses uncertainty about its availability and suitability for the 8051.
  • Concerns are raised about the performance of Java on microcontrollers, with one participant stating that Java's P-code nature results in slower execution times compared to compiled languages like C.
  • A participant suggests that using Java may require more C programming skills to implement a JVM than simply writing the application in C, given the complexities involved.
  • There is a mention of a hypothetical chip designed to execute Java code directly, which could enhance performance, but this remains speculative.
  • One participant reflects on their learning experience and acknowledges the challenges faced in their project, indicating a desire to improve their C programming skills for future endeavors.

Areas of Agreement / Disagreement

Participants express a general consensus that C is more suitable for embedded systems, but there is no agreement on the feasibility of using a JVM on the 8051. Multiple competing views exist regarding the practicality and performance implications of using Java in this context.

Contextual Notes

Limitations include the lack of clarity on specific Java implementations for the 8051, the performance trade-offs of using Java versus C, and the potential need for additional programming skills to implement a JVM effectively.

ENGRedcupcake
Messages
22
Reaction score
0
Okay this migh sound like a stupid question but I had to ask it.

In the interest in time and energy I was considering the possibility of programming my 8051 for 2 projects for 2 classes using JVM. Mainly because my Microcontrollers class has failed to teach me much. I see that there is a few out there thought the much googled One Eighty Software seems to disapeard I was thinking JStick. I've never actually programmed a complex program on a microcontroller... the most was scrolling text of the national anthem. lol. I know that C/C++ is common but my second project is a group project and I'm the only one who knows anything a bout C, since I only took one class in it and the other 3 programming classes were in Java so it's what I'm most comfortable with not being a CS person. which you can probably tell from my rocky wording.

The question is really basic, what are the limitations of using a JVM on a microcontroller, is the code. does it really follow the 'compile it once, run it anywhere' motto Sun beams about. no pun intended.

Oh the program I'm writing is really quite simple it's just for basic user inputs for a automated coffemaker that is my senior project. The group project is inventory detection and user selection programs for a Vending machine... yes I have an unhealthy obsession with appliances.

thnx in advance
 
Technology news on Phys.org
Can you fit a JVM into an 8051? Even if had the processing power/memory it doesn't have a MMU which would make the impementation 'interesting'.
Although there have been implementations of a JVM into an FPGA.
 
This is probably what you want to look at, I guess. There is a special version of Java called "J2ME" for the embedded environment. But it's a bit confusing since they've named J2ME to "Java ME" at some point, and the website seems to act as if it will never be used for anything but cellular phones. This page seems to list the different Java Me implementations you can use, and it appears some of them require as little as 128k of memory... although I'm unsure which of the implementations listed there are available to the public, and I don't see a specific explanation of which microcontrollers are allowed to use.

However, to be quite honest... you seem to be saying that you are only planning on this because no one else in the group has any programming skills, and you are more comfortable with Java than C? The thing is, I have very heavy suspicions that if it is even possible to get any of the Java VMs running on an 8501 (I'm not familiar with the 8501 but various google searches like "java vm 8501 embedded" turn up nothing), it will actually require more C skills to get whatever VM you find running on the 8501, than it would require to just write the coffeemaker in C in the first place.
 
ENGRedcupcake said:
The question is really basic, what are the limitations of using a JVM on a microcontroller, is the code. does it really follow the 'compile it once, run it anywhere' motto Sun beams about. no pun intended.

thnx in advance

I'm not sure as to the exact limitations. But Java is a P-code language, which means that the code is complied into an intermediate form, then interpreted. This results in execution time that is about 10 times slower than complied languages (C is a complied language). The thing with complied languages is that the object code that they generate is specific for the machine architecture. When translated into executables, they tend to be faster than interpreted and p-code languages. Interpreted languages are about 100 times slower because the source has to be reinterpreted each time it is run.

The 'compile once run anywhere' means that your code is portable to any architecture, assuming that a JVM exist for that architecture. JVM is like a wrapper around the real hardware. Therefore, when you code in java, you're not dealing directly with the ISA of the architecture you're working in, only when the (virtual) ISA of JVM. No direct hardware control! Is this a good thing for embedded systems? If there were a chip that was made to execute java code directly without need for JVM, that would mean some great performance enhancements. Then there is also that issue about objected oriented programs and poor locality.

These factors have prevented me from using java for any real time applications. Have the people in your group learn C :-p
 
ranger said:
If there were a chip that was made to execute java code directly without need for JVM, that would mean some great performance enhancements.
A friend of mine in Cambridge started a company to develop java on a chip (Vulcan Machines). Unfortunately he died suddenly soon after the prototype was built and I believe the product and the company dissapeared.
 
Thanks for all of this information. One of my professors suggested JStamp development kit. but for the future I know that I should just go and better my C skills.
 
C really is much more suitable for most embedded stuff - wher eyou often have to do a lot of 'bit-fiddling' being basically a high level assembler.
 
Yea, I've really started to notice that. If I hadn't been on such a time constraint I think I've could've afforded to use C. but since I also had to construct the coffee maker and I've been having a lot of problems with my solenoid dispensing circuit i had to do what i could. which I think is the whole point my senior engineer project. I've learned a lot on this project about how I've still got a whole lote to learn.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
5
Views
3K
Replies
15
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
9
Views
4K
Replies
4
Views
5K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 5 ·
Replies
5
Views
2K