Skip to content

Conversation

@jia200x
Copy link
Member

@jia200x jia200x commented Feb 7, 2018

Contribution description

This PR/RFC adds a mechanism to change the default entry point to the user main function.
To change main entry point simply define DEFAULT_APP_ENTRY to a different function (by default, will call main() ).

Why?

I found this use cases:

  • For JavaScript apps (sys/js: initial support of RIOT <-> javascript API mapping #7796), the main() function is (somehow) just an event_loop() call and could be a common js_main() inside sys/js folder.
  • For Arduino support, we could have an arduino_main() that handles setup() and loop() functions
  • If at some point we add an App framework (provide custom setup, loop, handlers, whatever), we won't need to touch core files.

I also added a mechanism to print the name of the function, which I'm still not 100% sure if it's the way to go (message should still be there?, etc).

All feedback will be really appreciated!

@jia200x jia200x added 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 7, 2018
LOG_INFO("main(): This is RIOT! (Version: " RIOT_VERSION ")\n");

LOG_INFO(DEFAULT_APP_ENTRY_NAME "(): This is RIOT! (Version: " RIOT_VERSION ")\n");
main();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@kaspar030
Copy link
Contributor

I don't quite agree with the use cases. Using this define, one other function can be selected (instead of main).

This could simple be solved by the corresponding modules just defining "main()", instead of an application.

@tcschmidt
Copy link
Member

@jia200x do you agree with the objections of @kaspar030 or shall we ask for another review?

@jia200x
Copy link
Member Author

jia200x commented Jun 6, 2018

@tcschmidt I agree. Let's close this PR and continue in favour of #9105

@jia200x jia200x closed this Jun 6, 2018
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants