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

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

Merged
merged 4 commits into from Jan 15, 2020

Conversation

@zevv
Copy link
Contributor

zevv commented Jan 9, 2020

Note: draft only.

Added a new OS target for running Nim on embedded targets with very basic OS support, the goal is to require only ANSI C features and nothing else. This new --os:ansic is ideally used together with --useMalloc and --gc:arc and might replace --os:standalone one day.

This solves:

  • The creation of a static RAM area for heap management, now we rely on malloc() and free() only
  • Prevents creation of stack trace info in RAM when stack traces are disabled
  • Disabled SIGABRT hack for gotoBasedExecptions
@zevv zevv force-pushed the zevv:zevv-os-ansic branch 2 times, most recently from f6a2555 to d2e8de1 Jan 9, 2020
@Araq

This comment has been minimized.

Copy link
Member

Araq commented Jan 10, 2020

Un-draft this please.

@zevv zevv force-pushed the zevv:zevv-os-ansic branch from d2e8de1 to d0a9edd Jan 10, 2020
@zevv zevv marked this pull request as ready for review Jan 10, 2020
@zevv zevv force-pushed the zevv:zevv-os-ansic branch from 26e1f6f to 8937d71 Jan 10, 2020
@Araq

This comment has been minimized.

Copy link
Member

Araq commented Jan 10, 2020

Needs a more catchy name like --os:barematel

@zevv

This comment has been minimized.

Copy link
Contributor Author

zevv commented Jan 11, 2020

"baremetal" is not right either. As far as I am concerned, this "os" flavour is ment to get Nim highly portable for running on anything that has a fairly recent C compiler and bit of the standard C library and nothing else. I now run this on a small custom embedded OS on an ARM cortex M4, or on a bare metal 16Kb 8 bit AVR atmel, but also use it to run Nim inside the Linux kernel.

What about --os:any or --os:none?

@Araq

This comment has been minimized.

Copy link
Member

Araq commented Jan 11, 2020

Ok, --os:any then or maybe --os:na.

@zevv

This comment has been minimized.

Copy link
Contributor Author

zevv commented Jan 11, 2020

Ok, renamed to --os:any. Next thing I'd like to do to make the output leaner is to remove the default reporting of unhandled exceptions, as this pulls in a lot of code like reportUnhandledError, dollar, etc.

Any hints on how to do this cleanly?

…duce

code size. Added unhandledExceptionHook instead which can be used to get
a notification from Nim and handle it from the application.
@zevv

This comment has been minimized.

Copy link
Contributor Author

zevv commented Jan 11, 2020

I also added a hook for unhandled exceptions to this branch.

@Araq Araq merged commit 79a3267 into nim-lang:devel Jan 15, 2020
8 checks passed
8 checks passed
builds.sr.ht: freebsd.yml builds.sr.ht job completed successfully
Details
nim-lang.Nim Build #20200111.11 succeeded
Details
nim-lang.Nim (Job Linux_amd64) Job Linux_amd64 succeeded
Details
nim-lang.Nim (Job Linux_i386) Job Linux_i386 succeeded
Details
nim-lang.Nim (Job OSX_amd64) Job OSX_amd64 succeeded
Details
nim-lang.Nim (Job OSX_amd64_cpp) Job OSX_amd64_cpp succeeded
Details
nim-lang.Nim (Job Windows_amd64) Job Windows_amd64 succeeded
Details
nim-lang.Nim (Job Windows_amd64_pkg) Job Windows_amd64_pkg succeeded
Details
sthagen added a commit to sthagen/Nim that referenced this pull request Jan 15, 2020
Added 'ansic' os support for minimal (embedded) targets (nim-lang#13088)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.