I’m trying to write Python bindings for Jaci’s neon_pathfinder’s assembly implementation using ctypes. I’m getting a segfault when trying to run the pf_trapezoid_generate_simd function. For a while I thought it was how I was creating the struct array, but the pf_trapezoid_generate_c function works fine (except for reporting far too many segments.)
I haven’t had the chance to test this on an actual RIO, so I’m using roborio-vm. The integration_test works fine for both C and assembly, so I’m guessing this is probably connected to how ctypes works/doesn’t with assembly?
I don’t believe you need to cast anything, I think “segments = (Segment1D * 8192)()” can be passed in directly as the first argument.
You might try wrapping the library with pybind11 instead of using ctypes. This is what we do with the CTRE libraries and it’s a bit easier to use (once you setup the boilerplate anyways).
Thanks for the suggestion. I’ve spent a little bit on this, but I don’t think I understand cross-compiling/C in general enough to get this working right now. Well, at least not at midnight.
I’m going to try the ctypes code on an actual RIO to remove the VM as a possible cause.