Added 'ansic' os support for minimal (embedded) targets (#13088)

* os:any implementation
* os:asny: omit flock/funlock calls in echoBinSafe
* Disabled default "unhandled expection" reporting for `--os:any` to reduce
code size. Added unhandledExceptionHook instead which can be used to get
a notification from Nim and handle it from the application.
This commit is contained in:
Ico Doornekamp 2020-01-15 11:06:41 +01:00 • committed by Andreas Rumpf
commit 79a326759a
6 changed files with 87 additions and 73 deletions

View file

@ -295,5 +295,16 @@ elif hostOS == "standalone" or defined(StandaloneHeapSize):
proc osDeallocPages(p: pointer, size: int) {.inline.} =
if bumpPointer-size == cast[int](p):
dec bumpPointer, size
elif hostOS == "any":
proc osAllocPages(size: int): pointer {.inline.} =
result = c_malloc(size.csize_t)
proc osTryAllocPages(size: int): pointer {.inline.} =
result = c_malloc(size.csize_t)
proc osDeallocPages(p: pointer, size: int) {.inline.} =
c_free(p)
else:
{.error: "Port memory manager to your platform".}