So after working with the #MeshCore firmware sourcecode for a bit, I'm feeling a little disenchanted. I mean it works mostly fine and I really appreciate all the work that has gone into it. But especially the hardware support layer is a bit of a mess at some points. It's the usual kind of technical debt that builds up if you keep adding stuff without doing enough refactoring.

#embedded #lora #offgrid #communication #foss

[1/5]

And the #Arduino and #PlatformIO frameworks also don't really help much either when trying to implement hardware support cleanly and writing efficient code. Too much code that can not be changed easily (no access to ISRs hidden in the Arduino core, etc.). The build system is quite inefficient and doesn't allow to describe the different options without duplications.

#meshcore #embedded #lora #offgrid #communication #foss

[2/5]

The task is definitely not easy. There's a ton of hardware platforms, boards, configuration and features that all need to go into one codebase. Usually for such a project, I would suggest to use #Zephyr with devicetrees for hardware description and #Kconfig for user-friendly build-time configuration, but lately I've also been thinking of a totally different approach.

#meshcore #embedded #lora #offgrid #communication #foss

[3/5]

What about #MeshCore in #RustLang? There is #embassy which looks like a nice framework with just the right HALs available for #LoRa, #BLE, etc. In the long run it could even be based on #ariel-os to make use of their abstractions and board configuration management. I found there already is some WIP here [1] by @duncaen, [2] by @B3NNY and [3] by @hpux735.

[1] https://github.com/Duncaen/meshcore-rs
[2] https://github.com/Ben-Lichtman/nrf-lora
[3] https://git.housedillon.com/wdillon/Meshcore-rs

#embedded #lora #offgrid #communication #foss

[4/5]

GitHub - Duncaen/meshcore-rs: meshcore protocol and (soon) firmware implementation in rust

meshcore protocol and (soon) firmware implementation in rust - Duncaen/meshcore-rs

GitHub

The thing is, I still need to learn #RustLang before joining any of these undertakings. ;)

Running the example code from the lora-rs crate is one thing and at least setting things up including debugging on my NRF52 hardware using a CMSIS-DAP debugger was surprisingly smooth.

So if you have any thoughts on this, feel free to let me know.

#meshcore #embedded #lora #offgrid #communication #foss

[5/5]

@frisch if you have an nrf52 board, I recommend trying my nrf-lora thing out (best with probe-rs debugger) it's kinda janky with hardcoded parameters, but should at least decode and send packets fine.

Overall writing embedded firmware in rust is very nice

@frisch
heh, this was exactly my impression and line of thinking 😉

The MeshCore README opens with "MeshCore is a lightweight, portable C++ library", but the way PlatformIO and the arduino Arduino SDK work means it's firmly in "framework" territory IMO and I guess "portable" here just means "we support many boards" rather than the "this code makes few assumptions about the dev+runtime environment" I assumed when I first encountered the repo 😅