Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BSEC Library for BME680 on Mega 2560

    Highlighted
    Member

    BSEC Library for BME680 on Mega 2560

    I have a (Arduino Clone) Mega 2560 Board with Seed Grove BME680 Sensor.

    I use Arduino CC version 1.8.12

    I am running into Linker issues when compiling my sketch(es) using various libraries:

    1/. Using Seed Studios Library for the sensor, I find it works OK, but lacks functionality, namely unable to push the sensor to recalibrate, cant set Altitude to get Sea Level compensation for pressure readings, (etc).

    2/. Using DFROBOT Library, I find it has the functionality I require, however I run into linker problems :

    The linker cannot find bsec_update_subscription and other key functions. These are (only) defined in libalgobsec.a, which appears to be supplied by BSEC in precompiled for to suit various Boards.  However DFRobot do not supply (any of) these files.  What I find is that the example ino sketches they provide work fine, but when I copy their code into my own sketch, the linker can not. find the function code.

    3/. Using the BSEC Library I am unable to compile and link the supplied example sketches.

    It finds the Library base : ResolveLibrary(bsec.h)
    -> candidates: [BSEC_Software_Library@1.5.1474]

    But does not do anything when its time to comp.iole the code:
    Compiling libraries...
    Compiling library "BSEC_Software_Library"
    <should be stuff in here>
    Compiling library "Wire"
    So, when the linker tries to do its job, there are all sorts of undefined references :
    C:\Users\Bryn\AppData\Local\Temp\cclcFARp.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_basic.ino.cpp.o.2322':
    <artificial>:(.text.startup+0x74): undefined reference to `Bsec::Bsec()'
    C:\Users\Bryn\AppData\Local\Temp\cclcFARp.ltrans0.ltrans.o: In function `main':
    <artificial>:(.text.startup+0x242): undefined reference to `Bsec::delay_ms(unsigned long)'
    <artificial>:(.text.startup+0x244): undefined reference to `Bsec::delay_ms(unsigned long)'
    <artificial>:(.text.startup+0x250): undefined reference to `Bsec::begin(unsigned char, TwoWire&, void (*)(unsigned long))'
    <artificial>:(.text.startup+0x2fa): undefined reference to `Bsec::updateSubscription(bsec_virtual_sensor_t*, unsigned char, float)'
    <artificial>:(.text.startup+0x336): undefined reference to `Bsec::run(long long)'


    My best guess as to the cause is that the compiler and linker do not like the  folder layout supplied in the library.  

    Can you suggest ways in which I might change the layout and have it compile and link without error ??



    7 REPLIES 7
    Highlighted
    Community Moderator

    Re: BSEC Library for BME680 on Mega 2560

    #1 and #2 seem to be external libraries, unfortunately our library doesn't support custom sea level compensation therefore this might need to be done manually.

    The latest version of Arduino (currently 1.8.12) broke backward-compatibility with some existing libraries, including ours. Therefore the Arduino BSEC library and integration guide written and tested for 1.8.9 (see here) should be compatible with releases until 1.8.11.

    Highlighted
    Member

    Re: BSEC Library for BME680 on Mega 2560

    Yes, I included that information merely to indicate I tried a few things.

    Re Arduino CC, I will try the earlier version, thanks for the tipoff.

    Highlighted
    Member

    Re: BSEC Library for BME680 on Mega 2560

    I tried Arduino CC  both versions 1.8.10 and 1.8.9.  I uninstalled the prior version before installing the new version each time, followed by Windows restart.

    On both I found similar issues as previously reported eg.

    undefined reference to `bsec_init'
    undefined reference to `bsec_get_version'
    undefined reference to `bsec_update_subscription'
    undefined reference to `bsec_init'
    undefined reference to `bsec_set_state'
    undefined reference to `bsec_update_subscription'
    undefined reference to `bsec_sensor_control'
    undefined reference to `bsec_do_steps'
    undefined reference to `bsec_get_state'

    So, given what was said earlier  I suspect there is something further I need to do to get this working. 
    Maybe it is unreasonable for me to expect it to work out of the box.
    Are you able to offer any suggestions ?

    Cheers

    Tags (2)
    Highlighted
    Member

    Re: BSEC Library for BME680 on Mega 2560

    I think a key issue in debugging is whether I should see mentioned in the verbose output of the compiler the file libalgobsec.a

    Right now, I do not see it there, but I do see other archives (*.a) including the arduino precompiled core

    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