Skip to content

Commit

Permalink
[FBW] Compile less overhead in FBW
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Sep 26, 2014
1 parent 4ccfccb commit 6eb64ab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conf/firmwares/subsystems/fixedwing/autopilot.makefile
Expand Up @@ -69,14 +69,17 @@ $(TARGET).srcs += $(SRC_FIXEDWING)/inter_mcu.c
#
# Math functions
#
ifneq ($(TARGET),fbw)
$(TARGET).srcs += math/pprz_geodetic_int.c math/pprz_geodetic_float.c math/pprz_geodetic_double.c math/pprz_trig_int.c math/pprz_orientation_conversion.c math/pprz_algebra_int.c math/pprz_algebra_float.c math/pprz_algebra_double.c
endif

#
# I2C
#
ifneq ($(TARGET),fbw)
$(TARGET).srcs += mcu_periph/i2c.c
$(TARGET).srcs += $(SRC_ARCH)/mcu_periph/i2c_arch.c

endif

######################################################################
##
Expand Down

4 comments on commit 6eb64ab

@flixr
Copy link
Member

@flixr flixr commented on 6eb64ab Oct 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really make a difference?
Unused functions should be removed by the compiler anyway...

@fvantienen
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but it will still compile the c file to an .o file and doesn't link the functions because they aren't needed.
So this actually saves some compile time (and remove some overhead while compiling) ;)

@flixr
Copy link
Member

@flixr flixr commented on 6eb64ab Oct 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, it saves compile time...

@dewagter
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use a separate FBW more and more often for safety reasons. The less code you put in it, the better you can manage the safety. It's cool that the compiler removes unused functions. It is safer not to put the code there in the first place. If anyone ever runs into trouble because his FBW does not have math functions, then please let me know. Otherwise I do not see why the FBW needs math.

Please sign in to comment.