Converting embedded firmware to Java: why? - Page 1
Forum section: electronics / general

author: LabSpokane
author_rank: Super Contributor
timestamp: October 10, 2014, 01:15:55 am
content: I ran across a job posting for a software engineer locally and one of the listed duties was converting embedded C into Java, which strikes me as a really odd procedure. Other than for "field engineering", why would this be a desirable migration path? I suppose if one were swapping microcontrollers for Beaglebones, OK. Otherwise, I don't understand the value in saddling a microcontroller with an RTOS and a Java interpreter.Thoughts from the experienced...?

author: dannyf
author_rank: Super Contributor
timestamp: October 10, 2014, 01:21:30 am
content: Many embedded applications run on Java. Actually when Java was introduced its biggest selling point was to run embedded applications - think of all the cable boxes for example.Makes perfect sense to me.

author: nuhamind2
author_rank: Regular Contributor
timestamp: October 10, 2014, 01:26:04 am
content: not an expert but probably because easier to find a java developer instead embedded engineer.on a side note, I work as an embedded engineer (at least in the name) surrounded by a bunch of java programmer.

author: LabSpokane
author_rank: Super Contributor
timestamp: October 10, 2014, 01:26:55 am
content: I just thought that Java would be ridiculously slow. Obviously it must be better on a uC. Is there a good way to play with this on an ARM or AT328?

author: westfw
author_rank: Super Contributor
timestamp: October 10, 2014, 02:13:57 am
content: Java theoretically has run-time checking for a lot of the errors/conditions/etc that cause highly-publicized bugs in C programs. (Use a language with String support for an application that uses strings extensively in its user interface? What a concept!) At a cost, of course. It might be particularly worthwhile for boxes that have a user-interaction mode that is seldom used. Configuration of a router, for instance. Who cares if it runs slow and momentarily reduces system performance, if it only gets executed 5 minutes/week, and makes the UI more secure?QuoteCould be. That sort of thing isn't as silly a suggestion as it once was...And of course, "Embedded C" could mean "cable box running linux" or "teller machine running windows" in the first place.

author: logictom
author_rank: Unknown
timestamp: October 10, 2014, 02:29:53 am
content: A saw a job advert that peaked my interest, it was for a company looking for an electronics and software engineer but from the job description it is asking for Java, database, raspberry pi programming and mobile apps - not sure where the electronics comes into it. I would be fairly tempted but I haven't touched Java and I once did a module on iOS and it was nothing but a pain in the backside - I'm assuming it would be Android with them asking for Java but I can imagine it would be even worse with 101 different phone/tablet platforms to consider.

author: Jeroen3
author_rank: Super Contributor
timestamp: October 10, 2014, 05:37:52 am
content: Quote from: LabSpokane on October 10, 2014, 01:26:55 amYou can compile java for microcontrollers, and the above is true. Look around and see the success of java on the highly embedded market it was initially developed for.If instead you're running a higher level of embedding, such as with Windows CE or a linux, java is a real candidate together with C#.Both have extensive cross platform options, making it easier to develop off-target in simulations.

author: nctnico
author_rank: Super Contributor
timestamp: October 10, 2014, 07:59:49 pm
content: Have you ever used C# on a non-Windows platform? I have witnessed such a project and the programmer kept running into Windows CE limitations. Basically only a subset of C# was/is supported in Windows CE. The same probably goes for Java. You need the embedded version which can be a bitch to compile and even then you probably can't use a lot of stuff which is available on the 'desktop' version of Java.A customer of mine is using C + Lua on a Linux platform and that seems to work much better. There is no cut-down or embedded version of Linux; only a limit in memory and performance. In my own experience whatever works on x386 Linux also works on Linux running on ARM.

author: grumpydoc
author_rank: Super Contributor
timestamp: October 10, 2014, 08:16:49 pm
content: Quote from: LabSpokane on October 10, 2014, 01:15:55 amMmmm, my experience of Java on "embedded" platforms - building an SNMP agent to hold alargeMIB using the JMDK is a little out of date (about 2001) but the scars still feel fresh.If you know what you're doing and are careful Java is OK, if not it can quickly grow to consume all of your memory and all of your CPU before coming back for much, much more.

author: Kjelt
author_rank: Super Contributor
timestamp: October 10, 2014, 08:24:20 pm
content: Just a thought. The only valid reason I can think of is if the company would need to let 3rd parties (OEM clients, installers but not end customers) run their code on the devices.If you give a C code API you can get into problems since the 3rd party developers could easily crash your device, blaming your company and you can go search for the cause.You can only give access to your devices if the code and allowed memory to use is fully contained, so think virtual machine. You don't want C pointers to any memory location and allowing others to overwrite their and your buffers. Or even worse, read out your valuable firmware codeNo you want and need proper limited access and AFAIK a JVM might be able to do just that.If you are wondering what the applications are, besides the well known apps on iOS and android where you do not want a developer to crash the entire device with their faulty app, well sometimes you have trust issues where two or more companies in multiple domains meet eachother. For instance in an office building where one company regulates the HVAC another company does the shutters for the windows another company controls the AV equipment and yet another company controls the lighting. You eventually want the user to be able to control all these devices with one device or controller but the companies want to sell their controller (software).Not one of those companies want to open up their interface so another company can take advantage and control it fully.So there is where often these weird constructions are created.

author: nctnico
author_rank: Super Contributor
timestamp: October 10, 2014, 08:55:00 pm
content: Those kind of problems are usually solved by offering some form of scripting.

author: Zeta
author_rank: Contributor
timestamp: October 10, 2014, 09:11:48 pm
content: Quote from: logictom on October 10, 2014, 02:29:53 amAre you sure it was job position in a real company ? maybe it was actually a job advert posted by an "inventor"?those are the guys looking for electronic engineers with 5+years of raspberry pi and arduino programming experience

author: Jeroen3
author_rank: Super Contributor
timestamp: October 10, 2014, 09:55:13 pm
content: Nearly all payment terminals (those on the counters) made by a company I forgot the name of, run C# on a linux variant.Thats like asking a Ferrari dealer if he can sell you a Porsche, but for some reason they use this. And it seems to work fine.