Peter Munch-Ellingsen: Why I wrote my own keyboard firmware in Nim (NimConf 2021)
Why Hacker News recommends it
Pointed to as a real-world example of Nim in embedded work, mostly by the author himself.
What it is
Peter Munch-Ellingsen explains at NimConf 2021 why he wrote his own keyboard firmware in Nim instead of using QMK or Arduino. He shows that the resulting firmware is very small.
Recommended by 1 HN commenters across 1 different months, 2021 to 2024.
What Hacker News said
Recommends pure_simplicity · 2021-11 · on “Show HN: Prometeo – a Python-to-C transpiler for high-performance computing”
Well, you give yourself a whole lot of extra work by attempting to create a Python to C transpiler, basically creating an even less mature and less popular language ecosystem than Nim has, when you could use Nim and get most of the benefits (statically typed, compiled to C) out of the box and enjoy their growing ecosystem. It seems that Prometeo is currently more limited than Nim. Maybe I'm not understanding your use case well enough and maybe your approach is actually a locally optimal solution, and I honestly greatly respect your effort and want to see your project succeed, cuz I love Python too. I even wanted to make a faster python myself at some point. Just, the more I learn about Nim,
Cites PMunch · 2021-10 · on “Nim 1.6”
Oh it definitely can run on those devices! I wrote my own keyboard firmware from scratch in Nim, and the firmware sizes are vanishingly small compared to even simple "hello world" level stuff in Arduino. I did a talk on it for NimConf2021: [this video]
Cites PMunch · 2021-10 · on “Nim 1.6”
Nim works super well for embedded. The thing is that you can turn off the garbage collector and do manual memory allocation if you want to. Or simply use ARC which works a treat on embedded. I wrote my own keyboard firmware in Nim (and did a presentation of it during NimConf 2021: [this video] ). It runs super fast and the code size is smaller than some simple "Hello world" level programs using the Arduino system. As for gamedev the ability to tune the GC by turning off automatic collection and then running it with a time-limit is perfect for preventing lag-spikes when a lot of stuff is going on (looking at you Java..). Nim actually performs very well, and the garbage collector does a great job o
Cites archargelod · 2024-10 · on “Embedded Rust in Production?”
I don't have any first-hand experience with embedded myself, but I've seen positive comments on different forums about using Nim in production for embedded devices. For example, see a couple pages of comments by girvo [1]. Also there's a video on writing keyboard driver in Nim [2]. [1] - [LINK] [2] - [this video]