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
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.
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:
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.
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.
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