Add support for NuttX RTOS. (#21372)

* Add support for NuttX RTOS.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>

* lib: pure: asyncdispatch: assign to result.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>

* lib: std: typedthreads: add support for parameters to adjust Thread Stack Size.

Like FreeRTOS/Zephyr, add support for following configurations.

  -d:nimThreadStackSize=xxxxx
  -d:nimThreadStackGuard=yyyy

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>

---------

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
This commit is contained in:
Century Systems 2023-02-16 21:47:52 +09:00 • committed by GitHub
commit 3b9e9fd7b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 52 additions and 17 deletions

View file

@ -2024,7 +2024,7 @@ when defined(posix):
import posix
when defined(linux) or defined(windows) or defined(macosx) or defined(bsd) or
defined(solaris) or defined(zephyr) or defined(freertos):
defined(solaris) or defined(zephyr) or defined(freertos) or defined(nuttx):
proc maxDescriptors*(): int {.raises: OSError.} =
## Returns the maximum number of active file descriptors for the current
## process. This involves a system call. For now `maxDescriptors` is
@ -2033,6 +2033,9 @@ when defined(linux) or defined(windows) or defined(macosx) or defined(bsd) or
result = 16_700_000
elif defined(zephyr) or defined(freertos):
result = FD_MAX
elif defined(nuttx):
# The maximum number of concurrently active UDP and TCP ports.
result = NACTIVESOCKETS
else:
var fdLim: RLimit
if getrlimit(RLIMIT_NOFILE, fdLim) < 0: