Compile errors making DeviceOS

I have followed the instructions to build the Device OS firmware as found here:

Once I issue the ‘make’ command I get the following errors:

MN-C02WG15DHTD7:modules dshie$ make clean all PLATFORM=photon -s program-dfu
/Users/dshie/Development/Particle/firmware/modules/photon/system-part1/makefile /Users/dshie/Development/Particle/firmware/modules/photon/system-part2/makefile /Users/dshie/Development/Particle/firmware/modules/photon/user-part/makefile
MCU/STM32F2xx/SPARK_Firmware_Driver/src/system_stm32f2xx.c: In function ‘SetSysClock’:
MCU/STM32F2xx/SPARK_Firmware_Driver/src/system_stm32f2xx.c:394:5: warning: this ‘while’ clause does not guard… [-Wmisleading-indentation]
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
MCU/STM32F2xx/SPARK_Firmware_Driver/src/system_stm32f2xx.c:395:5: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
In file included from …/wiring/inc/spark_wiring_thread.h:31:0,
from src/photon/socket_hal.cpp:35:
/Users/dshie/GCC-ARM/arm-none-eabi/include/c++/7.3.1/mutex: In member function ‘bool std::recursive_timed_mutex::_M_timedlock(const __gthread_time_t&)’:
/Users/dshie/GCC-ARM/arm-none-eabi/include/c++/7.3.1/mutex:292:17: error: ‘__gthread_recursive_mutex_timedlock’ was not declared in this scope
{ return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts); }
/Users/dshie/GCC-ARM/arm-none-eabi/include/c++/7.3.1/mutex:292:17: note: suggested alternative: ‘__gthread_recursive_mutex_trylock’
{ return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts); }
make[2]: *** […/build/target/hal/platform-6-m/./src/photon/socket_hal.o] Error 1
make[1]: *** [hal] Error 2
make: *** [/Users/dshie/Development/Particle/firmware/modules/photon/system-part1/makefile] Error 2
MN-C02WG15DHTD7:modules dshie$

This does not make sense as I would expect that code to be free of errors.

Any ideas to remedy?

The 7.3.1 version of the gcc-arm toolchain cannot be used.

The only supported version is 5.3.1 (5-2016-q1):


Great info. Thanks so much for helping out. Couple questions:

Just curious, what is the reason that the newer versions aren’t supported?


It is possible to use Eclipse with this version of the toolchain to build the firmware?

Upgrading the compiler requires:

  • Fixing any new warning or errors
  • Adjusting for code that changed size and no longer fits (primarily on the Photon)
  • Regression testing to make sure optimization didn’t break anything

Thus we don’t upgrade the compiler very often. The 5.3.1 version works fine with Eclipse; I use it.

Cool. Thanks so much.