Live data from Hacker News

Run Erlang/Elixir on Microcontrollers and Embedded Linux

grisp.org

21–30 of 55 posts

Re: Run Erlang/Elixir on Microcontrollers and Embedded Linux

#21

Earlier quoted context omitted.

Call us when they implement OTP compatibility.

What part is missing? I’ve built a little distributed app that has a cluster registry and dns. There’s a tiny bit of Erlang involved but the majority of it is gleam. https://github.com/trescenzi/points

Several pieces: https://gleam.run/roadmap/

Much of it can be worked around as you suggest.

Re: Run Erlang/Elixir on Microcontrollers and Embedded Linux

#22
post #4

Pretty cool. I am a fan of everything Erlang. Managing large clusters of IOT devices running Beam sounds like a good idea not just because of fault tolerance but for hot swapping code.

I am the same but for elixir, the beam is awesome & I always wonder why it still hasn't caught on with all the success stories. The actor model just makes programming feel so simple

Same, my personal theory where it excels and overachieves is where there is already really fleshed out and oversaturated developer ecosystems (and experienced developer pool) that organizations have alot of legacy software built on it. I think it will gain momentum as we see more need for distributed LLM agents and tooling pick up. (Or when people need extreme cost savings on front facing apis/endpoints that run simple operations)

Re: Run Erlang/Elixir on Microcontrollers and Embedded Linux

#23
post #5

> MCU-class footprint (fits in 16 MB RAM) That is absolutely not an MCU class footprint. Anything with an "M" when talking about memory isn't really an MCU. For evidence I cite the ST page on all their micros: https://www.st.com/en/microcontrollers-microprocessors/stm32... Only the very very high performance ones are >1MB of RAM.

I see their board uses a daughter board from Phytec, a German company too. This is based on very high performance NXP MCU, the i.MX 6UL, with additional external DDR RAM.

Re: Run Erlang/Elixir on Microcontrollers and Embedded Linux

#24
huge fan of elixir. and definitely have some dumb questions.

in some of the realtime architectures i've seen, certain processes get priority, or run at certain Hz. but i've never seen this with the beam. afaik, it "just works" which is great most of the time. i guess you can do: Process.flag(:priority, :high) but i'm not sure if that's good enough?

Re: Run Erlang/Elixir on Microcontrollers and Embedded Linux

#25

huge fan of elixir. and definitely have some dumb questions. in some of the realtime architectures i've seen, certain processes get priority, or run at certain Hz. but i've never seen this with the beam. afaik, it "just works" which is great most of the time. i guess you can do: Process.flag(:priority, :high) but i'm not sure if that's good enough?

Beam only promises soft realtime. When switching processes, runnable high priority tasks will be chosen before runnable normal or low priority tasks, and within each queue all (runnable) tasks run before a task runs again. But beam isn't really preemptive; a normal or low priority task that is running when a high priority task becomes runable won't be paused; the normal task will continue until it hits its reduction cap or blocks. There's also a chance that maybe you hit some operation that is time consuming and doesn't have yield points; most of ERTS has yield points in time consuming operations, but maybe you find one or maybe you have a misbehaving NIF.

Without real preemption, consistently meeting strict timing requirements probably isn't going to happen. You might possibly run multiple beams and use OS preemption?

Re: Run Erlang/Elixir on Microcontrollers and Embedded Linux

#26

Sounds like nerves to me? But with soft realtime added in?

My tldr is grisp is beam on an rtos; nerves is beam on a minimal linux; but they also have grisp allow and grisp forge that are beam on linux. Any of these gives you soft realtime.

Re: Run Erlang/Elixir on Microcontrollers and Embedded Linux

#28
post #6

Earlier quoted context omitted.

RAM on MCUs is getting cheaper by the minute. A couple of years ago it was measured in bytes. Before the RP2040 is was measured in dozens of KiB now it's measured in MiB While I agree that 16 MiB is on the larger side for now, it will only be a couple of years for mainstream MCUs having that amount on board

Also curious what MCUs you're working with to give you this impression? RP2040 is 264k, RP2350 is 520k. I use NXP's rt1060 and rt1170 for work, and they have 1M and 2M respectively, still quite far away from 16M and those are quite beefy running at 500MHz - 1GHz.

While I generally agree with you, the RT106x line does support external SDRAM as well. I've got an MIMXRT1060-EVKB sitting here on my desk that has 32MB of SDRAM alongside the on-die 1MB of SRAM.

Re: Run Erlang/Elixir on Microcontrollers and Embedded Linux

#29
post #23
post #5

> MCU-class footprint (fits in 16 MB RAM) That is absolutely not an MCU class footprint. Anything with an "M" when talking about memory isn't really an MCU. For evidence I cite the ST page on all their micros: https://www.st.com/en/microcontrollers-microprocessors/stm32... Only the very very high performance ones are >1MB of RAM.

I see their board uses a daughter board from Phytec, a German company too. This is based on very high performance NXP MCU, the i.MX 6UL, with additional external DDR RAM.

NPX calls[1] it an application processor, and is based on a Cortex-A7, not a Cortex-M series microcontroller processor.

That said these nomenclatures are a bit fuzzy these days.

[1]: https://www.nxp.com/products/i.MX6UL

Re: Run Erlang/Elixir on Microcontrollers and Embedded Linux

#30
post #6
post #5

> MCU-class footprint (fits in 16 MB RAM) That is absolutely not an MCU class footprint. Anything with an "M" when talking about memory isn't really an MCU. For evidence I cite the ST page on all their micros: https://www.st.com/en/microcontrollers-microprocessors/stm32... Only the very very high performance ones are >1MB of RAM.

RAM on MCUs is getting cheaper by the minute. A couple of years ago it was measured in bytes. Before the RP2040 is was measured in dozens of KiB now it's measured in MiB While I agree that 16 MiB is on the larger side for now, it will only be a couple of years for mainstream MCUs having that amount on board

Bigger processors with more RAM have always been available. The question has always been whether you're going to use a $20 processor when you could do the job with a 50¢ one. It's the difference between your product being cheap and disposable, and you getting to choose your margin based on your strategy; and not being able to move a unit without losing money, hoping to sell yourself to someone who knows how to do more with less.

I'm an Erlang fanatic, and have been since forever, paid for classes when it was Erlang Training & Consulting at the center of things, flew cross-country to take them, have the t-shirt, hosted Erlang meetups myself in downtown Chicago. I'm not prototyping a microcontroller application in Erlang if I can get it done any other way. It's committing to losing from the outset.

edit: I've always been hopeful for some bare-metal implementation that would at least almost work for cheap µcs, and there have been promising attempts in the past, but they seem to have gone nowhere.

Post reply on HN