Jump to content
RobLewis

MSP430 and Java?

Recommended Posts

I've dabbled in a lot of languages, but never made it to C or C++. Now, in the course of helping my son pursue a CS degree, I find myself learning Java. 

 

What, if any, are the options for programming the TI LaunchPads in Java? Opinions? (other than the expected "Java sux" :-(

Share this post


Link to post
Share on other sites

For the MCU itself I wouldn't bet on anything, I haven't heard if anyone writing a JVM for the msp430 or Tiva. But you could dabble in writing PC client-side software for interfacing with the microcontroller over its UART and visualizing the data, etc. Plus the Energia IDE (a good beginner's dev environment for writing firmware) is itself written in Java, as it's based on the Wiring platform (same as Arduino and similar ones).

 

Sent from my Galaxy Note II with Tapatalk 4

Share this post


Link to post
Share on other sites

I'm a C# and Java developer by trade, and I would still say "Java sux"!

 

I know it's possible to code some ARM microcontrollers on Java, but not tried it myself. I don't think it's possible on the MSP430.

Share this post


Link to post
Share on other sites

Java has its place.

 

The places the MSP430 is used wouldn't be it.

 

Java is a pretty heavyweight language designed for portability and object security, which is really nice in a network delivery, dynamic load situation. Burdensome for a firmware, low RAM situation.

 

It is impractical to fit JVM into the constraints of the MSP430.  Performance would be abominable if it could be done. Most of the benefits of Java would be lost (good dynamic memory management; robust suite of classes; etc) due to the memory limitations and need for an efficient filesystem.

 

 

Not to say Java couldn't be used for development... But it would need to be followed by translation to C or C++ for practicality. In a PROM-based, limited RAM, environment, a language that doesn't involve dynamic loading and large  objects as basic presumptions is a necessity. I would estimate that, as a dead bare minimum, a JVM that can run practical software would need a minimum of several hundred K of RAM, a filesystem of maybe 16Meg, and a clock in the 100MHz range. And it would not be real time capable which is what a microcontroller is really for) or very fast at that.

 

 

I teach Java (among other things) and have many good things to say about it. Small is not one of them. Nor is fast (though it is a lot better today than V1.0). When Building software that needs to manage millions of data, especially non-trivial data, it is a nice language. Not for the things the MSP430 is typically used for.

 

All of that said, I have been doing more and more with Python the last few years. There is a hope of building Python for the MSP430, but it will still take some compromises.

Share this post


Link to post
Share on other sites

Java doesn't suck, badly written software does.

IMO, Java is badly written software.

 

<arnold>Stop being a girlie man and learn C.</arnold>  For embedded, it makes sense.  It also makes sense simply for being a better CS student.

Share this post


Link to post
Share on other sites

Java probably isn't the best choice on a "strapped for memory" embedded system. I've had some experience with eLua, though. It's a good language that is often used in embedded systems, specifically built for them actually. Its use of tables is somewhat and I quote, "magical." It makes getting new people up and running on complex projects faster and has a lot of nice features.

Share this post


Link to post
Share on other sites

I've written in my fair share of languages. I don't think it so much that the problem is with how java got done, I think the problem is with the mindset behind java. To me, this essay sums it up pretty well:

 

http://www.jwz.org/doc/worse-is-better.html

Huh. I'm finding that essay to be somewhat incoherent, and am at a loss for how to apply it to Java. As best I can tell, its recommendations match Java's history extremely well: "It is better to get half of the right thing available so that it spreads like a virus. Once people are hooked on it, take the time to improve it to 90% of the right thing." Java in a nutshell.

Share this post


Link to post
Share on other sites

Java has its place.

This is a common argument for all kinds of stupid things.  It doesn't make them less stupid.

 

Which part of Java are you talking about?  The VM?  The compiler?  The applications written in it?  The VM or language specifications?

The problem starts with the spec and the concept itself.  Since that is flawed, the rest has no hope.

Share this post


Link to post
Share on other sites

Java might have it's flaws, every language does, but without Java, internet and computing in general would not have been where it is now, it would not advance as fast as it did.

 

P.S. I have been using Java professionally for over 15 years now, writing applications for many Forbes 100 companies. Java shortcomings did not prevent me from writing fully functional, fast, and efficient (...and awesome :) ) software.

Share this post


Link to post
Share on other sites

<arnold>Stop being a girlie man and learn C.</arnold>

This in my view is a real-programmers statement (spun off of the real-men folklore). While the intention might be good, the real-programmer culture is basically the geek/nerd version of macho behaviour. A better implementation of the underlying motivation in my opinion is the agile manifesto and their values/principles (note that agile principles do not exist, only principles of implementations of agile in management packages, such as scrum).

 

But to be on topic again: There is an implementation of a Python compiler for MSP430 (MPy). In a similar fashion one could bind a targeting compiler (GCC or Clang) to a Java parser like Dalvik. I am not a compiler guy myself, but I think it is certainly doable.

Keep in mind that Java has memory management, which will take its load on the MSP430. C/C++ do not do automatic garbage collection, which reliefs the stress on the system for some bit. But automatic garbage collection has also been implemented in C++ (through Boost smart pointers) so it should be possible to do so with a low overhead.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×