I'm familiarizing myself with DA14585 IoT Multi Sensor Development Kit using Eclipse/GCC. I ran through steps in AN-B064 and successfully compiled and ran debugger with no problems.
我决定尝试和配置空气质量指数per instructions in UM-B-101 section 4.2.4. After defining IAQ_ENABLED I get the following errors:
C:/IoT_MSK/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:86: undefined reference to `bsec_init'
C:/IoT_MSK/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:99: undefined reference to `bsec_set_state'
C:/IoT_MSK/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:101: undefined reference to `bsec_init'
C:/IoT_MSK/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:117: undefined reference to `bsec_update_subscription'
./bsec_lib/user_iaq.o: In function `update_iaq':
C:/IoT_MSK/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:145: undefined reference to `bsec_sensor_control'
C:/IoT_MSK/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:169: undefined reference to `bsec_do_steps'
collect2.exe: error: ld returned 1 exit status
I'm guessing the linker doesn't know what to do with user_iaq.c. because everthing in it only exists when IAQ_ENABLED is defined.
Any ideas on how to fix this? I'm obviously new to Eclipse/GCC.
Thanks
Hi dsteury,
Thanks for your question online. Let me check it and try to replicate it, and I will get back to you as soon as possible.
Thanks, PM_Dialog
Hi dsteury,
Please read section 4.2.4 Configure for Air Quality Index from theUM-B-101: DA14585 IoT Multi Sensor Development Kit Developer Guidedocument.
The Bosch BSEC Library that computes the Air Quality Index (AQI) is not included in the default configuration (IAQ_ENABLED is undefined). If users would like to compile an image that includes this library, other features should be removed to gain the required memory space. For example, this could be accomplished with the following steps:
1. Remove the VCNL4010 proximity sensor and undefine VCNL4010_OPTO_SENSOR_AVAILABLE from da1458x_config_basic.h.
2.禁用“运动后”特性通过定义WAYS_ADVERTISE in user_app_iot_config.h. This also removes the low power configuration parts of ICM426xx driver.
3. Disable the fast accelerometer calibration and undefine ALWAYS_ USE_FAST_ACC_CAL in user_app_iot_config.h.
4. Build.
5.定义从da1458x_c IAQ_ENABLEDonfig_basic.h
6. Build again. The produced iot585.hex now includes the AQI feature.
Thanks, PM_Dialog
I did read section 4.2.4 Configure for Air Quality Index from UM-B-101 and I thought I followed the instructions correctly. Perhaps I missed something; so, I'll run through them again.
I deleted my entire SDK directory and re-extracted from zip file into C:\DA14585_IOTP_v6.160.4. Then I opened SmartSnippets, went into IDE (remember I'm using Eclipse/GCC) and reimported project so I can start from scratch. I built project, ran debugger and everything is working fine.
1. Remove the VCNL4010 proximity sensor and undefine VCNL4010_OPTO_SENSOR_AVAILABLE from da1458x_config_basic.h.
I'm not exactly sure what is meant by "Remove the VCNL4010". Does that mean I'm supposed to physically remove the part from the board, or am I supposed to delete the virtual folder vcnl4010 from the project, or does this mean something else? I'm not sure what to do; so, I'm not doing anything.
I am changing line 75 in da1458x_config_basic.h from this:
#define VCNL4010_OPTO_SENSOR_AVAILABLE
to this:
#undef VCNL4010_OPTO_SENSOR_AVAILABLE
Save file.
2.禁用“运动后”特性通过定义WAYS_ADVERTISE in user_app_iot_config.h. This also removes the low power configuration parts of ICM426xx driver.
I'm changing line 24 of user_app_iot_config.h from this:
#undef ALWAYS_ADVERTISE //Disables wake on motion feature
to this:
#define ALWAYS_ADVERTISE //Disables wake on motion feature
Save file.
3. Disable the fast accelerometer calibration and undefine ALWAYS_ USE_FAST_ACC_CAL in user_app_iot_config.h.
I searched user_app_iot_config.h for ALWAYS_ USE_FAST_ACC_CAL and it's not there; however, there is a USE_FAST_ACC_CAL (without the "ALWAYS_" in front), so I figure this is a typo and change line 41 from this:
#define USE_FAST_ACC_CAL
to this:
#undef USE_FAST_ACC_CAL
Save file.
4. Build.
I built, ran debugger, opened IoT Sensors and can see the proximity sensor is no longer working; so, I figure I've done everything ok up to this point.
5.定义从da1458x_c IAQ_ENABLEDonfig_basic.h
I'm changine line 88 of da1458x_config_basic.h from this:
#undef IAQ_ENABLED // Include the iAQ library, process gas data on board
to this:
#define IAQ_ENABLED // Include the iAQ library, process gas data on board
Save file.
6. Build again. The produced iot585.hex now includes the AQI feature.
I built again and I get 7 errors. When I open the console, here's what I see at the end of the window:
COLLECT_GCC_OPTIONS='-mcpu=cortex-m0' '-mthumb' '-Os' '-fmessage-length=0' '-fsigned-char' '-ffunction-sections' '-fdata-sections' '-g3' '-T' './ldscript_common.lds' '-L../../../../../../projects/target_apps/iot/common_iot_files/lib' '-L../../../../../../SDK_585/sdk/common_project_files/misc' '-L../../../../../../SDK_585/sdk/platform/system_library/output/GCC' '-specs=nano.specs' '-specs=nosys.specs' '-v' '-o' 'iot585.elf'
C:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin / lib / gcc / arm-none-eabi / 7.3.1 / collect2.exe -plugin c:/diasemi/smartsnippetsstudio2.0.10/GCC / 7-2018-Q2 / BIN / ... lib / gcc / arm-none-eabi / 7.3.1 / liblto_plugin-0.dll -plugin-opt = c:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2 / bin / bin / arm-none-eabi / 7.3.1 / lto-wrapper.exe -plugin-opt = -freesolution = c:\ david \ appdata \ local \ temp \ ccokcoya.res -plugin-opt = -pasp-tod = -lgcc -plugin-opt = -pass-tout = -lg_nano -plugin-opt = -pasp-tod = -lc_nano -plugin-opt = -pass-tout = -lgcc-plugin-opt = -pasp-opt = -lc_nano -plugin-opt = -pass-opt = -lnosys -plugin-opt = -lgcc-tod = -lgcc -plugin-opt = -pase-tout = -lc_nano -plugin-opt = -pass-tod = -lnosys - sysroot = c:\ diasemi \ smartsnippetsstudio2.0.10 \ gcc \ 7-2018-q2 \ bin \ ../ arm-none-eabi-x -o iot585.elf c:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crti.o c:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crtbegin.o c:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/crt0.o -L../../../../../../projects/target_apps/iot/common_iot_files/lib -L../../../../../../SDK_585/sdk/common_project_files/misc -L../../../../../../SDK_585/sdk/platform/system_library/output/GCC -Lc:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m -Lc:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m -Lc:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../arm-none-eabi/lib/thumb/v6-m -Lc:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1 -Lc:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc -Lc:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib -Lc:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../arm-none-eabi/lib --gc-sections -Map iot585.map --no-wchar-size-warning ./wkup_adapter/wkup_adapter.o ./vcnl4010/vcnl4010.o ./vcnl4010/vcnl4010_impl.o ./user_sfl/user_sfl_util.o ./user_sensors/user_sensor_config.o ./user_sensors/user_sensor_raw.o ./user_sensors/user_sensor_sfl.o ./user_sensors/user_sensors.o ./user_profiles/dws.o ./user_profiles/dws_task.o ./user_platform/i2c_gpio_extender.o ./user_platform/sensors_periph_interface.o ./user_platform/user_iot_dk_utils.o ./user_platform/user_periph_setup.o ./user_app/user_dws.o ./user_app/user_dws_reports.o ./user_app/user_dws_task.o ./user_app/user_iot.o ./sensors_interface/sensors_interface.o ./sensors_interface/sensors_interface_api.o ./sensor_calibration/basic_acc_cal.o ./sensor_calibration/basic_autocal.o ./sensor_calibration/basic_prox_cal.o ./sensor_calibration/sensor_calibration.o ./sensor_calibration/static_calibration.o ./sdk_profiles/attm_db_128.o ./sdk_profiles/bass.o ./sdk_profiles/bass_task.o ./sdk_profiles/custom_common.o ./sdk_profiles/diss.o ./sdk_profiles/diss_task.o ./sdk_profiles/prf.o ./sdk_profiles/prf_utils.o ./sdk_profiles/proxr.o ./sdk_profiles/proxr_task.o ./sdk_profiles/suotar.o ./sdk_profiles/suotar_task.o ./sdk_driver/adc.o ./sdk_driver/battery.o ./sdk_driver/gpio.o ./sdk_driver/hw_otpc.o ./sdk_driver/sky66111.o ./sdk_driver/spi.o ./sdk_driver/spi_flash.o ./sdk_driver/syscntl.o ./sdk_driver/systick.o ./sdk_driver/timer0.o ./sdk_driver/trng.o ./sdk_driver/uart2.o ./sdk_driver/wkupct_quadec.o ./sdk_boot/hardfault_handler.o ./sdk_boot/ivtable_DA14585_586.o ./sdk_boot/nmi_handler.o ./sdk_boot/startup_DA14585_586.o ./sdk_boot/system_DA14585_586.o ./sdk_ble/rf_585.o ./sdk_ble/rwble.o ./sdk_ble/rwip.o ./sdk_arch/arch_console.o ./sdk_arch/arch_main.o ./sdk_arch/arch_rom.o ./sdk_arch/arch_sleep.o ./sdk_arch/arch_system.o ./sdk_arch/jump_table.o ./sdk_arch/nvds.o ./sdk_app/app.o ./sdk_app/app_bass.o ./sdk_app/app_bass_task.o ./sdk_app/app_customs.o ./sdk_app/app_customs_common.o ./sdk_app/app_customs_task.o ./sdk_app/app_default_handlers.o ./sdk_app/app_diss.o ./sdk_app/app_diss_task.o ./sdk_app/app_easy_msg_utils.o ./sdk_app/app_easy_security.o ./sdk_app/app_easy_timer.o ./sdk_app/app_entry_point.o ./sdk_app/app_msg_utils.o ./sdk_app/app_proxr.o ./sdk_app/app_proxr_task.o ./sdk_app/app_security.o ./sdk_app/app_security_task.o ./sdk_app/app_suotar.o ./sdk_app/app_suotar_task.o ./sdk_app/app_task.o ./icm426xx/Icm426xxDriver.o ./icm426xx/Icm426xxDriver_HL.o ./icm426xx/Icm426xxTransport.o ./icm426xx/Icm426xx_impl.o ./driver_adaptation_layer/environmental_bme680.o ./driver_adaptation_layer/magneto_ak099.o ./driver_adaptation_layer/motion_bmi160.o ./driver_adaptation_layer/motion_icm4X6.o ./driver_adaptation_layer/optical_vcnl4010.o ./bsec_lib/user_iaq.o ./bmi160/bmi160.o ./bmi160/bmi160_impl.o ./bme680/bme680.o ./bme680/bme680_impl.o ./ak09915/ak09915.o ./ak09915/ak09915_impl.o -lsystem_library -lsensor_fusion -lsensor_calibration --start-group -lgcc -lg_nano -lc_nano --end-group --start-group -lgcc -lc_nano -lnosys --end-group --start-group -lgcc -lc_nano -lnosys --end-group c:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crtend.o c:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crtn.o -T ./ldscript_common.lds
./bsec_lib/user_iaq.o: In function `init_iaq':
C:/DA14585_IOTP_v6.160.4/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:86: undefined reference to `bsec_init'
C:/DA14585_IOTP_v6.160.4/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:99: undefined reference to `bsec_set_state'
C:/DA14585_IOTP_v6.160.4/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:101: undefined reference to `bsec_init'
C:/DA14585_IOTP_v6.160.4/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:117: undefined reference to `bsec_update_subscription'
./bsec_lib/user_iaq.o: In function `update_iaq':
C:/DA14585_IOTP_v6.160.4/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:145: undefined reference to `bsec_sensor_control'
C:/DA14585_IOTP_v6.160.4/DA14585_IOTP/v6.160.4/projects/target_apps/common/lib/bsec/user_iaq.c:169: undefined reference to `bsec_do_steps'
collect2.exe: error: ld returned 1 exit status
make: *** [iot585.elf] Error 1
10:41:19 Build Finished (took 1m:49s.426ms)
Please let me know if I'm doing something wrong.
Thanks
Hi dsteury,
My apologies for the delay. I got feedback from the Team. Unfortunately, Bosch library has big memory demands in the GCC project. As a result, it is not possible to enable the Air Quality Configuration in GCC based project.
Thanks, PM_Dialog
Thanks for the reply.
These steps essentially reduced the code size so that the Air Quality Index code would fit when compiling with Keil. I guess GCC isn't as efficient as Keil when it comes to optimization (I don't know because I don't have access to Keil), but this doesn't really answer the question as to why there are a bunch of undefined references to bsec_init, bsec_set_state, bsec_update_subscription, bec_sensor_control and bsec_do_steps.
I did some more digging and it looks like these functions exist in a library called libalgobsec_full.lib, which is in the same directory as user_iaq.c. I went through some pain trying to get GCC to use this library. In the end, I figured it out, but I came to the same conclusion that this code won't fit in the part. In theory, I think more code for the other sensors could be ripped out to make the Air Quality Index work, but I'm not really sure.
I'm including steps I used to get GCC to use the library so that others won't have to figure it out the hard way (like I did).
The linker is already looking for some libraries in /projects/target_apps/iot/common_iot_files/lib. I was able to get the linker to find this library by doing the following steps:
1. Copy libalgobsec_full.lib in /projects/target_apps/common/lib/bsec to /projects/target_apps/iot/common_iot_files
2.Rename the '.lib' extension to '.a' so that file name is 'libalgobsec_full.a' (I noticed the other libraries in this directory had .a versions. When I did a file compare, I noticed the contents of the .lib and .a versions are the same.)
3. In Eclipse right click iot585 project, Properties, C/C++ General, Paths and Symbols, then under Libraries tab Add 'algobsec_full' (do not use 'libalgobsec', make sure the don't include the 'lib' in front)
4. Make sure you define IAQ_ENABLED from step 5 above.
5.Build
Linker should not complain about undefined references to functions above, but now a whole bunch of different errors appear starting with:
c:/diasemi/smartsnippetsstudio2.0.10/gcc/7-2018-q2/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: iot585.elf section `i.bsec_GasHumidityBaselineTracker_isBaselineAllowedAdapt' will not fit in region `LR_IROM3'
Hi dsteury,
Many thanks for your indications and glad that you are able to reduce the code size.
Thanks, PM_Dialog