5 ms·
Kaluma: A Tiny JavaScript Runtime for RP2040 (Raspberry Pi Pico)
- lasagna_coder 4y agoThis is a super cool project, it's fun for prototyping with Web Serial API, so you can have a custom web app, custom controllers... sky's the limit.
- Gravyness 4y agonpm install -g @kaluma/cli kaluma flash index.js This installs kaluma, finds the connected device, uploads the code and runs it. Love this simplicity, sounds like it was made the right way. Is there any posts with benchmarks? Very interested about the timing limits of the event loop implementation such as setInterval(()=>{}, 1); and other cpu heavy stuff like math stuff and pin output change speed from javascript.
- zachrip 4y agoThat's really neat, a lot of times when I see js/ts used in the embedded space, there are a lot of uncanny things coming from using js/ts in my web projects. For example some projects offer TS support but the typings are either all anys or not configured correctly. They also often require lots of random software to flash, I like that this seems to integrate well with npm/node.
- lasagna_coder 4y agoIn short, in my experience it's good for toy projects but nothing "heavy"
- eatonphil 4y ago> Powered by JerryScript. Just to call out that it isn't a new engine, just a runtime on top of JerryScript (which isn't to diminish it, just to clarify). https://jerryscript.net/ https://jerryscript.net/
- deleted 4y ago[deleted]
- _ZeD_ 4y agohow does it compares to micropython?
- moffkalast 4y agoWould be especially interesting to see how robust it is. Micropython on the Pico can get bricked effortlessly and needs re-flashing to get back in order, so if it's not as fragile it would be a decent contender.
- chasd00 4y agohow do you brick a board with micropython effortlessly? ...i'm use to the word "brick" meaning unrecoverable as in "it's just a brick now". If you can fix it by re-flashing then it's not bricked as I understand the term.
- Fatnino 4y agoWe need a word for "broken in a way that requires going out of the comfortable path to fix". In my mind brick also meant unrecoverably dead but it seems the meaning has now drifted to what I wrote above and to access the old meaning one needs to specify "permanently bricked". As for how to mess up micropython: If you load a main.py that has an infinite loop (common on micro controllers because there is no os) then the board will get stuck in that loop as soon as power is applied and your computer can't get a word in because it's no longer listening. Now you can't upload a fixed main.py with a way to break out of the loop. To fix you need to hold the button while powering on. This puts in in flash mode and you can reflash micropython. Or in my case, flash a different special firmware that blows away all the .py files I had on there because main.py was still there when I just reflashed micropython the first time.
- moffkalast 4y agoYep that exactly, which is interesting as the ESP32 in comparison usually still manages to connect and lets you break execution despite being stuck in a loop with main.py, even with blocking timers set up. Frankly the WebREPL on the ESP is about as reliable as the Pico is via USB cable. I've never lost any code on the ESP, but on the Pico just as you're nearing deployment and want to test run at boot you run into the easy pitfall of having to delete all of your files to unbrick the thing. Luckily I hadn't written much by that point yet. I'd assumed that it's because the ESP runs the repl backend and the user code on separate cores, but the Pico is also dual core which would mean it could do the same. Yet it does not. I'm more convinced that the implementation is just kinda bad instead.
- MuffinFlavored 4y agoDoes QuickJS https://bellard.org/quickjs/ https://bellard.org/quickjs/ not compile to/run on the RP2040?
- f_devd 4y agoProbably not using the standard version quickjs since it uses syscalls and all, but (with some workarounds with threads/syscalls/fs) it could probably run.
- incanus77 4y agoRelated to Sprig, which is also on HN front page today: https://news.ycombinator.com/item?id=33451148 https://news.ycombinator.com/item?id=33451148
- Kukumber 4y agoThat reminds me of this (open smart watch with a js scripting engine): https://shop.espruino.com/banglejs2 https://shop.espruino.com/banglejs2 https://github.com/espruino/Espruino https://github.com/espruino/Espruino