4 ms·
Is there a possibility that Crystal could be used on MCUs? What would be its advantages over Micropython, C/C++/Rust or Zig?
by ducktective 6y ago
Is there a possibility that Crystal could be used on MCUs? What would be its advantages over Micropython, C/C++/Rust or Zig?
- tyingq 6y agoNim seems like it would do well, since you can just compile to C code.
- adenozine 6y agoCrystal has a GC, and also compiles to LLVM IR, so it's a little heavier than what you might want for MCUs. Circuitpython, C-*, Zig, Nim and other co would all be more appropriate choices, generally speaking. I'd love to see some effort taken to bring Crystal lower and closer to metal but I don't think there's that much desire in the community for it, and there's not enough corp resources to just throw man-hours at whatever the community wants right now. Manas seems to have a little trouble keeping people around the Crystal core team, though I'm not exactly sure why. It'd be great to have a Crystal that could spit out C or Zig code instead of LLVM IR. That'd be awesome.
- mhh__ 6y agoNearly all languages worth considering can compile to either GCC or LLVM one way or the other, the thing I find that makes the difference for microcontroller use now is (to be worth using over C) the ability to abstract over the peripherals quickly (There is a project that I think parses the peripheral datasheet at compile time in D, even), preferably zero cost.
- ultrarunner 6y agoThe discussion I've seen surrounding this from core maintainers is that embedded Crystal is not a (medium-term, at least) goal. While you can technically turn off the garbage collector, it's not currently a practical solution.