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

core: provide main thread as optional default module #10971

Closed
wants to merge 2 commits into from

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Feb 8, 2019

Contribution description

For a private project of mine I did not really need the main thread. At most I needed it for some device-setup (I will also provide a feature to do that without main() that), but the rest was basically happening in ISR (or for other applications the action might happen in other threads). While it isn't really necessary for my specific case, as the board has a large enough memory, to cope with that, but basically I am wasting a lot of memory, just for simple initialization. As such I am wondering if we could provide a mechanism to completely remove the main-thread and is stack. This is my proposal for that.

Testing procedure

All applications should still compile and work as before. When compiling with DISABLE_MODULE=core_main most applications should still compile, they might not work properly anymore, but they should be significantly smaller.

Issues/PRs references

Requires #10970

When providing a pseudo-submodule for a module already using the
`SUBMODULES` mechanism to provide submodules, it is not possible to
create a true pseudo-module as submodule (i.e. one without any code on
its own), since the build system currently always expects there to be a
C file `module_submodule.c`.

This removes this requirement.
@miri64 miri64 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: core Area: RIOT kernel. Handle PRs marked with this with care! Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR labels Feb 8, 2019
@jcarrano
Copy link
Contributor

jcarrano commented Feb 8, 2019

The way this is done, disabling the main thread also disables auto init. There are two options:

  1. Accept it and note that dependency in the build system so that if both features are requested, an error is raised.
  2. Change the kernel initialization so that auto-initialization is done even if the main thread is not launched.

The problem with (1) is that if there is no main thread and no auto_init, who initializes stuff (maybe I'm missing something?)

@miri64
Copy link
Member Author

miri64 commented Feb 8, 2019

The way this is done, disabling the main thread also disables auto init. There are two options:

  1. Accept it and note that dependency in the build system so that if both features are requested, an error is raised.
  2. Change the kernel initialization so that auto-initialization is done even if the main thread is not launched.

The problem with (1) is that if there is no main thread and no auto_init, who initializes stuff (maybe I'm missing something?)

I was aware of that, but forgot to mention this in OP. For now I would prefer to keep (1) with a later move to (2) in a follow-up (which would be distinct from the application-specific setup routine I'm planning to propose, once the pseudo-module issue in #10970 is resolved)

@stale
Copy link

stale bot commented Aug 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Aug 12, 2019
@miri64 miri64 removed the State: stale State: The issue / PR has no activity for >185 days label Aug 28, 2019
@stale
Copy link

stale bot commented Feb 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Feb 13, 2020
@stale stale bot closed this Mar 15, 2020
@miri64 miri64 deleted the core/enh/main-optional branch March 24, 2020 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: core Area: RIOT kernel. Handle PRs marked with this with care! Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: stale State: The issue / PR has no activity for >185 days Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants