I've never worked with embedded systems, so forgive my ignorance. Why is this any more useful than just writing c code, if all the code that actually interacts with the hardware has to be written in c anyway?
The ability to script without the need of rebuilding/reflashing the whole firmware is often fairly useful. The most value is not in JS per se, but in the ability to script.
mJS – A new approach to embedded scripting
11–20 of 61 posts
Re: mJS – A new approach to embedded scripting
#12I've never worked with embedded systems, so forgive my ignorance. Why is this any more useful than just writing c code, if all the code that actually interacts with the hardware has to be written in c anyway?
I'm wondering the same thing. What does having a JS syntax bring to embedded programming?
Re: mJS – A new approach to embedded scripting
#13Re: mJS – A new approach to embedded scripting
#14I've never worked with embedded systems, so forgive my ignorance. Why is this any more useful than just writing c code, if all the code that actually interacts with the hardware has to be written in c anyway?
2) C needs to be compiled and often flashed onto the device to run, sending new JS over the wire to execute is a lot more convenient, especially if you want customers to be able to customize their devices.
Re: mJS – A new approach to embedded scripting
#15How's the performance? Will my 72MHz Cortex or 16MHz Arduino be able to run interesting things with mJS? If I have to do everything through FFI, what's the benefit vs. e.g. C++11? The latter has nice language features too but compiles to much smaller native code!
Re: mJS – A new approach to embedded scripting
#16I've never worked with embedded systems, so forgive my ignorance. Why is this any more useful than just writing c code, if all the code that actually interacts with the hardware has to be written in c anyway?
Re: mJS – A new approach to embedded scripting
#17Earlier quoted context omitted.
I'm wondering the same thing. What does having a JS syntax bring to embedded programming?
Scripting is rarely about syntax. It's about being able to load code dynamically, being able to create ad-hoc data structures, quick changes and distributing executables as source rather than binaries.
Re: mJS – A new approach to embedded scripting
#18Earlier quoted context omitted.
Scripting is rarely about syntax. It's about being able to load code dynamically, being able to create ad-hoc data structures, quick changes and distributing executables as source rather than binaries.
None of which are particularly appropriate for embedded programming.
Re: mJS – A new approach to embedded scripting
#1925k of flash space sounds like a lot for what is effectively just a JavaScript parser and interpreter. I recall the days when you could fit a whole language's compiler into a few measly KB. 1KB RAM is also quite a lot for certain boards, especially if it has to be stack or SRAM. How's the performance? Will my 72MHz Cortex or 16MHz Arduino be able to run interesting things with mJS? If I have to do everything through…
With C++ one would unfortunately have to create C-wrappers, but with say something with easier C interop like Nim or Rust.
Re: mJS – A new approach to embedded scripting
#20That FFI interface looks way nicer than the node-ffi interface. let f = ffi('int gpio_write(int, int)'); vs. var current = ffi.Library(null, { 'atoi': [ 'int', [ 'string' ] ] });