4 ms·
Fun talks so far! The esp8266 one is a good example of running Nim on embedded targets. I’ve been happy with Nim in iterating on a hardware product with an esp3
by elcritch 6y ago
Fun talks so far! The esp8266 one is a good example of running Nim on embedded targets. I’ve been happy with Nim in iterating on a hardware product with an esp32, despite being more of an embedded Linux guy. Hoping to expand it out once async is ARC ready. If others are interested in esp32 support, I was able to create an initial PR to target for the ESP-IDF, which is a fork of FreeRTOS and LwIP. It supports much of the basic POSIX api’s, including `select` which is crucial for efficient servers. Freertos tasks and inter-task queues need Nim-ified, but I’m not an expert in FreeRTOS. :/ The Nim library code is surprisingly easy to hack on!
- GeorgeTirebiter 6y agoI'd love to be able to easily write Nim with the esp32 as target; please, say more!
- elcritch 6y agoCan do! I've got the basic OS target as `freertos`, so in theory any FreeRTOS device could work! FreeRTOS has a decent amount of POSIX API's but you'll want the `newlib` and/or `devfs` extra components for `select` (or using uart's with socket api's). The other big piece is `LwIP`, which has slightly different structs for IP addresses than standard *NIXes. Between FreeRTOS/LwIP you could cover a lot of embedded development and chips... Here's an example esp-idf project with a README describing the build and setup: https://github.com/elcritch/esp32_nim_net_example/blob/master/README.md https://github.com/elcritch/esp32_nim_net_example/blob/maste... Here's the Nim Forum thread, if you want to chime in and discuss/help out! https://forum.nim-lang.org/t/6345 https://forum.nim-lang.org/t/6345 It's pretty rough, but it surprisingly stable. Nim wraps enough OS level concepts you could easily use Nim only wrappers without needing specific RTOS idea's except when you want. Wrapping vTask's with Nim's thread api would be awesome. I don't know FreeRTOS hardly at all though. When Nim's async works with ARC, I wonder if it'd be possible to port LwIP or rewrite it in Nim. LwIP seems somewhat buggy. :-)