Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) #15250

Merged
merged 2 commits into from
Aug 31, 2020

Conversation

elcritch
Copy link
Contributor

Adding FreeRTOS/LwIP to compiler:

  • adding freertos option
  • dyncalls for freertos
  • add freertos to posix os list
  • adding lwip option

Setting up networking FreeRTOS/LwIP Port:

  • setting up lwip network for freertos
  • fixing posix / networking for freertos
  • disable setInheritable for freerots
  • using lwip for net control items

Adding FreeRTOS/LwIP to compiler:

* adding freertos option
* dyncalls for freertos
* add freertos to posix os list
* adding lwip option

Setting up networking FreeRTOS/LwIP Port:

* setting up lwip network for freertos
* fixing posix / networking for freertos
* disable setInheritable for freerots
* using lwip for net control items
@elcritch
Copy link
Contributor Author

@Araq I finally got my changes for the FreeRTOS/LwIP port cleaned up and squashed.

This includes the changes required to build for FreeRTOS. Those changes are fairly minor, mostly adding compiler options for FreeRTOS. Not all Nim standard libraries will work with FreeRTOS, particularly those dealing with files and signals.

The LwIP changes are more extensive. Mostly they're similar to the regular POSIX but there are enough changes and missing items that I opted to duplicate the POSIX bindings. I figure these are stable enough that it'll easy maintenance for LwIP.

I'm not sure how or where to add documentation, though I could add some where it's appropriate. It'd be great to have builds & tests or at least a cross-compiles, but I don't have bandwidth for that. Though a few others seemed interested in the port, so if this is upstreamed, others might be able to help with that.

@Araq
Copy link
Member

Araq commented Aug 31, 2020

I'm merging this. In a follow-up PR please document it a bit here: https://nim-lang.org/docs/nimc.html#nim-for-embedded-systems

@Araq Araq merged commit a76ae8f into nim-lang:devel Aug 31, 2020
@mfiumara
Copy link

Any examples on how to build a sample application for freeRTOS?

mildred pushed a commit to mildred/Nim that referenced this pull request Jan 11, 2021
* Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF)

Adding FreeRTOS/LwIP to compiler:

* adding freertos option
* dyncalls for freertos
* add freertos to posix os list
* adding lwip option

Setting up networking FreeRTOS/LwIP Port:

* setting up lwip network for freertos
* fixing posix / networking for freertos
* disable setInheritable for freerots
* using lwip for net control items

* Fix builds by ignoring lib/posix/posix_freertos_consts.nim similar to lib/posix/posix_other_consts.nim
@elcritch
Copy link
Contributor Author

elcritch commented Jan 11, 2021

I haven't gotten to a PR for it yet, but essentially you just pass --os:freertos. However, I haven't tried building it for "generic" FreeRTOS yet. It's largely dependent upon the micro-controller SDK's build system, some use cmake, makefiles, eclipse, etc.

Here's a sample of what I do for the ESP32 using the ESP-IDF by Espressif:

https://github.com/elcritch/nesper/blob/master/esp-idf-examples/simplewifi/config.nims

The basic route is to compile your Nim application to C code upfront using --compileOnly --nimcache:src/nimcache/. Then you link that into your micro-controllers build system.

For the ESP32, this is done by adding the nimcache folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants