Bosch Sensortec Community

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

    Compile issue with bsec_iot_example

    Highlighted
    New Poster

    Compile issue with bsec_iot_example

    Hello community,

    I am trying to compile and run the bsec_iot_example BME680 on an ESP32 chip using Arduino IDE. However, I'm getting this compilation error:

    sketch\bsec_integration.c: In function 'bme680_bsec_update_subscription':

    bsec_integration.c:122:46: error: 'BSEC_OUTPUT_IAQ_ESTIMATE' undeclared (first use in this function)

    requested_virtual_sensors[0].sensor_id = BSEC_OUTPUT_IAQ_ESTIMATE;

    ^

    sketch\bsec_integration.c:122:46: note: each undeclared identifier is reported only once for each function it appears in

    sketch\bsec_integration.c: In function 'bme680_bsec_process_data':

    bsec_integration.c:404:22: error: 'BSEC_OUTPUT_IAQ_ESTIMATE' undeclared (first use in this function)

    case BSEC_OUTPUT_IAQ_ESTIMATE:

    ^

    exit status 1
    'BSEC_OUTPUT_IAQ_ESTIMATE' undeclared (first use in this function)

     

    Initially, I was able to run the same project on an ESP8266 chip successfully by following the manual BST-BME680-Integration guide. To compile it for esp32 I simply replaced libalgobsec.a, bsec_datatypes.h and bsec_interface.h files with their equivalents for esp32 chip which I found them in BSEC zip file in the directory "bsec_1-4-7-4_generic_release\BSEC_1.4.7.4_Generic_Release\algo\normal_version\bin\esp32"

    Attached is the list of files in the project directory. 

    any idea what could be wrong?

     

    Regards,

    Sina

     

     

     

    3 REPLIES 3
    Highlighted
    Community Moderator

    Re: Compile issue with bsec_iot_example

    It seems like your project includes a mix of old and new code. 'BSEC_OUTPUT_IAQ_ESTIMATE' is an old name, which became 'BSEC_OUTPUT_IAQ' in the meantime (at least it is the case now in BSEC v1.4.7.4). It is likely that you have to update a bit more code in your project, maybe also bsec_integration.c/.h?

    Highlighted
    New Poster

    Re: Compile issue with bsec_iot_example

    Hi 

    Thank you for the comment. As you said I updated the library and it solved the "BSEC_OUTPUT_IAQ_ESTIMATE" issue. However, now I'm getting a different error. It seems the compiler cannot find the declaration of the functions in bsec_integration.h, despite the fact that it is included in the main project file. should I set something in the Arduino IDE?

    Here is the list of errors:

    Arduino: 1.8.11 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

    bsec_iot_example:145:25: error: ambiguating new declaration of 'void sleep(uint32_t)'

    void sleep(uint32_t t_ms)

    ^

    In file included from C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/stdio.h:29:0,

    from C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:27,

    from sketch\bsec_iot_example.ino.cpp:1:

    C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/sys/unistd.h:185:10: note: old declaration 'unsigned int sleep(unsigned int)'

    unsigned _EXFUN(sleep, (unsigned int __seconds ));

    ^

    E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino: In function 'void sleep(uint32_t)':

    bsec_iot_example:145:25: error: ambiguating new declaration of 'void sleep(uint32_t)'

    void sleep(uint32_t t_ms)

    ^

    In file included from C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/stdio.h:29:0,

    from C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:27,

    from sketch\bsec_iot_example.ino.cpp:1:

    C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/sys/unistd.h:185:10: note: old declaration 'unsigned int sleep(unsigned int)'

    unsigned _EXFUN(sleep, (unsigned int __seconds ));

    ^

    E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino: In function 'void setup()':

    bsec_iot_example:261:103: error: invalid conversion from 'unsigned int (*)(unsigned int)' to 'sleep_fct {aka void (*)(unsigned int)}' [-fpermissive]

    ret = bsec_iot_init(BSEC_SAMPLE_RATE_LP, 0.0f, bus_write, bus_read, sleep, state_load, config_load);

    ^

    In file included from E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino:78:0:

    sketch\bsec_integration.h:141:20: note: initializing argument 5 of 'return_values_init bsec_iot_init(float, float, bme680_com_fptr_t, bme680_com_fptr_t, sleep_fct, state_load_fct, config_load_fct)'

    return_values_init bsec_iot_init(float sample_rate, float temperature_offset, bme680_com_fptr_t bus_write, bme680_com_fptr_t bus_read,

    ^

    bsec_iot_example:277:75: error: invalid conversion from 'unsigned int (*)(unsigned int)' to 'sleep_fct {aka void (*)(unsigned int)}' [-fpermissive]

    bsec_iot_loop(sleep, get_timestamp_us, output_ready, state_save, 10000);

    ^

    In file included from E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino:78:0:

    sketch\bsec_integration.h:155:6: note: initializing argument 1 of 'void bsec_iot_loop(sleep_fct, get_timestamp_us_fct, output_ready_fct, state_save_fct, uint32_t)'

    void bsec_iot_loop(sleep_fct sleep, get_timestamp_us_fct get_timestamp_us, output_ready_fct output_ready,

    ^

    bsec_iot_example:277:75: error: invalid conversion from 'void (*)(int64_t, float, uint8_t, float, float, float, float, float, float, bsec_library_return_t) {aka void (*)(long long int, float, unsigned char, float, float, float, float, float, float, bsec_library_return_t)}' to 'output_ready_fct {aka void (*)(long long int, float, unsigned char, float, float, float, float, float, float, bsec_library_return_t, float, float, float)}' [-fpermissive]

    bsec_iot_loop(sleep, get_timestamp_us, output_ready, state_save, 10000);

    ^

    In file included from E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino:78:0:

    sketch\bsec_integration.h:155:6: note: initializing argument 3 of 'void bsec_iot_loop(sleep_fct, get_timestamp_us_fct, output_ready_fct, state_save_fct, uint32_t)'

    void bsec_iot_loop(sleep_fct sleep, get_timestamp_us_fct get_timestamp_us, output_ready_fct output_ready,

    ^

    exit status 1
    ambiguating new declaration of 'void sleep(uint32_t)'

    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.

     

    Community Moderator

    Re: Compile issue with bsec_iot_example

    There error indicated is error: ambiguating new declaration of 'void sleep(uint32_t)'. This means the sleep() function in bsec_iot_example has the same name as a function in the ESP32 toolchain, which is not permitted. This could be solvable by renaming the sleep function in bsec_iot_example, for example into "delay_ms" or similar. Note that if you are using the Arduino IDE, we also have an Arduino library available for the BME680+BSEC.

    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