Linking error BME280 sensor

Hello,

When linking the official Ruuvi firmware example as it is downloaded, an error related to multiple definition of BME280_Mode_t is preventing the example from moving ahead. IDE is Segger. Any hint on what could be the cause is welcome. IDE is Segger.

Thanks in advance.

Output as follows:
Linking Rev0.6 working.elf
Output/Rev0.6 working Debug/Obj/bme280.o:(.bss.BME280_Mode_t+0x0): multiple definition of BME280_Mode_t' (.bss.BME280_Mode_t+0x0): first defined here Output/Rev0.6 working Debug/Obj/bme280_temperature_handler.o:(.bss.BME280_Mode_t+0x0): multiple definition ofBME280_Mode_t’
C:\Users\20006061\Documents\SEGGER Embedded Studio for ARM Projects\PlanB/main.c:289: first defined here
Output/Rev0.6 working Debug/Obj/init.o:(.bss.BME280_Mode_t+0x0): multiple definition of BME280_Mode_t' C:\Users\20006061\Documents\SEGGER Embedded Studio for ARM Projects\PlanB/main.c:289: first defined here Output/Rev0.6 working Debug/Obj/sensortag.o:(.bss.BME280_Mode_t+0x0): multiple definition ofBME280_Mode_t’
C:\Users\20006061\Documents\SEGGER Embedded Studio for ARM Projects\PlanB/main.c:289: first defined here
Output/Debug/Exe/Rev0.6 working.elf section .fs_data' will not fit in regionUNPLACED_SECTIONS’
region UNPLACED_SECTIONS' overflowed by 4128 bytes Output/Rev0.6 working Debug/Obj/fstorage.o: In functioncheck_config’:
undefined reference to __start_fs_data' undefined reference to__stop_fs_data’
Output/Rev0.6 working Debug/Obj/fstorage.o: In function fs_init': undefined reference to__stop_fs_data’
undefined reference to `__start_fs_data’
Build failed

Hello,

I’ve no experience with the SES, but you can probably just delete the bme280_temperature_handler.c

Hello again.

Have applied “Exclude from Build” option of Segger on bme280_temperature_handler.c file. The .c file was excluded from build and now the linking process complaints on “bme280.o” (as before), “sensortag.o” (as before) and “init.o” (new complaint). Output as follows:

Generating linker script ‘Rev0.7 working.ld’
Linking Rev0.7 working.elf
Output/Rev0.7 working Debug/Obj/bme280.o:(.bss.BME280_Mode_t+0x0): multiple definition of BME280_Mode_t' (.bss.BME280_Mode_t+0x0): first defined here Output/Rev0.7 working Debug/Obj/init.o:(.bss.BME280_Mode_t+0x0): multiple definition ofBME280_Mode_t’
C:\Users\20006061\Documents\SEGGER Embedded Studio for ARM Projects\PlanB/main.c:289: first defined here
Output/Rev0.7 working Debug/Obj/sensortag.o:(.bss.BME280_Mode_t+0x0): multiple definition of BME280_Mode_t' C:\Users\20006061\Documents\SEGGER Embedded Studio for ARM Projects\PlanB/main.c:289: first defined here Output/Debug/Exe/Rev0.7 working.elf section.fs_data’ will not fit in region UNPLACED_SECTIONS' regionUNPLACED_SECTIONS’ overflowed by 4128 bytes
Output/Rev0.7 working Debug/Obj/init.o: In function init_bme280': undefined reference tobme280_temperature_handler’
Output/Rev0.7 working Debug/Obj/fstorage.o: In function check_config': undefined reference to__start_fs_data’
undefined reference to __stop_fs_data' Output/Rev0.7 working Debug/Obj/fstorage.o: In functionfs_init’:
undefined reference to __stop_fs_data' undefined reference to__start_fs_data’
Build failed

On top of that I excluded “sensortag.c” from build. Complaints against bme280.o and init.o still persistent. Output as follows:

Generating linker script ‘Rev0.7 working.ld’
Linking Rev0.7 working.elf
Output/Rev0.7 working Debug/Obj/bme280.o:(.bss.BME280_Mode_t+0x0): multiple definition of BME280_Mode_t' (.bss.BME280_Mode_t+0x0): first defined here Output/Rev0.7 working Debug/Obj/init.o:(.bss.BME280_Mode_t+0x0): multiple definition ofBME280_Mode_t’
C:\Users\20006061\Documents\SEGGER Embedded Studio for ARM Projects\PlanB/main.c:289: first defined here
Output/Debug/Exe/Rev0.7 working.elf section .fs_data' will not fit in regionUNPLACED_SECTIONS’
region UNPLACED_SECTIONS' overflowed by 4128 bytes Output/Rev0.7 working Debug/Obj/main.o: In functionmain_timer_handler’:
undefined reference to parseSensorData' undefined reference toencodeToRawFormat5’
undefined reference to encodeToUrlDataFromat' Output/Rev0.7 working Debug/Obj/init.o: In functioninit_bme280’:
undefined reference to bme280_temperature_handler' Output/Rev0.7 working Debug/Obj/fstorage.o: In functioncheck_config’:
undefined reference to __start_fs_data' undefined reference to__stop_fs_data’
Output/Rev0.7 working Debug/Obj/fstorage.o: In function fs_init': undefined reference to__stop_fs_data’
undefined reference to `__start_fs_data’
Build failed

Lastly, init.c was removed.Complaint against bme280.o is still persistent whilst a number of new complaints related to init.c references came up. Therefore, init.c may not be excluded from build, but, most important, complaint against bme280.o remains. Output as follows:

Generating linker script ‘Rev0.7 working.ld’
Linking Rev0.7 working.elf
Output/Rev0.7 working Debug/Obj/bme280.o:(.bss.BME280_Mode_t+0x0): multiple definition of BME280_Mode_t' (.bss.BME280_Mode_t+0x0): first defined here Output/Rev0.7 working Debug/Obj/main.o: In functionreinit_nfc’:
undefined reference to init_nfc' Output/Rev0.7 working Debug/Obj/main.o: In functionmain_timer_handler’:
undefined reference to parseSensorData' undefined reference toencodeToRawFormat5’
undefined reference to encodeToUrlDataFromat' Output/Rev0.7 working Debug/Obj/main.o: In functionmain’:
undefined reference to init_log' undefined reference toinit_leds’
undefined reference to init_nfc' undefined reference toinit_sensors’
undefined reference to init_ble' undefined reference toinit_timer’
undefined reference to init_blink_status' undefined reference toinit_watchdog’
Build failed

Whilst I still analyze the problem from other angles, any help is greatly appreciated.

thanks.

Hello,

I’ll look into SES support next week

Thanks again, look forward to that. Further information of the build as follows:

Nordic SDK - nRF5_SDK_12.3.0_d7731ad
Softdevice - s132_nrf52_2.0.1
Ruuvi - ruuvitag_fw-2.2.2

Hello,

I have not yet solved the issue. However, I just tried to change the name of the declared list BME280_Mode_t on file BME280.h provided by Ruuvi to something else and unique (line 50) as follows:

enum BME280_MODE {
BME280_MODE_SLEEP = 0x00,
BME280_MODE_FORCED = 0x01,
BME280_MODE_NORMAL = 0x03
} BME280_Mode_ttx;

Problem has persisted! Output as follows:

Output/ruuvitag_fw-master Rev0.1.1 working Debug/Obj/init.o:(.bss.BME280_Mode_ttx+0x0): multiple definition of `BME280_Mode_ttx’

Regards,

Hello,

I found the reason for BME_Mode_t linker error:
the enum is not typedef’d so it gets compiled into global namespace for each include of the header file.

This was fixed by making it typedef.
The project now compiles on SES, but I’ve some concerns about the memory placement and linker script. Also I’ve not come up with a way to generate a full softdevice+bootloader+application package on the IDE, so right now any debugging is run without bootloader in flash. It should be possible to generate the final image with the .hex produced by SES though.

The code is available now on branch feature-ses-support, but I’ve not tried actually running it on a RuuviTag yet.

Thanks for the update.

By making just typedef enum BME280_MODE, I want to believe we are at same page, as I now got just warning messages, as follows:

Linking ruuvitag_fw-master Rev0.3 working.elf
memory region FLASH' not declared memory regionRAM’ not declared
cannot find entry symbol reset_handler; not setting start address
Build failed

Thanks for comment. In the meantime, will check updates on GitHub as indicated.

Thanks again for fixing the issue!

Hello,

I got the RuuviTag_FW running with SES, there was quite a bit of more work to do with the memory region placements etc. I’ve not yet tried creating a full package with softdevice, bootloader and application, but it seems that the project runs fine.

One tricky part was that you’ll need to enable printf width/precision support in in project settings. There is a quite active thread about SES in Ruuvi Slack, please join in the discussion at slack.ruuvi.com

Hello,

Please give us more details. which Ruuvi code you’re working with? Are you using SES or ARMGCC? Is your code online somewhere?