Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BSXlite setup library: undefined reference to ...

    BSXlite setup library: undefined reference to ...

    bomilkar
    New Poster

    Hi,

    I'm trying to get started with the BSXlite (version 1.0.2) from this web site:
    www.bosch-sensortec.com/software-tools/software/sensor-fusion-software

    I want to use it on an ARM Cortex M4 MCU (STM32F407) using "GNU Arm Embedded Toolchain". I've been using this tool chain and platform before without any issues.
    arm-none-eabi-gcc --version
    (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.1 20181213 (release) [gcc-8-branch revision 267074]
    or
    (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)

    But now even the simplest test case doesn't work, most likely because I'm using an incorrect library setup.
    The issue I'm facing: "undefined reference to 'bsxlite_get_version(bsxlite_version*)'"

    My test program is this:

    #include "mbed.h"
    #include "bsxlite_interface.h"
    
    int main()
    {
    bsxlite_version version_p;
    bsxlite_get_version(&version_p);
    }

    I use this to compile:
    arm-none-eabi-gcc <lots of options> -o main.o ./main.cpp

    I use this to link:
    arm-none-eabi-gcc <lots of options> main.o -lalgobsx
       or
    arm-none-eabi-gcc <lots of options> main.o -l:libalgobsx.lib

    As I stated above: it fails linking with "undefined reference to 'bsxlite_get_version(bsxlite_version*)'".

    Most likely arm-none-eabi-gcc can't deal with the libraries: libalgobsx.lib or libalgobsx.a

    Using arm-none-eabi-ar and arm-none-eabi-objdump to inspect or unpack libalgobsx.lib or libalgobsx.a looks OK to me.
    Tried to unpacked: "arm-none-eabi-ar x libalgobsx.a" to get bsxlite_interface.o.

    $ arm-none-eabi-objdump -d bsxlite_interface.o
    
    Disassembly of section i.bsxlite_get_version:
    
    00000000 <bsxlite_get_version>:
    0: 2101 movs r1, #1
    2: 7001 strb r1, [r0, #0]
    4: 2100 movs r1, #0
    6: 7041 strb r1, [r0, #1]
    8: 2102 movs r1, #2
    a: 7081 strb r1, [r0, #2]
    c: 4770 bx lr
    
    
    $ arm-none-eabi-objdump -t bsxlite_interface.o
    
    bsxlite_interface.o: file format elf32-littlearm
    
    SYMBOL TABLE:
    00000000 l d .bss 00000418 .bss
    00000000 l d .data 00000004 .data
    00000000 l d i.bsxlite_do_step 00000000 i.bsxlite_do_step
    00000000 l d i.bsxlite_get_version 00000000 i.bsxlite_get_version
    00000000 l d i.bsxlite_init 00000000 i.bsxlite_init
    00000000 l d i.bsxlite_set_to_default 00000000 i.bsxlite_set_to_default
    00000000 l *ABS* 00000000 BuildAttributes$$THM_ISAv4$E$P$D$K$B$S$7EM$PE$A:L22UL41UL21$X:L11$S22US41US21$IEEE1$IW$USESV6$~STKCKD$USESV7$~SHL$OSPACE$EBA8$REQ8$PRES8$EABIv2
    00000000 g O .bss 00000418 .hidden bsxlite_instance_g
    00000000 g F i.bsxlite_do_step 0000010c .hidden bsxlite_do_step
    00000000 g F i.bsxlite_get_version 0000000e .hidden bsxlite_get_version
    00000000 g F i.bsxlite_init 00000024 .hidden bsxlite_init
    00000000 g F i.bsxlite_set_to_default 00000014 .hidden bsxlite_set_to_default
    00000000 F *UND* 00000000 .hidden __aeabi_fmul
    00000000 F *UND* 00000000 .hidden __aeabi_memclr4
    00000000 F *UND* 00000000 .hidden fbpchoiwtjsqykem
    00000000 F *UND* 00000000 .hidden hxejkvyrndiowlfa
    00000000 F *UND* 00000000 .hidden vuxakwpdbengshrm
    00000000 w F *UND* 00000000 .hidden Lib$$Request$$armlib
    

     

    I have no clue what I'm doing wrong. Please help!

    Cheers and Marry Christmas
    Ronald

     

    3 REPLIES 3

    BSTRobin
    Community Moderator
    Community Moderator

    Hi bomilkar,

    You need to refer to the release note and use the corresponding compiler version.

    BSXLite release note.png

    Hi, thanks for the quick reply!

    the oldest release currently available on https://developer.arm.com/downloads/arm-gnu-toolchain-downloads is 11.2-2022.02 (Feb 15, 2022).

    I have a number of releases still available on my computer. The closest to what is mentioned in your release notes is gcc-arm-none-eabi-8-2018-q4-major or gcc-arm-none-eabi-9-2019-q4-major. It's the same issue with both of them. However, your release note requests a tool chain based on GCC 8. Updates to that major release should not change the object format. I guess the reason for my issue must be something else. Maybe the way the objects were compiled. It's hard for me to figure out which compiler command line options are necessary and which must not be avoided.

    Can you please provide the command line you are using to compile bsxlite_integration_example.c ? That would probably be helpful.

    Cheers,

    Bomilkar. 

    BSTRobin
    Community Moderator
    Community Moderator

    Hi bomilkar,

    As your host MCU is STM32F407(ARM Cortex M4F), you should use the library “genericbsxlite_v1-0-2\[Generic]BSXlite_v1.0.2\lib\GCC_OUT\libalgobsxm4hardFP\libalgobsx.a”.

    And compile .c file with the option "-c -std=c99 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O2 -fdata-sections -fno-builtin -fno-common".

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist