PX4 Build broken for SITL Targets
-
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/61I think the main issue are pound defines like the following
#if PX4_SOC_ARCH_ID == PX4_SOC_ARCH_ID_VOXL2 #include "fc_sensor.h" #endifPX4_SOC_ARCH_ID_VOXL2is defined in the following enumtypedef 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!
-
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/61I think the main issue are pound defines like the following
#if PX4_SOC_ARCH_ID == PX4_SOC_ARCH_ID_VOXL2 #include "fc_sensor.h" #endifPX4_SOC_ARCH_ID_VOXL2is defined in the following enumtypedef 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!
@ejohnson Yes, that is a bug. Don't have a suggestion off the top of my head.
-
J jmltt referenced this topic on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login