HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

Peter Munch-Ellingsen: Why I wrote my own keyboard firmware in Nim (NimConf 2021)

Nim Programming Language1 HN recommender · recommended in 1 month, 2021-2024
YouTube
3K views · 5 years ago · talk · dated

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.

Pointed to as a real-world example of Nim in embedded work, mostly by the author himself.

Embedded systems & DIY electronicsC, C++, Rust, Go & systems languages#nim#keyboardfirmware#embedded#qmk#nimconf

4 comments from Hacker News

@archargelod2024 · in “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

CitesView on HN
@pure_simplicity2021 · in “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, the more I appreciate its design decisions and think to myself: this is the faster version of python I'm looking for. Now, we just need the large package ecosystem that python has, but I'm willing to both wait and participate in making it come about. This presentation about writing keyboard firmware in Nim may be helpful, if you're willing to give Nim some more consideration: ▶ this video There is also another talk about embedded programming in Nim from the same conference, here: link

RecommendsView on HN
@PMunch2021 · in “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 of just getting out of the way and letting your programs fly. Your point about shell-scripting is kind of valid, it is indeed a weakly typed world. But with how fast Nim compiles the edit-test cycle feels as fast as Python, and you save a lot of time from having a silly typo that you only encounter after having run your script for a little while. The reason why Nim is good for pretty much anything is that the speed of the compiler and the garbage collection will rarely if ever stand in your way, and the flexibility of the syntax that stems from meta-programming allows it to be molded perfectly to the use-case.

CitesView on HN
@PMunch2021 · in “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

CitesView on HN
My personal fight against the modern laptop44:50

My personal fight against the modern laptop

linux conf au 2017 - Hobart, Australia
121K views • 9 years ago
C++ Exceptions for Smaller Firmware - Khalil Estell - CppCon 20241:24:36

C++ Exceptions for Smaller Firmware - Khalil Estell - CppCon 2024

CppCon
23K views • 1 year ago
clojure.core/typing - Matt Adereth35:41

clojure.core/typing - Matt Adereth

ClojureTV
40K views • 10 years ago
WWDC24: Go small with Embedded Swift | Apple22:17

WWDC24: Go small with Embedded Swift | Apple

Apple Developer
138K views • 2 years ago
The Road to Zig 1.0 - Andrew Kelley59:48

The Road to Zig 1.0 - Andrew Kelley

ChariotSolutions
168K views • 7 years ago
Hacking with Andrew and Brad: tip.golang.org1:02:49

Hacking with Andrew and Brad: tip.golang.org

The Go Programming Language
99K views • 11 years ago
Introducing a Memory-Safe Successor Language in Large C++ Code Bases - John McCall - CppNow 20231:22:21

Introducing a Memory-Safe Successor Language in Large C++ Code Bases - John McCall - CppNow 2023

CppNow
18K views • 3 years ago
CppCon 2016: Dan Saks “extern c: Talking to C Programmers about C++”1:36:27

CppCon 2016: Dan Saks “extern c: Talking to C Programmers about C++”

CppCon
175K views • 10 years ago
Design Your Own Keyboard!41:04

Design Your Own Keyboard!

Ben Vallack
140K views • 4 years ago
"Liberating the Smalltalk lurking in C and Unix" by Stephen Kell40:56

"Liberating the Smalltalk lurking in C and Unix" by Stephen Kell

Strange Loop Conference
25K views • 12 years ago
CppCon 2018: G. Nishanov “Nano-coroutines to the Rescue! (Using Coroutines TS, of Course)”1:04:26

CppCon 2018: G. Nishanov “Nano-coroutines to the Rescue! (Using Coroutines TS, of Course)”

CppCon
40K views • 8 years ago
OSCON 2010:  Rob Pike, "Public Static Void"12:31

OSCON 2010: Rob Pike, "Public Static Void"

O'Reilly
119K views • 16 years ago
CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”1:19:52

CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”

CppCon
264K views • 10 years ago
Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains1:13:11

Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains

JetBrains
979K views • 5 months ago
GopherCon 2014 Opening Keynote by Rob Pike56:36

GopherCon 2014 Opening Keynote by Rob Pike

Confreaks
38K views • 12 years ago
Casey Muratori | Smart-Pointers, RAII, ZII? Becoming an N+2 programmer30:12

Casey Muratori | Smart-Pointers, RAII, ZII? Becoming an N+2 programmer

xDahl
162K views • 2 years ago
Lang NEXT 2014 Panel  Systems Programming in 2014 and Beyond1:05:56

Lang NEXT 2014 Panel Systems Programming in 2014 and Beyond

25msr
3K views • 8 years ago
Google I/O 2012 - Meet the Go Team1:00:29

Google I/O 2012 - Meet the Go Team

Google for Developers
108K views • 14 years ago
The Forgotten Art of Structured Programming - Kevlin Henney [C++ on Sea 2019]1:29:27

The Forgotten Art of Structured Programming - Kevlin Henney [C++ on Sea 2019]

cpponsea
245K views • 7 years ago
GopherCon 2016: The Design of the Go Assembler - Rob Pike23:57

GopherCon 2016: The Design of the Go Assembler - Rob Pike

Gopher Academy
116K views • 10 years ago