!apps: Simplify NuttX initialization

BREAKING: In an effort to simplify board initialization logic for NuttX,
NSH will no longer support architecture initialization. This will happen
during boot via the BOARD_LATE_INITIALIZE option. The boardctl command
BOARDIOC_INIT is also no longer available from user-space.

Quick fix:
Any application relying on BOARDIOC_INIT should now enable
BOARD_LATE_INITIALIZE to have initialization performed by the kernel in
advance of the application running. If control over initialization is
still necessary, BOARDIOC_FINALINIT should be implemented and used.
Boards relying on NSH for initialization should also enable
BOARD_LATE_INITIALIZE instead.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
This commit is contained in:
Matteo Golin 2026-02-16 13:41:27 -05:00 committed by Lup Yuen Lee
parent a9881037ea
commit 5b0cae9ab0
22 changed files with 13 additions and 209 deletions

View file

@ -485,16 +485,6 @@ static bool createMediaPlayer(void)
int main(int argc, char *argv[])
{
#if defined(CONFIG_BOARDCTL) && !defined(CONFIG_BOARD_LATE_INITIALIZE)
// Should we perform board-specific initialization? There are two ways
// that board initialization can occur: 1) automatically via
// board_late_initialize() during bootup if CONFIG_BOARD_LATE_INITIALIZE, or
// 2) here via a call to boardctl() if the interface is enabled
// (CONFIG_BOARDCTL=y).
boardctl(BOARDIOC_INIT, 0);
#endif
#ifdef CONFIG_NXWM_NXTERM
// Initialize the NSH library

View file

@ -42,17 +42,6 @@ config TWM4NX_REVMINOR
string "Twm4Nx minor version number"
default "0"
config TWM4NX_ARCHINIT
bool "Have architecture-specific initialization"
default n
select BOARDCTL
depends on !NSH_ARCHINIT
---help---
Set if your board provides architecture specific initialization
via the board-interface function boardctl(). The boardctl()
function will be called early in Twm4Nx initialization to allow
board logic to do such things as configure MMC/SD slots.
config TWM4NX_NETINIT
bool "Network initialization"
default y

View file

@ -98,23 +98,6 @@ int main(int argc, FAR char *argv[])
int ret;
#if defined(CONFIG_TWM4NX_ARCHINIT) && defined(CONFIG_BOARDCTL) && \
!defined(CONFIG_BOARD_LATE_INITIALIZE)
// Should we perform board-specific initialization? There are two ways
// that board initialization can occur: 1) automatically via
// board_late_initialize() during bootup if CONFIG_BOARD_LATE_INITIALIZE, or
// 2) here via a call to boardctl() if the interface is enabled
// (CONFIG_BOARDCTL=y). board_early_initialize() is also possibility,
// although less likely.
ret = boardctl(BOARDIOC_INIT, 0);
if (ret < 0)
{
twmerr("ERROR: boardctl(BOARDIOC_INIT) failed: %d\n", errno);
return EXIT_FAILURE;
}
#endif
#ifdef CONFIG_TWM4NX_NETINIT
/* Bring up the network */