Currently it's only targeting the ESP32 family, but the code is pretty portable. By default, it probably also needs more resources due to OS-like abstractions, allowing for multiple containers to run on parallel, etc. Obviously that also brings some nice advantages. For example, installing or updating, a new container is just a few lines of code.
We have been working on it for more than 5 years now, and it's definitely at a stage where lots of projects would benefit from it.
We found that Python isn't really designed for constrained environments. The object model, in particular, makes it hard to have fast method calls. The memory layout is also affected by the language, leading to bigger objects and a worse GC.
If you are just running a small hello world, or a number crunching loop, then both languages behave similarly. However, if you actually want to run something more consequential in production you will have an easier time with Toit.
Reliability: I don't see why Toit would be any better? FWIW we make medical devices using MicroPython and have tests that have run for many months with no failures. MicroPython, the language, is extremely reliable and thoroughly tested [1], though admittedly the port-specific code can be less so.
We've evaluated Toit and it has some nice features (the containerization is novel and powerful!)...but it's a quirky language with sparse peripheral support. Ultimately it's trivial for Python-familiar developers to switch across to MicroPython - a big benefit. Being constrained to the ESP32 is a limitation that many of our customers would not allow.
[1] See the py folder: https://micropython.org/resources/code-coverage/
[1] https://www.moddable.com/ [2] https://github.com/Moddable-OpenSource/moddable/tree/public/...
I'm not super familiar with embedded Lua but I believe it to require at least an order of magnitude more RAM and codespace than this, even without float support.
For my money, Berry is still a bit heavy. On a cheap M0 I'd rather have something with about half the required memory.
I did not see that on the front page. Thanks for pointing it out.
My mind shut down about 49 days ago.
Seems to be targeted at microprocessors not microcontrollers per the title.
It also mentions heap, which is not something I associate with microcontrollers by default, but I notice a lot of RTOS and allocators lately when I look beyond my own stuff!
I’ve had a (quick) look through the docs and I can only find a REPL example running on a standard OS.
I’m sure some will argue, but I was merely quoting what I immediately saw in the docs compared to what the hn headline said.
I've learned two dozen programming languages. I'm so tired.
I’d rather learn something new.
Plus once you’ve learned a few different C-like languages, it’s usually really quick learning others. Something like this looks like it would be really easy to learn if you’ve already got familiarity with C (or similar). It’s not like having to learn Lisp or Datalog if your experience is in Java or Pascal.
Given the rise of embedded linux, my last project was in Python! A complete waste of resources/memory but I get paid for results not for code
[1] JerryScript https://jerryscript.net/
[2] Traquito: https://traquito.github.io/tracker/source/
[3] https://traquito.github.io/copilot/walkthrough/#step-3-desig...
A quick Google search confirms: https://moddable.com/documentation/devices/pico.php
See here
TinyExpr is very fast, it's just an expression parser, and when you pair it with a state machine engine, you can do stuff like:
"While you are in state 4, if pin Y changes, set machines.foo.state5 to 1".
Which is perfectly sufficient for most "Add a bit of configurability" tasks, I can edit behavior from my phone and make small tweaks.
Anything beyond that I would much rather just do in C++, with access to all my nice dev tools and LLMs and debuggers and linters and version control.
I really like the idea of a full language on a microcontroller, but... You usually need so many bindings and application specific functions that you always wind up needing some C++ code anyway.
I also looked at ESPHome, which is super impressive, very nice to use, but light on runtime web UI configurability, the protocol is nonstandard, and the Python client libs used to have frequent breaking changes.
sagacity•7mo ago
elitepleb•7mo ago
It's still receiving maintenance from contributors, but these sort projects reach a stable maturity and stay there for years fulfilling their use case.
sagacity•7mo ago
middayc•7mo ago
And some projects just don't require much speed and benefit from a higher level lanuage. Reading a couple of sensors over I2C every few seconds, doing some "business logic" and serving data via a http server over wifi can be simpler to achieve in higher level language and the device will be idle for the most of the time anyway.
Micropython is a nice solution in that niche.
But for some projects you do want a lower level language if not for else maybe for lower battery consumption.
iainmerrick•7mo ago
aa-jv•7mo ago
ethan_smith•7mo ago
mrheosuper•7mo ago
This can already be done in C/cpp.
imtringued•7mo ago
However, now that I look at the syntax, Berry Script doesn't really look like a well designed language to me. It's like a weird mix of Lua, Python and Javascript. It's a very backwards looking (as in, it is emulating the past rather than innovating) language, where a lot of the differences only exist for the sake of being different and the more I read through the docs the more I think it looks like a bastardized Python and that I'd rather use MicroPython instead.
nereye•7mo ago
https://microsoft.github.io/devicescript/intro