Compiling code for Core fails, does not fail if compiling for Photon

Building target: target/workspace.elf
Invoking: ARM GCC C++ Linker
mkdir -p target/
arm-none-eabi-g++ -DSTM32_DEVICE -DSTM32F10X_MD -DPLATFORM_THREADING=0 -DPLATFOR
M_ID=0 -DPLATFORM_NAME=core -DUSBD_VID_SPARK=0x1D50 -DUSBD_PID_DFU=0x607F -DUSBD
_PID_CDC=0x607D -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -flto -DINCLUDE_PLATFO
RM=1 -DPRODUCT_ID=0 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDF
U_BUILD_ENABLE -DSYSTEM_VERSION_STRING=0.6.2 -DRELEASE_BUILD -Werror -I../user/i
nc -I../wiring/inc -I../hal/inc -I../hal/shared -I../hal/src/core -I../hal/src/s
tm32 -I../system/inc -I../services/inc -I../communication/src -I../platform/shar
ed/inc -I../platform/MCU/STM32F1xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/
STM32F1xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F1xx/SPARK_Firmware
_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F1xx/CMSIS
/Include -I../platform/MCU/STM32F1xx/CMSIS/Device/ST/Include -I../platform/NET/C
C3000/CC3000_Host_Driver -I../dynalib/inc -I. -MD -MP -MF target/workspace.elf.d
 -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-dec
larations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -DSTART
_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DMODU
LE_VERSION=0 -DMODULE_FUNCTION=3 -DMODULE_DEPENDENCY=0,0,0 -D_WINSOCK_H -D_GNU_S
OURCE target/obj/./src/module_info.o  target/obj/startup/startup_stm32f10x_md.o
--output target/workspace.elf -nostartfiles -Xlinker --gc-sections -flto -Os -fu
se-linker-plugin -Tlinker_stm32f10x_md_dfu.ld -L../build/arm/linker --specs=nano
.specs -lc -lnosys -u _printf_float -Wl,-Map,target/workspace.map  -L../build/ta
rget/user/platform-0-lto -L../build/target/wiring/platform-0-lto/ -L../build/tar
get/system/platform-0-lto/ -L../build/target/services/platform-0-lto/ -L../build
/target/communication/platform-0-lto-prod-0/ -L../build/target/hal/platform-0-lt
o/ -L../build/target/platform/platform-0-lto/ -L../build/target/wiring_globals/p
latform-0-lto/ -L../build/target/newlib_nano/platform-0-lto -L../build/arm/linke
r -Wl,--whole-archive -lnewlib_nano -luser -lwiring -lhal -lsystem -lservices -l
communication -lplatform -lwiring_globals -Wl,--no-whole-archive
/tmp/ccHSquKY.ltrans1.ltrans.o: In function `Timer::invoke_timer(void*) [clone .
local.578]':
/firmware/main/../wiring/inc/spark_wiring_timer.h:119: undefined reference to `o
s_timer_get_id'
/tmp/ccHSquKY.ltrans6.ltrans.o: In function `_stop':
/firmware/main/../wiring/inc/spark_wiring_timer.h:71: undefined reference to `os
_timer_change'
/tmp/ccHSquKY.ltrans8.ltrans.o: In function `dispose':
/firmware/main/../wiring/inc/spark_wiring_timer.h:92: undefined reference to `os
_timer_destroy'
/tmp/ccHSquKY.ltrans12.ltrans.o: In function `__base_ctor ':
/firmware/main/../wiring/inc/spark_wiring_timer.h:34: undefined reference to `os
_timer_create'
/tmp/ccHSquKY.ltrans22.ltrans.o: In function `_start':
/firmware/main/../wiring/inc/spark_wiring_timer.h:66: undefined reference to `os
_timer_change'
collect2: error: ld returned 1 exit status
../build/module.mk:222: recipe for target 'target/workspace.elf' failed
make: *** [target/workspace.elf] Error 1

Any ideas what might be causing this and any workarounds?

Thanks

Are you trying to run Software Timers on a Core?
If so ou may want to look at this
https://build.particle.io/libs/freertos4core/0.2.0/tab/example/timers.ino

Thanks was just coming here to post I’ve installed that library and seems to compile OK now. Thanks

1 Like

I too having the same problem. May I know from where you got the library file and how you installed.

What’s wrong with the link I posted?

I got it from the link ScruffR posted (but you need to find the source code and download, not the example)

The link I provided also features a GitHub link to the sources, but IIRC you just need to #include the library respective headers since the actual implementations are part of the Particle framework.

Thanks daneboomer and ScruffR for your reply. I went through it and I’ve included those header files and I got the result. Thanks guys for your kind help.