You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently NuttX has many initialization options each one used for some specific case, but at least CONFIG_NSH_ARCHINIT that is used to do drivers initialization when NSH is enabled could be removed in favor of some generic option like BOARD_LATE_INITIALIZATION that will work for all applications (inclusive to NSH itself).
I raised this question some time ago here: #10821 but didn't heard anything from my peers.
But now that @0528Mike came with this PR: #11306 we could fix this issue merging CONFIG_NSH_ARCHINIT and BOARD_LATE_INITIALIZATION to avoid issues like this faced from a NuttX user: #10821 and for many people that want to user their application as ENTRYPOINT on NuttX.
Reacted by Filipe do Ó Cavalcanti, Theo Martin, Mateusz Szafoni, CeDeROM, Serg Podtynnyi and Matteo Golin
hi, are we trying to solve this problem? Does anyone have any objections to removing CONFIG_NSH_ARCHINIT ?
This option is slowly starting to cause problems in the case of PCI devices. Some OS components that have a PCI based virtio backend need to be initialized in the correct order (e.g. coredump with PCI based virtblk device), which is impossible to achieve with CONFIG_NSH_ARCHINIT.
I think a proper solution would be the complete remove of the archi-init logic, not just disabling it. I think that would cause a lot of confusion in the future.
This would require removal the the BOARD_CTRL log, removal of the arch-init entry point to the board initialization logic, and removal of all calls to the removed BOARD_CTRL logic.
It makes sense. Such a change deserve major version increase during release, as this is substantial change for users. Probably this issue is a good milestone for NuttX 13.0.0 release
I know that this PR was closed, and it appears there are no plans for the author to continue it, but is there a general agreement that something similar to this init approach would be the preferred change? apache/nuttx-apps#3192
I am envisioning some pure initializer (like nxinit was) that allows the user to choose 1+ different processes to start after boot time, and also which takes care of some common logic like starting up USB, etc.
Once such an initializer is accepted by the community, I think we can then move to transform NSH from this "do-all" solution to a pure shell that users can choose to include or not.
I'm in favor of improving the boot process. Just please remember that 3rd party developers may have private, out-of-tree boards that utilize some of these functions in their initialization. (My boards use board_late_initialize, but others may have done differently.) So whatever approach we take to simplify and clean up the boot process, we need to make sure that developers can have the hooks they need to initialize their stuff properly. And we need to make sure that any changes people will need to make, will be properly documented in the release notes!!!
I agree. Right now the idea is to gut the BOARDIOC_INIT and NSH_ARCHINIT stuff.
All users should then be able to choose between two options:
Just enable CONFIG_BOARD_LATE_INITIALIZE and let the NuttX kernel handle the
initialization (the elegant solution)
For cases like raiden pointed out where app developers really need
userspace control over initialization, disable CONFIG_BOARD_LATE_INITIALIZE and
implement a custom board_finalinitialization to call from userspace via boardctl(BOARDIOC_FINALINIT).
As @cederom suggested (I think somewhere on the mailing list) I also plan to include a "quick fix" message in both the PR descriptions and commit messages that indicate to the end user what they need to change in their defconfig/custom board logic/custom app to fix any breakages.
But there is no info about where and how board is initialized (BOARD_INIT / INIT_BOARD?) maybe we could add one (as C before APP, then APP becomes D)? :-)
@linguini1 added plantuml support for documentation so we can now auto-generate awesome diagrams from simple text :-)
@linguini1 is the boot process is a mess, there are originally the xxx_boot.c and later xxx_bringup.c. Later xxx_appinit.c and finally there is only one xxx_init.c: avr/avrdx/breadxavr/src/avrdx_init.c
I think we need some consensus before changing it! For visibility: @raiden00pl@simbit18@hartmannathan@xiaoxiang781216@lupyuen@jerpelea@cederom (sorry if I missed another people interested on it)
Hi all,
I'm in favor of improving the boot process. Just please remember that 3rd party developers may have private, out-of-tree boards that utilize some of these functions in their initialization. (My boards use board_late_initialize, but others may have done differently.) So whatever approach we take to simplify and clean up the boot process, we need to make sure that developers can have the hooks they need to initialize their stuff properly. And we need to make sure that any changes people will need to make, will be properly documented in the release notes!!!
@hartmannathan I agree that we need to worry about how people are keeping theirs out of tree boards, but instead of creating hooks, it is better to Document how to change to use board_late_initialize or the other alternatives. If I'm not wrong, there is already a "hook" for board early initialize. If we keep many hooks in the kernel, the chaos will continue. The board initialization on NuttX is already very complex, we need to simplify keeping the most common use cases.
Activity
xiaoxiang781216 commentedon Dec 5, 2023
Yes, I think the suggestion is reasonable.
raiden00pl commentedon Dec 7, 2023
+1 from me
raiden00pl commentedon Jan 6, 2025
hi, are we trying to solve this problem? Does anyone have any objections to removing
CONFIG_NSH_ARCHINIT?This option is slowly starting to cause problems in the case of PCI devices. Some OS components that have a PCI based virtio backend need to be initialized in the correct order (e.g. coredump with PCI based virtblk device), which is impossible to achieve with
CONFIG_NSH_ARCHINIT.xiaoxiang781216 commentedon Jan 6, 2025
NSH_ARCHINIT can be achieved in board initializiton code, so it could be removed to avoid the confusion.
gregory-nutt commentedon Jan 6, 2025
Agreed. But removing CONFIG_NSH_ARCHINIT will be a very big job because it is used by 1246 board configurations.
That would be a LOT of breakage!
raiden00pl commentedon Jan 18, 2025
Yes, it seems like a lot of work. But it will only get worse over time as new boards come in.
We can automate most of the work. What we need to do is:
CONFIG_NSH_ARCHINITfrom configsCONFIG_BOARD_LATE_INITIALIZATIONto all modified configsCONFIG_NSH_ARCHINIT.Is there anything more to do ?
The last step most likely must be done manually. But there are "only" 115 files that need modification:
gregory-nutt commentedon Jan 18, 2025
I think a proper solution would be the complete remove of the archi-init logic, not just disabling it. I think that would cause a lot of confusion in the future.
This would require removal the the BOARD_CTRL log, removal of the arch-init entry point to the board initialization logic, and removal of all calls to the removed BOARD_CTRL logic.
raiden00pl commentedon Jan 22, 2025
It makes sense. Such a change deserve major version increase during release, as this is substantial change for users. Probably this issue is a good milestone for NuttX 13.0.0 release
linguini1 commentedon Jan 8, 2026
I know that this PR was closed, and it appears there are no plans for the author to continue it, but is there a general agreement that something similar to this init approach would be the preferred change? apache/nuttx-apps#3192
I am envisioning some pure initializer (like nxinit was) that allows the user to choose 1+ different processes to start after boot time, and also which takes care of some common logic like starting up USB, etc.
Once such an initializer is accepted by the community, I think we can then move to transform NSH from this "do-all" solution to a pure shell that users can choose to include or not.
13 remaining items
linguini1 commentedon Feb 19, 2026
I agree. Right now the idea is to gut the BOARDIOC_INIT and NSH_ARCHINIT stuff.
All users should then be able to choose between two options:
Just enable CONFIG_BOARD_LATE_INITIALIZE and let the NuttX kernel handle the
initialization (the elegant solution)
For cases like raiden pointed out where app developers really need
userspace control over initialization, disable CONFIG_BOARD_LATE_INITIALIZE and
implement a custom
board_finalinitializationto call from userspace viaboardctl(BOARDIOC_FINALINIT).As @cederom suggested (I think somewhere on the mailing list) I also plan to include a "quick fix" message in both the PR descriptions and commit messages that indicate to the end user what they need to change in their defconfig/custom board logic/custom app to fix any breakages.
cederom commentedon Feb 19, 2026
@patacongo pointed to older documentation [1] that we may use as reference point, and probably we should update our current documentation :-)
I like the clear distinction:
But there is no info about where and how board is initialized (BOARD_INIT / INIT_BOARD?) maybe we could add one (as C before APP, then APP becomes D)? :-)
@linguini1 added plantuml support for documentation so we can now auto-generate awesome diagrams from simple text :-)
[1] https://cwiki.apache.org/confluence/display/NUTTX/NuttX+Initialization+Sequence
acassis commentedon Feb 19, 2026
@hartmannathan I agree that we need to worry about how people are keeping theirs out of tree boards, but instead of creating hooks, it is better to Document how to change to use board_late_initialize or the other alternatives. If I'm not wrong, there is already a "hook" for board early initialize. If we keep many hooks in the kernel, the chaos will continue. The board initialization on NuttX is already very complex, we need to simplify keeping the most common use cases.
cederom commentedon Feb 19, 2026
Ugh, I just realized this is already on the 13's list :-P
jerpelea commentedon Feb 19, 2026
@cederom 13.0.0 will be branched out on 1 March
acassis commentedon Feb 19, 2026
Alin, let's use it as unstable/testing release only, NuttX 13 will not help to promote NuttX :-D
cederom commentedon May 26, 2026
Yeah I would stick to 12 too until all tedious work is done and we are really proud to announce 13 :-)
acassis commentedon May 26, 2026
@xiaoxiang781216 Ok, let's open a new issue to address the NX Init missing part