This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Enabling NEON Instructions on Pixhawk

I am trying to get a quadcopter flying using the Pixhawk controller (Cortex M4 running NuttX RTOS) and I am using the Simulink Pixhawk PSP to implement a custom controller. Our controller uses neural networks, so neon instructions are needed (the build errors that came up after adding the NN-based controller was something along the lines of 'NEON instructions need to be enabled in order to #include arm_neon.h). It took me a while, but I was finally able to figure how to set the two cflags (-mfpu=neon -mfloat-abi=softfp) through simulink so that the makefile corresponding to the simulink project has those flags appropriately set. Next, I went through the makefiles in the px4 toolchain and enabled neon instructions there as well. Here's the error I'm getting now:

c:\px4\bin\arm-none-eabi-ld.exe: error: c:/px4/Firmware/Build/px4fmu-V2_default.build/c/px4/Firmware/src/lib/mathlib/CMSIS/library.a(arm_mat_trans_f32.o) uses VFP register arguments, c:/px4/Firmware/Build/px4fmu-v2_default.build/firmware.elf does not

This is not the only instances of this error; there's probably at least 100 of these, each corresponding to different .a(.o). I understand that hardfp and softfp are not compatible and that everything needs to be configured one way or another and that the error that I'm getting is for this reason. Practically, I'm having a tough time identifying/locating whatever it is that needs to be modified in order to address this problem. I have already posted this on the Pixhawk forum and a diydrones forum, but, so far, no luck. Any thoughts here?

  • Cortex-M4 does not support the Neon instruction set; the variant in the Pixhawk does support floating-point which can be compiled for with GCC using "-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mthumb" or "-mfloat-abi=hard", depending on what libraries you are linking with. Using "arm_neon.h" on this processor is unlikely to work unless you re-implement all of the types and intrinsics as functions.

    hth

    Simon.