!boards: Simplify NuttX initialization#18408
!boards: Simplify NuttX initialization#18408linguini1 wants to merge 18 commits intoapache:masterfrom
Conversation
|
Notes for reviewers on the initial draft:
|
|
@linguini1 this is a great initiative. |
Hi @fdcavalcanti, if you're talking about making the changes, I think all ESP boards should be included in this patch already (xtensa/risc-v). They were actually quite easy since the board_late_init and board_app_init logic were pretty much identical. If you're talking about how to test, the process would be to configure the build system for one of the modified ESP32 configurations (i.e. nsh) and just boot into NuttX, check that things look okay and run Hope I understood correctly, thanks for your help! |
f30db82 to
31a4ad2
Compare
|
Thank you @fdcavalcanti ! I guess this never worked in mainline then. I'll take a closer look at those configurations (excepting mcuboot) to see if there's any signs in there. |
|
Hi @linguini1: I'm testing a new way to Build PRs in Our Own NuttX Repos, wonder if you would like to try out, and give your feedback to @simbit18 and me? Thank you so much :-)
|
|
I will definitely try this! It may take a while, school is getting a little busy at the moment, but once I do I'll let you know! |
|
This PR has been rebased onto the latest master, and the new boards mentioned by @michallenc have had the same changes applied to them to remove I am currently just waiting on the CI test to pass locally before running it on upstream (thanks @lupyuen , it works really well!). You can see it here: https://github.com/linguini1/manual-nuttx-ci/actions/runs/25074089470 I unfortunately have no way to test/resolve the issues found with the ESP32-devkitc boards. This is otherwise ready to merge. I would really hate to delay it because it becomes a lot of work to rebase every once in a while, but I would need some help fixing the ESP32 issues. It seems we've so far narrowed it down to SMP configs having issues when initialized through @fdcavalcanti the only difference I can see for nuttx/boards/xtensa/esp32/esp32-devkitc/src/esp32_boot.c Lines 86 to 96 in 369755d If you have time, do you think you could test by:
|
|
Hi @linguini1, please edit the following defconfigs on commit
Set |
|
@fdcavalcanti |
|
Seems there are build issues on CI |
@fdcavalcanti I have cancelled the NuttX CI right now as I wait for my local, manual CI to run (to preserve resources). There are currently no build errors for the devkitc, I have just corrected some |
|
Yes but I saw some checks on the CI here that failed. Anyway, I tested on the Espressif CI and it seems fine, just do one last change please: edit After this we should be good to go. Great job! |
BREAKING: In an effort to simplify NuttX initialization, NSH_ARCHINIT is removed. board_app_initialize is also removed. BOARD_LATE_INITIALIZE now performs all board initialization logic, and is by default enabled. All references to these symbols are removed. BOARDIOC_INIT remains, but will result in -ENOTTY when called. It is to be removed in a later commit. Quick fix: Boards relying on NSH_ARCHINIT should now enable CONFIG_BOARD_LATE_INITIALIZE instead. If the application needs fine-grained control over board initialization from userspace, the logic performed by BOARDIOC_INIT may be copied to the board_finalinitialize function and used instead via BOARDIOC_FINALINIT. All board_app_initialize logic provided by NuttX is now moved to board_late_initialize, and the same should be done for out-of-tree boards. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Logic provided by board_app_initialize is replaced by board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Logic provided by board_app_initialize is removed due to the removal of BOARDIOC_INIT boardctl command. Logic inside board_late_initialize is to be used and is identical. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replaced board_app_initialize logic with board_late_initialize. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
|
Okay, it should all be good now! Thanks so much for the testing @fdcavalcanti ! I really appreciate your help! |

Summary
BREAKING CHANGE
This change simplifies the NuttX initialization logic by:
board_app_initialize did so any defconfigs relying on NSH_ARCHINIT will not
break.
This is related to #11321.
Twin PR in NuttX apps should be merged at the same time: apache/nuttx-apps#3405
Impact
Almost every single board/configuration in the NuttX source tree, since many
relied on NSH for initialization.
This is a breaking change that removes the user's ability to use BOARDIOC_INIT
as well. Users are provided with quick-fixes in the commit messages for how to
fix any breakages. BOARDIOC_FINALINIT should be used instead for applications
that truly require full control over the initialization process. For every other
application, BOARD_LATE_INITIALIZE should be enabled to have the NuttX kernel
perform initialization before launching into the app.
Testing
I will be testing on the platforms available to me (simulators and whatever
hardware I own). Testing from community members with hardware across the
architectures affected would be greatly appreciated. If you do want to help with
testing, please provide logs in the PR comments for the affected defconfigs you
tested.
Testing of applications can be seen in the twin PR: apache/nuttx-apps#3405
OS Test logs
sim:nsh: sim-nsh.txtqemu-armv8a:nsh: qemu-armv8a-nsh.txtqemu-armv7a:nsh: qemu-armv7a-nsh.txtrv-virt:nsh: rv-virt-nsh.txtraspberrypi-4b:sd: rpi4b-sd.txt (verify SD filesystem is mounted + ostest)samv71-xult:nsh,samv71-xult:netnsh: See commentesp32c3-xiao:ble: esp32c3-xiao.txt