top | item 36255973

(no title)

geijoenr | 2 years ago

Is really hard for me to understand how running an VM on a resource constrained device has any benefit. There is a reason why those devices run using very lightweight "OS"s like FreeRTOS and Embedded C.

Why the constant obsession to apply a technology designed for a specific purpose everywhere else, even when it doesn't make sense?

discuss

order

cprecioso|2 years ago

Say that to the millions of ID cards, transport cards, SIM cards, and other smart cards with a secure element that run Java (a lot of times only powered by the small current from the NFC tap).

iamflimflam1|2 years ago

Java was originally intended for embedded devices...

pjc50|2 years ago

It's not a bad decision for scripting provided the VM is lightweight enough. Things like "FORTH interpreter" or the old "BASIC stamp" microcontrollers. And it provides a degree of robustness vs running arbitrary binaries.

mrguyorama|2 years ago

The Apollo program went to the moon with a complex VM on top of an extremely limited physical architecture. That's actually one of the main reasons to do it, because you can implement a strictly better (in all sorts of ways) virtual machine on top of really awful hardware.

Not to say that's valid in this instance, but plenty of early VMs were entirely made to improve resource constrained hardware

schwartzworld|2 years ago

Making it easy for hobbyists who already know that technology to have access. Micropython has been successful, and this is an alternative to that.

geijoenr|2 years ago

The github project indicates "DeviceScript brings a professional TypeScript developer experience to low-resource microcontroller-based devices."

If you tell me is a toy, and somebody's pet project: fine. Is all about having fun.

But then don't mention "professional" in the project description.

suprfnk|2 years ago

Easy: because TypeScript or Python are way easier to learn than C. Learning C is a long, arduous, uphill battle against arcane error messages and undefined behaviour.

Unless you have a background in C/C++ already, most people can probably get up and running with something like this way, way faster.

littlecranky67|2 years ago

Good luck understanding things like `if(!!!c) { ... }` or why a line-break after a return statement matters in JavaScript/TypeScipt ;) JS has its own footguns and legacy baggage.

TheLoafOfBread|2 years ago

How do you get that TypeScript or Python environment on the chip of your interest at the first place? How do you expose hardware interfaces without knowledge of C?

jononor|2 years ago

One of they main reasons was that they had to: the cost of a more capable system was too high. In the last years that has improved drastically, and there are many usecases where the 5 USD increase in BOM needed to run JS/Python etc can be justified.

mmoskal|2 years ago

Exactly! But it's more like 1.50 USD (ESP32-C3 or RP2040 compared to say STM8).

pjmlp|2 years ago

8 and 16 bit home computing says hello.

TheLoafOfBread|2 years ago

I agree, this will mostly go nowhere. Sure when somebody will prepare you DeviceScript environment for *your* board, then you are good to go. But in 99% of cases, you will get hardware in front of you which almost certainly is not supported by DeviceScript. And now without intimate knowledge of C, how are you going to expose interfaces of that particular hardware, so you can work with those interfaces in DeviceScript? Well you won't, you need to know C first.

Same problem for MicroPython. Same problem for LUA, same problem for any scripting language running on constrained MCU.

jononor|2 years ago

The target audience for such runtimes are teams with general software engineer skills, and less embedded skills, and little hardware skills. They are likely to weight software support (including drivers) very heavily when selecting hardware. This reduces how often the scenario you describe will come up, compared to traditional hardware development.

classified|2 years ago

A VM can make all the gaping security holes portable between IOT devices.

manmal|2 years ago

I appreciate the tongue-in-cheek, but I think there‘s really the chance for better IoT security when using a VM. Those things are connected to the internet (duh) and sandboxing is probably a good idea. You obviously don’t need a VM for that, but maybe the tradeoffs are favorable.