how about writing the firmware in scheme (lisp)? #417
Replies: 2 comments
-
Hello, The topic is genuinely interesting, thanks for bringing it up! That said, I have to admit I have no real experience with Lisp or Scheme. I've done a lot of programming in C, C++, Assembly, Fortran, Perl, PHP, Python, JavaScript, and many others... but never touched Lisp, so I can’t really judge how well-suited it would be for firmware development on such constrained hardware. C has the advantage of being low-level, widely understood, and well-suited for direct hardware access, which is crucial when working close to the metal, like we do on the K5. It also makes it easier for others to contribute, given the shared knowledge base and tooling. As for rewriting or experimenting with the firmware in Scheme/Lisp, I honestly have no idea what the result would look like. I imagine it would be quite a large undertaking — both technically and conceptually — but it’s still a nice challenge. If you’re motivated to explore that path or create a proof of concept, I’d be very curious to see what you come up with. Sometimes, the most unexpected approaches lead to cool breakthroughs. Armel, F4HWN |
Beta Was this translation helpful? Give feedback.
-
one thing i forgot to mention is that these little schemes often compile to C, so C interoperability is not a problem. even a mixed setup would probably be possible where the C codebase is gradually ported to lisp, starting with the lowest hanging fruits where the porting would yield the most benefits. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
did anyone consider writing the firmware in any other language than C?
e.g. there are some interesting scheme compilers for tiny microcontrollers:
BIT: A Very Compact #Scheme System for #Microcontrollers (#lisp #embedded)
http://www.iro.umontreal.ca/~feeley/papers/DubeFeeleyHOSC05.pdf
"We demonstrate that with this system it is clearly possible to run realistic Scheme programs on a microcontroller with as little as 3 to 4 KB of RAM. Programs that access the whole Scheme library require only 13 KB of ROM."
"Many of the techniques [...] are part of the Scheme and Lisp implementation folklore. [...] We cite relevant previous work for the less well known implementation techniques."
or there's this little lisp that can bootstrap (compile) itself to x86 asm in about 2-3 kLoC: https://github.com/attila-lendvai/maru/
the sole external dependency is the gnu assembler. adding an assembler would be another few hundred LoC (there's a proof of concept there already).
lisp has comfortable metaprogramming, which would certainly make the compile time configuration easy and flexible. but i suspect that it would enable jamming in more features into the firmware space.
i'm experienced in C, lisp, and firmware hacking, but i know practically nothing about radios.
i'm willing to make some experiments. the feedback i'm looking for is maybe there's something that i did not consider and that would make the whole endevour a waste of time.
what do you think?
Beta Was this translation helpful? Give feedback.
All reactions