Skip to content

feat(platforms): upgrade NuttX to 12.12.0#26215

Open
PetervdPerk-NXP wants to merge 7 commits intomainfrom
pr-nuttx-12-12-0
Open

feat(platforms): upgrade NuttX to 12.12.0#26215
PetervdPerk-NXP wants to merge 7 commits intomainfrom
pr-nuttx-12-12-0

Conversation

@PetervdPerk-NXP
Copy link
Copy Markdown
Member

@PetervdPerk-NXP PetervdPerk-NXP commented Jan 5, 2026

Continuation of #26198 but now the NuttX repo's are on the PX4 repositories.
Some reasons why to upgrade NuttX

  • Last upgrade was more then 3 years ago Aug 10, 2022
  • I3C Support has been added
  • RPmsg support for heterogenous MCU's
  • GDBStub support (for debugging over Serial/Ethernet)
  • C/C++ atomic support has been improved
  • Network stack got improved
  • Optional run-time stackchecking on IRQ/Context switch (useful for debugging)
  • CMake support (not the focus on this PR, but allows us to cleanup the build system).
  • Better RISC-V/Xtensa support.

PX4 Test Plan

Category Boot & Flash SD Card CAN/UAVCAN Radio Modes Parameters Ethernet XRCE-DDS USB/QGC Hardfault Logging CPU Load Publication Rates Mavlink
Description Flash PX4 firmware and verify boot Run sd_bench and measure write speed Check UAVCAN node and CAN1 status Bind and verify RC input Arm in Stabilized mode, verify leveling Change parameters and reset to defaults Verify Ethernet connectivity Receive visual odometry messages via XRCE-DDS Verify USB connection and QGC link Trigger and verify hardfault logging Run top when the system is armed Run uorb top when the system is armed Run mavlink status
Expectation PX4 boots without errors Check Avg ≥ 400 KB/s, max write ≤ 50 ms No HW/IO errors, RX/TX frames increment RC channels update in QGC Craft attempts to level (bench OK) Changes persist, reset works PX4 responds to pings, MAVLink over Ethernet VO messages visible in PX4 logs QGC connects and parameters sync correctly Hardfault log saved and retrievable CPU load is similar Publication rates TX/RX rate and latency for all MAVLink instances
CUAV V6X Okay Okay Okay Okay Okay Okay Okay Okay
Pixhawk 6X
Pixhawk 6X-RT

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 5, 2026

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 5336 byte (0.25 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.2% +3.10Ki  +0.2% +3.10Ki    .text
 -94.5% +8.00Ki -94.5% +8.00Ki    [1609 Others]
  [NEW] +2.03Ki  [NEW] +2.03Ki    vscanf_internal
  [NEW]    +936  [NEW]    +936    strtox.isra.0
  [NEW]    +912  [NEW]    +912    uart_readv
 +57e2%    +684 +57e2%    +684    _assert
  [NEW]    +628  [NEW]    +628    nsh_argument.isra.0
  +135%    +628  +135%    +628    strftime
  [NEW]    +614  [NEW]    +614    mmcsd_sdinitialize
  [NEW]    +484  [NEW]    +484    uart_writev
  [NEW]    +390  [NEW]    +390    fat_get_sectors
 -43.8%    -352 -43.8%    -352    mmcsd_probe
 -98.9%    -364 -98.9%    -364    strtod
  [DEL]    -390  [DEL]    -390    nx_poll
  [DEL]    -492  [DEL]    -492    uart_read
  [DEL]    -532  [DEL]    -532    up_assert
  [DEL]    -588  [DEL]    -588    cmd_ifconfig
  [DEL]    -940  [DEL]    -940    ps_callback
  [DEL] -1.24Ki  [DEL] -1.24Ki    nsh_argument
  [DEL] -1.71Ki  [DEL] -1.71Ki    proc_read
 -98.9% -1.79Ki -98.9% -1.79Ki    lib_vscanf
  -2.3% -3.77Ki  -2.3% -3.77Ki    [section .text]
 +43% +1.70Ki   +43% +1.70Ki    .data
 -59.3%    +468 -59.3%    +468    [45 Others]
   +50%    +192   +50%    +192    g_dma
  +460%     +92  +460%     +92    g_hpwork
  +460%     +92  +460%     +92    g_lpwork
  [NEW]     +88  [NEW]     +88    g_wrbuffer
   +26%     +60   +26%     +60    g_uart4priv
   +26%     +60   +26%     +60    g_uart5priv
   +26%     +60   +26%     +60    g_uart7priv
   +26%     +60   +26%     +60    g_uart8priv
   +26%     +60   +26%     +60    g_usart1priv
   +26%     +60   +26%     +60    g_usart2priv
   +26%     +60   +26%     +60    g_usart3priv
   +26%     +60   +26%     +60    g_usart6priv
  [NEW]     +44  [NEW]     +44    g_cbprealloc
  [NEW]     +44  [NEW]     +44    g_icmp_connections
  [NEW]     +44  [NEW]     +44    g_tcp_connections
  [NEW]     +44  [NEW]     +44    g_udp_connections
  [NEW]     +40  [NEW]     +40    g_devno_lock
  [NEW]     +40  [NEW]     +40    g_free_lock
  +250%     +40  +250%     +40    g_inode_lock
   +43%     +36   +43%     +36    g_spi1dev
[ = ]       0  +1.3% +1.16Ki    .bss
  [ = ]       0  [NEW] +4.88Ki    g_iob_buffer
  [ = ]       0  [NEW] +1.91Ki    g_tcp_connections_buffer
  [ = ]       0  [NEW] +1.25Ki    g_wrbuffer_buffer
  [ = ]       0  [NEW]    +704    g_udp_connections_buffer
  [ = ]       0  [NEW]    +480    g_kthread_group
  [ = ]       0  [NEW]    +448    g_sigpool
  [ = ]       0  [NEW]    +288    g_icmp_connections_buffer
  [ = ]       0  [NEW]    +216    g_last_regs
  [ = ]       0  [NEW]    +112    g_sigactions
  [ = ]       0 -98.5%     +96    [52 Others]
  [ = ]       0  [NEW]     +96    g_cbprealloc_buffer
  [ = ]       0  [NEW]     +64    g_tasklisttable
  [ = ]       0   +75%     +60    g_bbsram
  [ = ]       0  [DEL]     -64    g_iobuserstats
  [ = ]       0  [DEL]    -224    g_icmp_connections
  [ = ]       0  [DEL]    -384    g_cbprealloc
  [ = ]       0  [DEL]    -448    g_dns_cache
  [ = ]       0  [DEL]    -704    g_udp_connections
  [ = ]       0  [DEL] -1.22Ki    g_wrbuffer
  [ = ]       0  [DEL] -1.50Ki    g_tcp_connections
  [ = ]       0  [DEL] -4.88Ki    g_iob_pool
+3.7% +73.1Ki  [ = ]       0    .debug_abbrev
+0.9% +1.52Ki  [ = ]       0    .debug_aranges
+1.0% +4.77Ki  [ = ]       0    .debug_frame
+4.0% +1.10Mi  [ = ]       0    .debug_info
+3.4%  +178Ki  [ = ]       0    .debug_line
  [DEL]      -6  [ = ]       0    [Unmapped]
  +3.4%  +178Ki  [ = ]       0    [section .debug_line]
+2.5%     +10  [ = ]       0    .debug_line_str
+1.1% +39.0Ki  [ = ]       0    .debug_loclists
  [NEW]      +3  [ = ]       0    [Unmapped]
  +1.1% +39.0Ki  [ = ]       0    [section .debug_loclists]
+0.8% +4.98Ki  [ = ]       0    .debug_rnglists
  [DEL]      -1  [ = ]       0    [Unmapped]
  +0.8% +4.98Ki  [ = ]       0    [section .debug_rnglists]
+0.1% +4.95Ki  [ = ]       0    .debug_str
  [NEW]      +1  [ = ]       0    [Unmapped]
  +0.1% +4.95Ki  [ = ]       0    [section .debug_str]
+0.8%      +2  [ = ]       0    .shstrtab
-0.0%    -290  [ = ]       0    .strtab
  [DEL]     -10  [ = ]       0    CSWTCH.45
  [DEL]      -9  [ = ]       0    CSWTCH.5
 -100.2%     -15  [ = ]       0    [870 Others]
  -0.3%     -81  [ = ]       0    [section .strtab]
  [DEL]     -15  [ = ]       0    __FUNCTION__.0
  [DEL]     -15  [ = ]       0    __FUNCTION__.1
  [DEL]     -15  [ = ]       0    __FUNCTION__.2
  [DEL]     -15  [ = ]       0    __FUNCTION__.3
  [DEL]     -15  [ = ]       0    __FUNCTION__.4
  [DEL]     -15  [ = ]       0    __FUNCTION__.5
 -26.7%     -16  [ = ]       0    ___ZL19param_get_cplusplustPf.isra.0_veneer
  [DEL]     -26  [ = ]       0    ____aeabi_uldivmod_veneer
  [NEW]     +18  [ = ]       0    ____assert_veneer
  [NEW]     +21  [ = ]       0    __arm_ack_irq_veneer
  [DEL]     -27  [ = ]       0    __arm_switchcontext_veneer
  [DEL]     -19  [ = ]       0    __arp_arpin_veneer
  [NEW]     +19  [ = ]       0    __arp_input_veneer
  [DEL]     -18  [ = ]       0    __arp_ipin_veneer
  [DEL]     -17  [ = ]       0    __arp_out_veneer
  [NEW]      +9  [ = ]       0    __assert
  [DEL]     -29  [ = ]       0    __clock_abstime2ticks_veneer
-0.1%    -832  [ = ]       0    .symtab
 -25.0%     -16  [ = ]       0    AM32Settings::decodeInfoResponse()
   +33%     +16  [ = ]       0    AuterionAutostarter::is_eeprom_header_valid()
 -50.0%     -16  [ = ]       0    AuterionAutostarter::start()
  +100%     +32  [ = ]       0    CSWTCH.42
  [DEL]     -32  [ = ]       0    CSWTCH.45
  [DEL]     -32  [ = ]       0    CSWTCH.5
  +100%     +16  [ = ]       0    CdcAcmAutostart::execute_process()
 -25.0%     -16  [ = ]       0    CdcAcmAutostart::scan_buffer_for_carriage_returns()
  +100%     +16  [ = ]       0    MavlinkStream::update()
  +100%     +16  [ = ]       0    MavlinkStreamAutopilotStateForGimbalDevice::send()
 -25.0%     -16  [ = ]       0    MavlinkStreamBatteryInfo::send()
 -14.3%     -16  [ = ]       0    MavlinkStreamServoOutputRaw<>::new_instance()
 -33.3%     -16  [ = ]       0    PX4IO::updateDisarmed()
  +100%     +16  [ = ]       0    PX4IO::updateFailsafe()
   +50%     +16  [ = ]       0    SensorGpsSim::generate_wgn()
 -33.3%     -16  [ = ]       0    SensorGpsSim::generate_wgn()::S
 -102.6% -1.11Ki  [ = ]       0    [1216 Others]
  +4.5%    +512  [ = ]       0    [section .symtab]
  [DEL]     -80  [ = ]       0    __FUNCTION__.0
  [DEL]     -48  [ = ]       0    __FUNCTION__.1
  [DEL]     -32  [ = ]       0    __FUNCTION__.2
 +17% +1.66Ki  [ = ]       0    [Unmapped]
-5.3%    -776  -5.3%    -776    .ramfunc
  +139%    +100  +139%    +100    nxsched_add_readytorun
   +13%     +76   +13%     +76    stm32_interrupt_work
  +120%     +72  +120%     +72    wd_timer
  +133%     +64  +133%     +64    arm_doirq
  +214%     +60  +214%     +60    nxsched_remove_blocked
   +93%     +56   +93%     +56    ioctl
  +120%     +48  +120%     +48    nxsched_remove_readytorun
   +11%     +44   +11%     +44    stm32_i2c_isr
 -100.6%     -32 -100.6%     -32    [73 Others]
  [DEL]     -40  [DEL]     -40    nxsched_add_blocked
 -97.8%     -44 -97.8%     -44    [section .ramfunc]
 -91.7%     -44 -91.7%     -44    arm_svcall
  [DEL]     -44  [DEL]     -44    sq_rem
  [DEL]     -64  [DEL]     -64    nxsched_add_prioritized
 -51.3%     -80 -51.3%     -80    nxsem_post
  [DEL]     -84  [DEL]     -84    up_unblock_task
  [DEL]    -112  [DEL]    -112    up_block_task
 -88.9%    -128 -88.9%    -128    memset
  [DEL]    -184  [DEL]    -184    wd_start
 -35.6%    -188 -35.6%    -188    memcpy
  [DEL]    -252  [DEL]    -252    nxsig_timedwait
+3.1% +1.40Mi  +0.3% +5.21Ki    TOTAL

px4_fmu-v6x [Total VM Diff: 7400 byte (0.36 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.2% +3.63Ki  +0.2% +3.63Ki    .text
 -94.3% +8.58Ki -94.3% +8.58Ki    [1646 Others]
  [NEW] +2.03Ki  [NEW] +2.03Ki    vscanf_internal
  [NEW]    +936  [NEW]    +936    strtox.isra.0
  [NEW]    +912  [NEW]    +912    uart_readv
 +57e2%    +684 +57e2%    +684    _assert
  [NEW]    +628  [NEW]    +628    nsh_argument.isra.0
  +135%    +628  +135%    +628    strftime
  [NEW]    +614  [NEW]    +614    mmcsd_sdinitialize
  [NEW]    +484  [NEW]    +484    uart_writev
  [NEW]    +390  [NEW]    +390    fat_get_sectors
 -43.8%    -352 -43.8%    -352    mmcsd_probe
 -98.9%    -364 -98.9%    -364    strtod
  [DEL]    -390  [DEL]    -390    nx_poll
  [DEL]    -492  [DEL]    -492    uart_read
  [DEL]    -532  [DEL]    -532    up_assert
  [DEL]    -588  [DEL]    -588    cmd_ifconfig
  [DEL]    -940  [DEL]    -940    ps_callback
  [DEL] -1.24Ki  [DEL] -1.24Ki    nsh_argument
  [DEL] -1.71Ki  [DEL] -1.71Ki    proc_read
 -98.9% -1.79Ki -98.9% -1.79Ki    lib_vscanf
  -2.4% -3.82Ki  -2.4% -3.82Ki    [section .text]
 +45% +2.05Ki   +45% +2.05Ki    .data
  +170%    +544  +170%    +544    g_sdmmcdev2
 -57.7%    +464 -57.7%    +464    [44 Others]
  +460%     +92  +460%     +92    g_hpwork
  +460%     +92  +460%     +92    g_lpwork
  [NEW]     +88  [NEW]     +88    g_wrbuffer
   +26%     +60   +26%     +60    g_uart4priv
   +26%     +60   +26%     +60    g_uart5priv
   +26%     +60   +26%     +60    g_uart7priv
   +26%     +60   +26%     +60    g_uart8priv
   +26%     +60   +26%     +60    g_usart1priv
   +26%     +60   +26%     +60    g_usart2priv
   +26%     +60   +26%     +60    g_usart3priv
   +26%     +60   +26%     +60    g_usart6priv
  [NEW]     +44  [NEW]     +44    g_cbprealloc
  [NEW]     +44  [NEW]     +44    g_icmp_connections
  [NEW]     +44  [NEW]     +44    g_tcp_connections
  [NEW]     +44  [NEW]     +44    g_udp_connections
  [NEW]     +40  [NEW]     +40    g_devno_lock
  [NEW]     +40  [NEW]     +40    g_free_lock
  +250%     +40  +250%     +40    g_inode_lock
  [NEW]     +40  [NEW]     +40    g_nshprompt
[ = ]       0  +1.6% +1.55Ki    .bss
  [ = ]       0  [NEW] +4.88Ki    g_iob_buffer
  [ = ]       0  [NEW] +1.91Ki    g_tcp_connections_buffer
  [ = ]       0  [NEW] +1.28Ki    g_kthread_group
  [ = ]       0  [NEW] +1.25Ki    g_wrbuffer_buffer
  [ = ]       0  [NEW]    +704    g_udp_connections_buffer
  [ = ]       0  [NEW]    +448    g_sigpool
  [ = ]       0  [NEW]    +288    g_icmp_connections_buffer
  [ = ]       0 -95.9%    +228    [53 Others]
  [ = ]       0  [NEW]    +216    g_last_regs
  [ = ]       0  [NEW]    +112    g_sigactions
  [ = ]       0  [NEW]     +96    g_cbprealloc_buffer
  [ = ]       0   +76%     +64    g_bbsram
  [ = ]       0  [DEL]     -64    g_iobuserstats
  [ = ]       0  [DEL]    -224    g_icmp_connections
  [ = ]       0  [DEL]    -384    g_cbprealloc
  [ = ]       0  [DEL]    -448    g_dns_cache
  [ = ]       0  [DEL]    -512    sdmmc_rxbuffer
  [ = ]       0  [DEL]    -704    g_udp_connections
  [ = ]       0  [DEL] -1.22Ki    g_wrbuffer
  [ = ]       0  [DEL] -1.50Ki    g_tcp_connections
  [ = ]       0  [DEL] -4.88Ki    g_iob_pool
+4.9% +92.2Ki  [ = ]       0    .debug_abbrev
+1.1% +1.76Ki  [ = ]       0    .debug_aranges
+1.1% +5.19Ki  [ = ]       0    .debug_frame
+4.7% +1.24Mi  [ = ]       0    .debug_info
+3.7%  +189Ki  [ = ]       0    .debug_line
  [NEW]      +1  [ = ]       0    [Unmapped]
  +3.7%  +189Ki  [ = ]       0    [section .debug_line]
+2.5%     +10  [ = ]       0    .debug_line_str
+1.2% +41.5Ki  [ = ]       0    .debug_loclists
  [NEW]      +2  [ = ]       0    [Unmapped]
  +1.2% +41.5Ki  [ = ]       0    [section .debug_loclists]
+0.9% +5.24Ki  [ = ]       0    .debug_rnglists
+0.2% +5.30Ki  [ = ]       0    .debug_str
  [NEW]      +3  [ = ]       0    [Unmapped]
  +0.2% +5.30Ki  [ = ]       0    [section .debug_str]
+0.4%      +1  [ = ]       0    .shstrtab
+0.0%    +227  [ = ]       0    .strtab
  [DEL]     -10  [ = ]       0    CSWTCH.45
  [DEL]      -9  [ = ]       0    CSWTCH.5
 -96.1%    +275  [ = ]       0    [828 Others]
  +0.4%     +94  [ = ]       0    [section .strtab]
  [DEL]     -15  [ = ]       0    __FUNCTION__.0
  [DEL]     -15  [ = ]       0    __FUNCTION__.1
  [DEL]     -15  [ = ]       0    __FUNCTION__.2
  [DEL]     -15  [ = ]       0    __FUNCTION__.3
  [DEL]     -15  [ = ]       0    __FUNCTION__.4
  [DEL]     -15  [ = ]       0    __FUNCTION__.5
  [NEW]      +9  [ = ]       0    __assert
   +28%      +9  [ = ]       0    __orb_position_controller_landing_status
 -81.8%      -9  [ = ]       0    __start
  [DEL]     -15  [ = ]       0    _net_timedwait
 -45.7%     -16  [ = ]       0    _vectors
  [NEW]      +7  [ = ]       0    adjust
  [NEW]     +15  [ = ]       0    arc4random_buf
  [NEW]     +19  [ = ]       0    arm_color_intstack
  [DEL]     -15  [ = ]       0    arm_dump_stack
  [DEL]     -14  [ = ]       0    arm_dump_task
  [DEL]     -23  [ = ]       0    arm_fullcontextrestore
+0.0%     +16  [ = ]       0    .symtab
 -25.0%     -16  [ = ]       0    AM32Settings::decodeInfoResponse()
  +100%     +32  [ = ]       0    CSWTCH.42
  [DEL]     -32  [ = ]       0    CSWTCH.45
  [DEL]     -32  [ = ]       0    CSWTCH.5
  +100%     +16  [ = ]       0    CdcAcmAutostart::execute_process()
 -25.0%     -16  [ = ]       0    CdcAcmAutostart::scan_buffer_for_carriage_returns()
  +100%     +16  [ = ]       0    MavlinkStream::update()
 -14.3%     -16  [ = ]       0    MavlinkStreamServoOutputRaw<>::new_instance()
 -33.3%     -16  [ = ]       0    PX4IO::updateDisarmed()
  +100%     +16  [ = ]       0    PX4IO::updateFailsafe()
 -99.9%     +48  [ = ]       0    [1152 Others]
  +2.4%    +272  [ = ]       0    [section .symtab]
  [DEL]    -128  [ = ]       0    __FUNCTION__.0
  [DEL]     -48  [ = ]       0    __FUNCTION__.1
  [DEL]     -32  [ = ]       0    __FUNCTION__.2
  [DEL]     -32  [ = ]       0    __FUNCTION__.3
  [DEL]     -32  [ = ]       0    __FUNCTION__.4
  [DEL]     -32  [ = ]       0    __FUNCTION__.5
  [NEW]     +48  [ = ]       0    __assert
   +25%     +16  [ = ]       0    __dtoa_engine
 -25.0%     -16  [ = ]       0    __errno
+8.7%    +376  [ = ]       0    [Unmapped]
+3.6% +1.58Mi  +0.4% +7.23Ki    TOTAL

Updated: 2026-04-01T12:19:51

@alexcekay
Copy link
Copy Markdown
Member

Hi @PetervdPerk-NXP, @AlexKlimaj,

This is a very large change (around 5,000 commits in NuttX and many changes in the common code), and to be honest I’m not particularly excited about the approach:

Asked github copilot with Claude Sonnet 4.5 to replace the PX4 Nuttx submodule with upstream NuttX.

Especially when this then requires patching and reviewing fixes like the following just to get things running:

# Add delay after format for SD card to be ready (NuttX 12)
usleep 100000
[...]
# Try one more time with additional delay
usleep 200000

This kind of patching being needed already shows that interfaces don't behave the same anymore and we need to understand this and not start patching until it somehow works. This one was detected, but I am very sure there are a lot more of those "quirks" that will occur less often and only in specific situations.

Don’t get me wrong, I like the idea of us staying up to date with NuttX. However, with a migration that appears to be largely AI-driven, it effectively shifts a significant amount of risk and workload onto the reviewers and flight testers. They now need to ensure that no low-level or timing-related issues are introduced that might only show up sporadically in real operation.

With that in mind, I’d like to ask a few questions:

  • What do we gain by updating to NuttX 12.12.0 at this point? Is there a specific feature, fix, or requirement that makes this update necessary right now?
    • Given the chosen approach, I see a real risk of subtle interface or behavior changes in NuttX that could lead to time-consuming bugs later, and that may not have been considered during the AI-assisted migration
  • This will require serious testing. Can you coordinate with PX4 flight testers and your in-house testing resources to get a substantial number of testing hours before we move forward?

@PetervdPerk-NXP
Copy link
Copy Markdown
Member Author

PetervdPerk-NXP commented Jan 5, 2026

Hi @alexcekay,
I used #26198 as the baseline since it showed we could get to NuttX 12.12.0 with ~400 lines of changes. I reviewed and applied the updates manually and refactored out most of the "weird" changes from #26198 as well.

I kept the timeout change you're referring to in since @AlexKlimaj observed issues on his hardware that I can’t reproduce on our V6X-RT FMU but overall that's the reason this PR is a draft. Most likely it has to do with the rejected fat dma allocation patches which weren't in the #26198 attempt. Edit: Timeout change not needed anymore, also working on ARK hardware.

Beyond Kconfig symbol churn, the PR is quite modest. My reason to upgrade is primarily to enable i.MX93/i.MX95 hardware, which depends on a more mature RPMsg that we can’t realistically backport from our 2-3 year old NuttX. But they're are various other improvements NuttX brings which makes it worthwhile to upgrade.

I sense some hesitation about upgrading. If we intend to stay on the current kernel long‑term, the migration cost will only grow. I’m happy to help push this over the line, as I did myself with the previous kernel bump 2 years ago aswell, but I’d appreciate alignment and some shared ownership. If you’d prefer I step back and focus elsewhere, let me know.

@alexcekay
Copy link
Copy Markdown
Member

alexcekay commented Jan 5, 2026

Hi @PetervdPerk-NXP,

Thanks for explaining your rationale and pushing this topic.

I sense some hesitation about upgrading

No, as stated: Don’t get me wrong, I like the idea of us staying up to date with NuttX and appreciate

I’m happy to help push this over the line, as I did myself with the previous kernel bump 2 years ago as well

I am hesitant about the risk associated with any larger OS change (and the hours needed to debug the issues afterwards) and thus want to de-risk this and emphasize:

This will require serious testing. Can you coordinate with PX4 flight testers and your in-house testing resources to get a substantial number of testing hours before we move forward?

When this has a sort of mature state where strange quirks are not needed anymore or are at least clearly understood I would be happy to assist in reviewing it and do testing with our HW.

@PetervdPerk-NXP PetervdPerk-NXP force-pushed the pr-nuttx-12-12-0 branch 5 times, most recently from 845fc70 to f6d73d0 Compare January 5, 2026 19:09
@AlexKlimaj
Copy link
Copy Markdown
Member

ARKV6X is booting and sd card works. Doesn't look like free or ps commands work.

[boot] Rev 0x1 : Ver 0x1 ARKV6X001
reset done, 10 ms
[boot]
Fault Log info File No 4 Length 3177 flags:0x01 state:1
[boot]
Fault Log is Armed
HW arch: ARK_FMU_V6X
HW type: ARKV6X
HW FMUM ID: 0x001
HW BASE ID: 0x001
PX4 git-hash: f6d73d0bacd239501747f5987f09b1ba9b86f152
PX4 version: 1.17.0 40 (17891392)
PX4 git-branch: pr-nuttx-12-12-0
OS: NuttX
OS version: Release 12.12.0 (202113279)
OS git-hash: 62ff1b8c59f2ebf1a570126bed0caa326a780701
Build datetime: Jan  5 2026 13:49:00
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 10.2.1 20201103 (release)
PX4GUID: 000600000000363334373333510f0024003c
MCU: STM32H7[4|5]xxx, rev. V
ERROR [bsondump] open '/fs/mtd_caldata' failed (2)
New /fs/mtd_caldata size is:
ERROR [bsondump] open '/fs/mtd_caldata' failed (2)
INFO  [param] selected parameter default file /fs/mtd_params
INFO  [param] importing from '/fs/mtd_params'
INFO  [parameters] BSON document size 621 bytes, decoded 621 bytes (INT32:14, FLOAT:15)
INFO  [param] selected parameter backup file /fs/microsd/parameters_backup.bson
Board architecture defaults: /etc/init.d/rc.board_arch_defaults
Board defaults: /etc/init.d/rc.board_defaults
Loading airframe: /etc/init.d/airframes/4001_quad_x
INFO  [dataman] data manager file '/fs/microsd/dataman' size is 128528 bytes
Board sensors: /etc/init.d/rc.board_sensors
INFO  [ina226] Failed to init INA226 on bus 1, but will try again periodically.
ina226 #0 on I2C bus 1 (external) address 0x41
INFO  [ina226] Failed to init INA226 on bus 2, but will try again periodically.
ina226 #1 on I2C bus 2 (external) address 0x41
INFO  [ina226] Failed to init INA226 on bus 3, but will try again periodically.
ina226 #2 on I2C bus 3 (external) address 0x41
iim42653 #0 on SPI bus 1 rotation 3
iim42653 #1 on SPI bus 2 rotation 9
iim42653 #2 on SPI bus 3 rotation 6
bmm150 #0 on I2C bus 4 (external) address 0x10
bmp390 #0 on I2C bus 4 (external) address 0x76
ekf2 [596:237]
INFO  [px4io] PX4IO Not Supported
Starting Main GPS on /dev/ttyS0
Starting MAVLink on /dev/ttyS6
INFO  [mavlink] mode: Normal, data rate: 1200 B/s on /dev/ttyS6 @ 57600B
Starting MAVLink on ethernet
INFO  [mavlink] mode: Normal, data rate: 100000 B/s on udp port 14550 remote port 14550
INFO  [cdcacm_autostart] Starting CDC/ACM autostart
INFO  [logger] logger started (mode=all)
INFO  [uavcan] Node ID 1, bitrate 1000000
sercon: Registering CDC/ACM serial driver
sercon: Successfully registered the CDC/ACM serial driver

NuttShell (NSH) NuttX-12.12.0
nsh> WARN  [health_and_arming_checks] Preflight Fail: ekf2 missing data
INFO  [cdcacm_autostart] Starting mavlink on /dev/ttyACM0 (SYS_USB_AUTO=2)
INFO  [mavlink] mode: Onboard, data rate: 100000 B/s on /dev/ttyACM0 @ 2000000B
INFO  [uavcan] advertising node_id 120 on index 0
INFO  [gyro_calibration] gyro 1 (3014674) updating offsets [-0.013, -0.012, 0.028]->[-0.005, -0.012, 0.021] 25.2 degC
uavcan_gnss adding channel for topic sensor_gps node 120...
uavcan_gnss node 120 instance 0 ok
uavcan_gnss node 120 topic sensor_gps instance 0 ok
uavcan_mag adding channel for topic sensor_mag node 120...
uavcan_mag channel 120 instance 1 ok
WARN  [uavcan] GNSS Fix2 msg detected for ch 0; disabling Fix msg for this node
WARN  [health_and_arming_checks] Preflight: GPS fix too low
INFO  [vehicle_magnetometer] MAG switch from #0 -> #1
WARN  [health_and_arming_checks] Preflight Fail: Strong magnetic interference
WARN  [health_and_arming_checks] Preflight: GPS fix too low
WARN  [health_and_arming_checks] Preflight Fail: Compass 1 uncalibrated

nsh>
nsh>
nsh>
nsh> sd_bench
INFO  [sd_bench] Using block size = 4096 bytes, sync=0
INFO  [sd_bench]
INFO  [sd_bench] Testing Sequential Write Speed...
INFO  [sd_bench]   Run  0:   363.19 KB/s, max write time: 104 ms (=  38.46 KB/s), fsync: 48 ms
INFO  [sd_bench]   Run  1:   398.10 KB/s, max write time: 37 ms (= 108.11 KB/s), fsync: 56 ms
INFO  [sd_bench]   Run  2:   399.99 KB/s, max write time: 19 ms (= 210.53 KB/s), fsync: 48 ms
INFO  [sd_bench]   Run  3:   394.94 KB/s, max write time: 38 ms (= 105.26 KB/s), fsync: 46 ms
INFO  [sd_bench]   Run  4:   399.31 KB/s, max write time: 19 ms (= 210.53 KB/s), fsync: 47 ms
INFO  [sd_bench]   Avg   :   391.12 KB/s
INFO  [sd_bench]   Overall max write time: 104 ms
nsh>
 PID COMMAND                   CPU(ms) CPU(%)  USED/STACK PRIO(BASE) STATE FD
   0 Idle_Task                   27595 53.213   272/  768   0 (  0)  READY  8
   1 hpwork                          0  0.000   336/ 1216 249 (249)  w:sem  8
   2 lpwork                          0  0.000   336/ 1568  50 ( 50)  w:sem  8
   3 nsh_main                        0  0.000  2024/ 3152 100 (100)  w:sem  8
   4 wq:manager                      0  0.000   368/ 1240 255 (255)  w:sem  8
   5 wq:lp_default                   7  0.264  1552/ 3480 205 (205)  w:sem  8
   6 netinit                         5  0.000   664/ 2032  49 ( 49)  w:sem  8
1235 mavlink_rcv_if1                 4  0.175  2272/ 6200 175 (175)  w:sem  8
 264 wq:hp_default                  99  3.622  1312/ 2784 237 (237)  w:sem  8
 365 dataman                         0  0.001  1072/ 1384  90 ( 90)  w:sem  8
 427 wq:I2C1                         4  0.145  1024/ 2320 246 (246)  w:sem  8
 430 wq:I2C2                         4  0.143   856/ 2320 245 (245)  w:sem  8
 439 wq:I2C3                         4  0.143   880/ 2320 244 (244)  w:sem  8
 458 wq:SPI1                       151  5.570  1832/ 2376 253 (253)  PEND   8
 463 wq:SPI2                       163  6.007  1832/ 2376 252 (252)  PEND   8
 476 wq:SPI3                        79  2.909  1832/ 2376 251 (251)  PEND   8
 492 wq:I2C4                         5  0.192   904/ 2320 243 (243)  w:sem  8
 592 wq:nav_and_controllers        113  4.123  1280/ 2224 242 (242)  w:sem  8
 593 wq:rate_ctrl                  108  3.962  2328/ 3128 255 (255)  w:sem  8
 594 wq:INS0                       181  6.647  3824/ 5984 241 (241)  w:sem  8
 629 commander                      14  0.526  1624/ 3200 140 (140)  w:sig  8
 794 gps                             1  0.105  1040/ 1944 205 (205)  w:sem  8
 926 mavlink_if0                    31  1.156  1784/ 3056 100 (100)  w:sig  8
 927 mavlink_rcv_if0                 4  0.155  2552/ 6200 175 (175)  w:sem  8
1017 mavlink_if1                    96  3.473  1808/ 3056 100 (100)  READY  8
1076 navigator                       2  0.092  1616/ 2176 105 (105)  w:sem 16
1159 logger                          4  0.156  3056/ 3616 230 (230)  w:sem  8
1174 log_writer_file                 0  0.000   384/ 1152  60 ( 60)  w:sem  8
1179 wq:uavcan                      38  1.389  3168/ 3608 236 (236)  w:sem  8
1208 mavlink_if2                   118  4.319  1784/ 3144 100 (100)  w:sig  8
1213 mavlink_rcv_if2                 3  0.144  2216/ 6200 175 (175)  w:sem  8
1257 top                             4  0.187  2336/ 4064 237 (237)  RUN    8

Processes: 32 total, 6 running, 26 sleeping
CPU usage: 45.61% tasks, 1.18% sched, 53.21% idle
DMA Memory: 5120 total, 1024 used 1536 peak
Uptime: 102.365s total, 27.595s idle

nsh> free
nsh> ps a
nsh> ps

@AlexKlimaj
Copy link
Copy Markdown
Member

Confirmed ethernet is working on the ARKV6X.

@PetervdPerk-NXP
Copy link
Copy Markdown
Member Author

ARKV6X is booting and sd card works.

Good to hear SD card works, I've already removed the delay fuctions from the previous PR in rcs, good to know that's not needed anymore.

Doesn't look like free or ps commands work.

This is a bit weird, maybe procfs doesn't properly mount, does help show the commands?

Confirmed ethernet is working on the ARKV6X.

Awesome thanks for testing.

@henrykotze
Copy link
Copy Markdown
Contributor

Im also interested in upgrading Nuttx. Happy to assist in bench testing and flight testing to get this over the line confidently.

What I will test on my bench so long. I hope to report back in the next week.
ESP32
Holybro v6x
CUAV v6x
Cube Orange Plus

@PetervdPerk-NXP PetervdPerk-NXP force-pushed the pr-nuttx-12-12-0 branch 8 times, most recently from 91f6a29 to 99280e0 Compare January 7, 2026 14:53
@jlaitine
Copy link
Copy Markdown
Contributor

jlaitine commented Mar 10, 2026

@PetervdPerk-NXP , I've been running PX4 on some platforms on top of 12.11 for quite some time. I'll try to post some findings here in case they are helpful. Feel free to cherry pick any of the commits below, if you find them usable! All of the points below are just my opinions, I do recognize that there are different ways to do things!

What you are doing is great and I am eagerly waiting for this work to land in PX4. It makes my work on some new SoC:s much easier, and also opens a path to upstream more stuff that depends on the newer NuttX.

  1. the queue.h path is easier to fix by wrapping like this, so that you don't need to modify a million files just because nuttx made it (imho) wrong:
    tiiuae@06930fe

  2. correct way to fix direct semcount access ( sem_.semcount ) is to use the dedicated interface, not to dig into semaphore internal structure, so I suggest this approach :
    tiiuae@4755642

  3. I am not sure if "print load" changes are correct (perhaps they are! I am not trying to suggest that there is something wrong). Anyhow, here is a second opinion on how to fix it for the new nuttx:
    tiiuae@3f39271

@jlaitine
Copy link
Copy Markdown
Contributor

jlaitine commented Mar 10, 2026

  • @linguini1 is our rocket scientist and recently works on improving timings on all boards.
  • You may be interested in recent experimental implementation of nanosecond High Resolution Timer [3] but its not yet part of the release and it needs some detailed testing (especially in SMP).

[1] apache/nuttx#17809 [2] https://nuttx.apache.org/community/ [3] https://nuttx.apache.org/docs/latest/reference/os/time_clock.html#high-resolution-timer-interfaces

The high resolution timer support is something that would make a lot of sense to use also in PX4; that is, make a generic wrapper library out of hrt_ functions for the nuttx hrt timer. Implementing and maintaining an arch specific px4 hrt timer is an unnecessary burden (not too big, but still), when the functionality of hrt callback queueing is already there in nuttx. But certainly not in scope of this PR of course...

@PetervdPerk-NXP
Copy link
Copy Markdown
Member Author

PetervdPerk-NXP commented Mar 16, 2026

Hi Jukka, thanks for the suggestions they make this PR way more manageable.

1. the queue.h path is easier to fix by wrapping like this, so that you don't need to modify a million files just because nuttx made it (imho) wrong:
   [tiiuae@06930fe](https://github.com/tiiuae/px4-firmware/commit/06930fea8f092d07c5c370bb450fb83ed9abd87d)

Indeed that reduces the delta PR of this significantly, I've cherry-picked this commit and cleaned up the changes I did before.

2. correct way to fix direct semcount access ( sem_.semcount ) is to use the dedicated interface, not to dig into semaphore internal structure, so I suggest this approach :
   [tiiuae@4755642](https://github.com/tiiuae/px4-firmware/commit/47556423546005aaec72589cda3fc638f3b89418)

Semcount always has been ugly it seems, NuttX also has this macro NXSEM_COUNT(s) which I've updated the code to use. Actually your fix works better with C++ and Atomics.

3. I am not sure if "print load" changes are correct (perhaps they are! I am not trying to suggest that there is something wrong). Anyhow, here is a second opinion on how to fix it for the new nuttx:
   [tiiuae@3f39271](https://github.com/tiiuae/px4-firmware/commit/3f39271c985233c1466df6410dd023077173ba38)

I like your changes better especially handling the descriptors, I've cherry-picked your commit and modified it to work on NuttX 12.12

Edit: undrafting so CI will run this PR.

@PetervdPerk-NXP PetervdPerk-NXP marked this pull request as ready for review March 16, 2026 10:15
@henrykotze
Copy link
Copy Markdown
Contributor

@PetervdPerk-NXP , @mrpollo We have made the necessary changes to support ESP32 on Nuttx 12.12.0. Would we want to make it a separate PR or part of this one?

Currently, CI doesnt run the ESP32 build.

@PetervdPerk-NXP
Copy link
Copy Markdown
Member Author

@PetervdPerk-NXP , @mrpollo We have made the necessary changes to support ESP32 on Nuttx 12.12.0. Would we want to make it a separate PR or part of this one?

Currently, CI doesnt run the ESP32 build.

Hi @henrykotze,

If you have write access to the PX4 repo I'm okay with you adding a commit to this PR
https://github.com/PX4/PX4-Autopilot/tree/pr-nuttx-12-12-0

@mrpollo mrpollo changed the title Upgrade NuttX to 12.12.0 feat(platforms): upgrade NuttX to 12.12.0 Mar 16, 2026
@PetervdPerk-NXP PetervdPerk-NXP force-pushed the pr-nuttx-12-12-0 branch 4 times, most recently from e9303eb to bface50 Compare March 16, 2026 17:03
Copy link
Copy Markdown
Contributor

@dakejahl dakejahl left a comment

Choose a reason for hiding this comment

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

  • Check cdcacm_autostart works
  • Check cpu load works

Otherwise looks pretty straight forward! Thanks for the effort @PetervdPerk-NXP

set(UAVCAN_IMPLEMENT_PLACEMENT_NEW 0)
else()
set(UAVCAN_IMPLEMENT_PLACEMENT_NEW 1)
endif()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comment to explain?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

When TFLM gets enabled, it changes how libcxx works causing a conflict/incompatiblity with other cxx libraries. IMO Ideally TFLM doesn't do this trick/hack anymore.

#pragma GCC poison getenv setenv putenv
#endif
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comment blocks above are out of order, fix while we're here?

fds->cb(fds);
}

#else
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you explain this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It implements the change due to this commit
apache/nuttx@e9ccab2
See poll_notify(FAR struct pollfd **afds, int nfds, pollevent_t eventset) changes.
NuttX does some weird stuff setting the void poll_default_cb(FAR struct pollfd *fds) trampoline the eventually calls nxsem_post

fds->cb(fds);
}

#else
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you explain this?

@PetervdPerk-NXP PetervdPerk-NXP force-pushed the pr-nuttx-12-12-0 branch 6 times, most recently from 1a164a5 to 89a6b4c Compare March 18, 2026 13:11
Update git sha's for NuttX
PetervdPerk-NXP and others added 5 commits April 1, 2026 13:48
bootloader: update main prototype for NuttX 12.12.0

platforms/nuttx: Add wrapper for queue.h

For some reason the queue.h header was moved, add this wrapper so
posix and nuttx builds can both still use #include <queue.h>

Fix print_load to be compatible with upstream NuttX

Also Change tg_filelist -> tg_fdlist as per new NuttX

Co-authored-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
sitl: fix NuttX 11.12.0 upgrade regressions

drivers: uavcan: fix TFLM c library conflict

With NuttX 12.12.0 the TFLM c library causes a conflict
boards: Disable MMC_IOC_CMD ioctl

NuttX default is Y, but it's not used

boards: Fix meminfo/free

boards: fix libc float setting

boards: Reduce flash usage

Using strerr short mode
Don't cache DNS entries (also saves some ram)
NuttX 12.12 changed symbols for certain calls or inlined them.
Fix a protected kernel link failure caused by static initialization
of a shared uORB::Publication in AM32Settings. Which is problematic
for NuttX 12.12.0.

The NuttX 12.12 PX4 protected kernel does not provide __dso_handle.
kakutef7 overflows with nuttx 12.12.0 also it doesn't have optical
flow drivers anyhow. Thus disable ekf2 optical flow
@PetervdPerk-NXP
Copy link
Copy Markdown
Member Author

@mrpollo @dakejahl Any idea why clang-tidy is failing.
All other CI targets are successful now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.