including a static library to ardupilot

Hi every one. 

I need some help with linking some libraries to ardupilot. I created a simple library (AddNumbers) and i paste the AddNumbers's folder on ardupilot/libraries. In that folder i have 4 other folders with the .h, .cpp, .o and .a files.

In ardupilot/mk/board_native.mk i make some changes to link my library:

CXXOPTS = -ffunction-sections -fdata-sections -fno-exceptions -fsigned-char -I ../libraries/AddNumbers/inc

LIBS ?= -lm -lpthread -L ../libraries/AddNumbers/lib -static -lAddNumbers

In this way all works on SITL, but it doesn't create the firmware.px4 for the board. So i tried to modify the PX4Firmware/makefiles/toolchain_gnu-arm-eabi.mk adding some parameters

EXTRA_LIBS += -lAddNumbers

CXXFLAGS = $(ARCHCXXFLAGS) \
$(ARCHWARNINGSXX) \
$(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) \
$(ARCHXXINCLUDES) \
$(INSTRUMENTATIONDEFINES) \
$(ARCHDEFINES) \
-DCONFIG_WCHAR_BUILTIN \
$(EXTRADEFINES) \
$(EXTRACXXFLAGS) \
$(addprefix -I,$(INCLUDE_DIRS), ../../ardupilot/libraries/AddNumbers/inc)

LDFLAGS += -static \
--warn-common \
--gc-sections \
$(EXTRALDFLAGS) \
$(addprefix -T,$(LDSCRIPT)) \
$(addprefix -L,$(LIB_DIRS), ../../ardupilot/libraries/AddNumbers/lib)

But it still doesn't work. On "make px4-v2" command it gives me this error:

CXX:     /home/endri/PX4Firmware/src/modules/px4iofirmware/mixer.cpp

In file included from /home/endri/PX4Firmware/src/drivers/boards/px4io-v2/board_config.h:51:0,

                 from /home/endri/PX4Firmware/src/modules/px4iofirmware/px4io.h:45,

                 from /home/endri/PX4Firmware/src/modules/px4iofirmware/mixer.cpp:55:

/home/endri/PX4Firmware/Build/px4io-v2_default.build/nuttx-export/arch/chip/stm32.h:50:25: fatal error: up_internal.h: No such file or directory

compilation terminated.

make[3]: *** [mixer.cpp.o] Error 1

make[3]: Leaving directory `/home/endri/PX4Firmware/Build/px4io-v2_default.build/home/endri/PX4Firmware/src/modules/px4iofirmware'

make[2]: *** [/home/endri/PX4Firmware/Build/px4io-v2_default.build//home/endri/PX4Firmware/src/modules/px4iofirmware/module.pre.o] Error 2

make[2]: Leaving directory `/home/endri/PX4Firmware/Build/px4io-v2_default.build'

make[1]: *** [/home/endri/PX4Firmware/Build/px4io-v2_default.build/firmware.px4] Error 2

make[1]: Leaving directory `/home/endri/PX4Firmware'

make: *** [px4-io-v2] Error 2

can someone help me?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Activity