New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PX4 protected build pub #16931
PX4 protected build pub #16931
Conversation
Thanks! I will set some quality time apart to go through it. This capability is one of the key reasons why we chose NuttX 10 years ago and why some of the PX4 fundamentals have been architected around file descriptors (to be able to go through kernel space cleanly). We have since optimized on various fronts, so I'm sure it needs some refresh and polishing. |
I'm very interested to dig into this and see exactly where (and how) you've split things between kernel and user space. I actually gave this a try with NuttX a few years ago, but quickly came to the conclusion the value was minimal if nearly all of PX4 was simply in user space (able to clobber itself). |
If someone has had time to look into this bunch of stuff; I'd appreciate comments on it; basically which parts are implemented in a proper manner, and which could be done better or doesn't make sense at all. I could start chopping it in pieces and make individual smaller PR:s, for example |
I'm still very interested in this and would like to start getting pieces in incrementally as soon as we get v1.12 out. |
62f16ba
to
30f70b3
Compare
Rebased against current master, + added the following:
Didn't have time to clean up all the things I had in mind yet though |
1a81cae
to
4f64a3a
Compare
4f64a3a
to
b1cf57b
Compare
Just a re-base to keep this alive. The following items should be resolved (at least):
|
e5f7438
to
eec3194
Compare
eec3194
to
5dd27ed
Compare
Dropped everything that is not absolutely needed to compile and run this; also tested flying it. |
5dd27ed
to
fc1933b
Compare
Just re-based to see if the weird CI fail goes away |
48d397b
to
5fefddc
Compare
@dagar , @bkueng , this PR now has left the following
Would you like me to further split this into smaller pieces, or is this reviewable as is? This brings in a working target. |
@@ -0,0 +1,20 @@ | |||
#include <drivers/drv_hrt.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing copyright header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, added
The px4_userspace_init function is called from userspace entrypoint before starting NSH Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
For protected/kernel builds the cxx static initializations needs to be done also in kernel side, since px4 creates c++ objects in kernel Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
…utdown lockout Add kernel side ioctls and handlers for vbus state and managing shutdown lockout Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Add launch_kmod command to start/execute px4 modules in kenel space in NuttX protected build Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This is needed for DMA capable memory for fat also in the user side; the file system doesn't seem to work reliably without. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Add a target for nuttx protected build development Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
In memory protected builds these perform nuttx boardctl ioctl calls to kerenel Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Direct gpio read is not possible from user side applications, so use boardctl interface instead. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
It accesses kernel internal structures directly; this needs to be worked out with some proper userspace-kernel interface Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
…build Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
… protected build target This info is needed on both kernel and user sides, and is just data. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
It is a performance issue to run it on user side Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
5fefddc
to
53bdb15
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've made it through... with a lot of patience :D
Nice work.
Thank you for all the reviews and help with this! This is now a good base for gradual improvements in small steps, for which we already have some ideas. |
This PR implements PX4 running on NuttX protected build. The split between kernel and user space libraries is in top level:
kernel:
user space:
build scripts: