5 ms·
Naive question: wouldn't lua or scheme be more suitable than python to be embedded in microcontrollers?
by S4M 11y ago
Naive question: wouldn't lua or scheme be more suitable than python to be embedded in microcontrollers?
- tdicola 11y agoThere really isn't a best or better choice, everything has pros and cons. MicroPython is really nice in that you can write a C (or even inline assembly) extension to the language easily and get access to the low level hardware. It's very similar to writing a C extension with CPython.
- frik 11y agoI too wonder why ESA and NASA have chosen Python over JavaScript or Lua? The later has been especially design from the ground up for that task. It probably has to do with that their engineers already know Python and Python has a C API too.
- rpcope1 11y agoI feel like regardless of how ubiquitous Javascript is, it's honestly an awful choice for embedded applications (no, most embedded applications don't sport some racecar ARM A7/A8/A9/A15, and shouldn't if it's not absolutely necessary); there are excellent reasons C still dominates here, and would likely be replaced with something like Rust instead of JS. Manual memory management is usually a huge plus on lots of embedded platforms, static typing is really important here, and most of the code is rather low level. These concerns are really sort of exacerbated on stuff going up into space, as the chips tend to be lower density designs, and simpler. Forth is an excellent choice here, and Lua if whatever you're running on can spare some extra CPU cycles. I guess it will be interesting to see how things pan out with MicroPython. I would imagine if you could do anything to improve on what exists today for embedded, it would be to push things like verifiable systems harder, kind of what like Margaret Hamilton was pushing with USL[1]. [1] - http://en.wikipedia.org/wiki/Universal_Systems_Language http://en.wikipedia.org/wiki/Universal_Systems_Language
- ZoFreX 11y agoI would have assumed Ada would be a popular choice in this domain, due to its improved safety over C. I know it's popular for aerospace.
- rpcope1 11y agoYeah, it kind of slipped my mind, but Ada is another good choice.
- kjs3 11y agoUnfortunately, Ada isn't a 'cool' language any more, so it's hard to get a new generation of programmers interested in it. Even university programs that should know better are teaching almost exclusively in languages that have no business anywhere near safety critical environments.
- minthd 11y agoPerosnally i think there's a niche for higher level languages(maybe python) in the non cost-sensitive embedded genre, for systems where size, determinism, peripherals, and maybe power makes embedded micro-controllers attractive - without aiming at low-cost. And i would guess that there are plenty of developers doing such work , either in research or small volume products(or maybe even medium volume).
- rpcope1 11y agoEven if you decide that an extra $X dollars is fine to tack onto the price of whatever it is you're shipping, being as updates are as difficult as they are in the field for an embedded device, I still think I'd rather stick with a statically typed language with good testing and verification tools (granted you can blow your foot off with C too, but there's a lot of talent around here for building safety critical system in C--Javascript not so much). It's not just the upfront cost where something like Javascript has the potential to hurt you here.
- minthd 11y ago
- sciurus 11y agoIt's not like ESA has commissioned them to start work on a python implementation for microcontrollers from scratch. Micropython already exists and works. Previous discussion: https://news.ycombinator.com/item?id=7840566 https://news.ycombinator.com/item?id=7840566
- mister_m 11y agoJust because it works doesn't mean it is the right solution of course.
- stefantalpalaru 11y agoYes, but the scientists who write the software are not necessarily accomplished programmers so they tend to favor nicer syntax over efficiency.
- rebootthesystem 11y agoSometimes getting things done is far more important than trying to get them done with the most optimal tool, particularly if choice is somewhat subjective.
- ised 11y agoI'm not sure that is a naive question. The answer is yes.