How does PX4 fit into NuttX?

I am very new to PX4 and NuttX, and I’m trying to understand how PX4 and NuttX co-exist. I’ve built NuttX standalone plus I managed to hack the nxp_fmurt1062-v1_default build to run on a Teensy4.1. Now I’m just trying to understand how PX4 starts up…
I see in nuttx documentation that NSH initialization can be customized. Does PX4 run by kicking off a bunch of builtins through NuttX? Is there any documentation on this or can someone point me to some code that starts up the “px4 application” within NuttX?

Hello, were you able to find the answer? Also, how did you hack the teensy to run px4?

Well that was a while ago! Never got a reply, but concluded that PX4 is heavily intertwined with NUTTX. IIRC, it was a non-trivial exercise to get to know it all, and unfortunately since then I’ve moved onto other things. Regarding your second question… I assume you mean how did I hack PX4 to run on Teensy4.1? I added similar IO (IMU, motor drivers, etc…) to a custom Teensy4.1 carrier and modified the firmware interfaces as needed. Just grunt work.