-
Notifications
You must be signed in to change notification settings - Fork 2.1k
core/include/init.h: a new initialization concept #4155
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
Conversation
interesting. some thoughts & questions:
One of the reasons we're still managing auto_init.c by hand... |
I think auto_init has to be done in the main thread because it might spawn threads. I think there was a problem once upon a time when auto_init was invoked in the start-up sequece before the threading was started. |
Though I think this approach is quite elegant for cortex based platforms, I am still very skeptical about linker section based approaches that have to be followed/implemented by all platforms. Especially for MSP430 and AVR8 we are (as the standard toolchains dictate this) using supplied linker scripts, which we can't easily edit. So making this approach work for all RIOT supported platforms would mean that we get this PR to work even with those untouched linkerscripts. So I guess the next step needs to be showing that this concept here will also work for those platforms. |
Should work out of the box for msp430 and AVR8, not have hardware for testing yet, but: objdump -t bin/arduino-mega2560/init_test.elf
objdump -t bin/msb-430/init_test.elf
|
Someone who has the hardware, MSP430 and Arduino (AVR), please can you test it for me? |
both show this:
|
@jfischer-phytec-iot: the functions should be called by the c library's constructor, right? are we sure those little libc's even have those? |
No, that's why I want to implement the init loop (current it uses one in the newlib) as an autoinit function (riots auto init). WIP. I try to organize the hardware. |
@jfischer-phytec-iot let's generalize this (see #4290). Can we make the interface something like
with group being autoinit, netdev, saul, ... (different handlers...), and a size field so that structs can be put in there? edit I don't like INIT as name, but can't come up with a better one currently... |
Will the milestone change to over next release |
Disable newlibs __libc_init_array and board_init if MODULE_PREINIT will be used.
WIP -> postponed. |
Postponed due to feature freeze |
Let's remove the milestone until @jfischer-phytec-iot indicates that he has time to work on this again (or someone else picks it up). |
Development Procedures no. 10: "Closing an issue or pull request must always be accompanied by a comment indicating why it gets closed." |
Also here, sorry, excessive cleansing. |
This PR introduces another initialization concept for core, subsystems and drivers.
Currently the RIOT will be initialized somehow like:
This PR uses macros to make sorted function pointers and place it in a particular area. The macros are sorted by the linker. After the reset, the assorted functions are called in a defined order.
Currently the loop inside __libc_init_array will be used to call the functions. Of course we can move the loop to reset_isr. Advantage is that the drivers and subsystems can initialize itself in defined order. You do not need to change/complete auto_init if you will add new driver or subsystem.
With this PR the RIOT can be initialized somehow like:
This PR is WIP and works only on ARMs. I need help to get it adapted for MSP430 and AVR.
Well then, what do you think about it?