I've recently been dipping my toes into Nim as a C/C++ replacement for writing 
for the ESP32-S3. Using 
[nim-arduino](https://github.com/markspanbroek/nim-arduino) and 
[nim-platformio](https://github.com/markspanbroek/nim-platformio), I've managed 
to compile a simple blink, and with a tool called 
[Futhark](https://github.com/PMunch/futhark), I've also managed to wrap and 
compile LVGL for displays. However, a big part of writing for esp32 involves 
lower level access to functions like those in FreeRTOS for multi-threading etc.

As of writing, I've spent about 3 days fighting with Futhark and 
[Nimterop](https://github.com/nimterop/nimterop) trying to generate a wrapper 
to communicate with the IDF, but I've had no luck. When trying to run Futhark 
in the "components" directory of the IDF source, I get error after error with 
missing headers etc. I've even wrote a python script to catch the missing 
headers and write empty files in their place (I know it's silly but I was 
desperate), to no avail. After LVGL wrapped like butter, I cannot seem to 
understand why IDF won't. There are clearly differences in scale between the 
two, and the IDF requires configuration before building, but how does that 
apply here?

Is there something I'm missing or is ESP-IDF really just too complex for 
automatic wrapping?

Any help appreciated!

PS. Although [Nesper](https://github.com/elcritch/nesper) exists and 
accomplishes the same goal, it is written for older versions of the IDF and 
seems unmaintained. Additionally, as new versions of the IDF come out, a repo 
like that would have to be manually updated, while Futhark wrapping is 
automatic.

PPS. If manual memory management is required to use ESP-IDF in Nim, I am 
willing to make that sacrifice. However... it would be nice if there was 
cleaner interop with Nim GC. 

Reply via email to