ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    PX4 Build broken for SITL Targets

    Software Development
    2
    2
    475
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      ejohnson
      last edited by

      I would like to conduct SITL testing on the same PX4 commit I am deploying to my voxl. I have noticed that the SITL targets for both JMAVSim and JSBSim are failing to build.

      I have been able to get my SITL platforms to build, but I have not been able to do it with out breaking the Voxl target. Here is a PR with change I made to get the SITL targets building.
      https://github.com/modalai/px4-firmware/pull/61

      I think the main issue are pound defines like the following

      #if PX4_SOC_ARCH_ID == PX4_SOC_ARCH_ID_VOXL2
      #include "fc_sensor.h"
      #endif
      

      PX4_SOC_ARCH_ID_VOXL2 is defined in the following enum

      typedef enum PX4_SOC_ARCH_ID_t {
      
      	PX4_SOC_ARCH_ID_UNUSED         =  0x0000,
      
      	PX4_SOC_ARCH_ID_STM32F4        =  0x0001,
      	PX4_SOC_ARCH_ID_STM32F7        =  0x0002,
      	PX4_SOC_ARCH_ID_KINETISK66     =  0x0003,
      	PX4_SOC_ARCH_ID_SAMV7          =  0x0004,
      	PX4_SOC_ARCH_ID_NXPIMXRT1062   =  0x0005,
      
      	PX4_SOC_ARCH_ID_STM32H7        =  0x0006,
      
      	PX4_SOC_ARCH_ID_NXPS32K146     =  0x0007,
      	PX4_SOC_ARCH_ID_NXPS32K344     =  0x0008,
      
      	PX4_SOC_ARCH_ID_EAGLE          =  0x1001,
      	PX4_SOC_ARCH_ID_QURT           =  0x1002,
      
      	PX4_SOC_ARCH_ID_RPI            =  0x1004,
      	PX4_SOC_ARCH_ID_SIM            =  0x1005,
      	PX4_SOC_ARCH_ID_SITL           =  0x1006,
      
      	PX4_SOC_ARCH_ID_BBBLUE         =  0x1008,
      
      	PX4_SOC_ARCH_ID_VOXL2          =  0x100A,
      
      } PX4_SOC_ARCH_ID_t;
      

      The problem is that enums are not evaluated by the preprocessor. Therefore, when the preprocessor encounters the macro evaluation, PX4_SOC_ARCH_ID and PX4_SOC_ARCH_ID_VOXL2 are not recognized as they are part of an enum. As a result, #include "fc_sensor.h" is always included, regardless of the board type.

      Would someone from the dev team be able to suggest a better way to create the macro?

      Thanks in advance!

      Eric KatzfeyE 1 Reply Last reply Reply Quote 0
      • Eric KatzfeyE
        Eric Katzfey ModalAI Team @ejohnson
        last edited by

        @ejohnson Yes, that is a bug. Don't have a suggestion off the top of my head.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        Powered by NodeBB | Contributors