Problems with rtos on mbed / stm32


I have problems compiling an mqtt example working fine on the mbed ide but not on platform io

I get the following errors:

ret = sock.connect("",1883);
In file included from src\main.cpp:4:0:
lib\MQTT/MQTTClient.h: In instantiation of 'int MQTT::Client<Network, Timer, MAX_MQTT_PACKET_SIZE, MAX_MESSAGE_HANDLERS>::yield(long unsigned int) [with Network = MQTTSocket; Timer = Countdown; int MAX_MQ

src\main.cpp:103:29:   required from here
lib\MQTT/MQTTClient.h:507:25: error: use of deleted function 'Countdown::Countdown(Countdown&&)'
Timer timer = Timer();
In file included from lib\MQTT/MQTTSocket.h:4:0,
from src\main.cpp:3:
lib\MQTT/MQTTmbed.h:6:7: note: 'Countdown::Countdown(Countdown&&)' is implicitly deleted because the default definition would be ill-formed:
class Countdown
lib\MQTT/MQTTmbed.h:6:7: error: use of deleted function 'mbed::Timer::Timer(const mbed::Timer&)'
In file included from C:\Users\cmeinert\.platformio\packages\framework-mbed/mbed.h:93:0,
from src\main.cpp:1:
C:\Users\cmeinert\.platformio\packages\framework-mbed/drivers/Timer.h:51:7: note: 'mbed::Timer::Timer(const mbed::Timer&)' is implicitly deleted because the default definition would be ill-formed:
class Timer : private NonCopyable<Timer> {
C:\Users\cmeinert\.platformio\packages\framework-mbed/drivers/Timer.h:51:7: error: 'mbed::NonCopyable<T>::NonCopyable(const mbed::NonCopyable<T>&) [with T = mbed::Timer]' is private within this context
In file included from C:\Users\cmeinert\.platformio\packages\framework-mbed/rtos/Thread.h:31:0,
from C:\Users\cmeinert\.platformio\packages\framework-mbed/rtos/rtos.h:29,
from C:\Users\cmeinert\.platformio\packages\framework-mbed/mbed.h:38,
from src\main.cpp:1:
C:\Users\cmeinert\.platformio\packages\framework-mbed/platform/NonCopyable.h:157:5: note: declared private here
NonCopyable(const NonCopyable&);
*** [.pioenvs\nucleo_l476rg\src\main.o] Error 1

Any Ideas? All hints highly apriciated.

Could you provide source code to reproduce this issue?


hope this works, I ziped the Atom project folder:

Project Folder

Thank you for your help,


Any results … I need urgently a solution to use MQTT together with a W5500 on STM32.
Tried may librarians and examples but allways have problems with the necessary rtos part during compilation. Thank you for your help.


I just removed the following define from platformio.ini file:

and compiled your code successfully with command pio run:

Calculating size .pioenvs/nucleo_l476rg/firmware.elf
text	   data	    bss	    dec	    hex	filename
76808	   2536	   1708	  81052	  13c9c	.pioenvs/nucleo_l476rg/firmware.elf

But even with -D PIO_FRAMEWORK_MBED_RTOS_PRESENT I do not see same errors like you:

.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/softfp/crt0.o: In function `_start':
(.text+0x4a): undefined reference to `__wrap_main'
.pioenvs/nucleo_l476rg/FrameworkMbedCore/drivers/SPI.o: In function `mbed::SPI::lock()':
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x10): undefined reference to `osMutexAcquire'
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x1c): undefined reference to `rtos::Mutex::Mutex()'
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x24): undefined reference to `osMutexRelease'
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x3c): undefined reference to `singleton_mutex_id'
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x32): undefined reference to `rtos::Mutex::lock(unsigned long)'
.pioenvs/nucleo_l476rg/FrameworkMbedCore/drivers/SPI.o: In function `mbed::SPI::unlock()':
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x10): undefined reference to `osMutexAcquire'
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x1c): undefined reference to `rtos::Mutex::Mutex()'
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x24): undefined reference to `osMutexRelease'
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x38): undefined reference to `singleton_mutex_id'
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x2e): undefined reference to `rtos::Mutex::unlock()'
.pioenvs/nucleo_l476rg/FrameworkMbedCore/platform/mbed_wait_api_rtos.o: In function `wait_us':
mbed_wait_api_rtos.cpp:(.text.wait_us+0x36): undefined reference to `rtos::Thread::wait(unsigned long)'


these is the result of pio update:

PS C:\Users\cmeinert\ownCloud\Unsere Dokumente\Projekte\Spiegelwand\MQTT> pio update

Updating tool-scons                      @ 3.20501.2      [Up-to-date]
Updating tool-unity                      @ 1.20302.1      [Up-to-date]
Updating contrib-pysite                  @ 0.1.4          [Up-to-date]
Updating contrib-piohome                 @ 0.6.1          [Up-to-date]
Updating tool-pioplus                    @ 0.13.4         [Up-to-date]

Platform Manager
Platform ST STM32
Updating ststm32                         @ 3.8.0          [Up-to-date]
Updating tool-stm32duino                 @ 1.0.0          [Up-to-date]
Updating framework-mbed                  @ 4.50701.0      [Up-to-date]
Updating toolchain-gccarmnoneeabi        @ 1.40804.0      [Up-to-date]
Updating tool-stlink                     @ 1.10301.0      [Up-to-date]

After this I get the following Error during pio run:

rrException in thread Thread-3:
Traceback (most recent call last):
  File "C:\Python27\Lib\", line 801, in __bootstrap_inner
  File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\", line 92, in run
  File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\managers\", line 396, in on_run_err
    self._echo_line(line, level=3 if is_error else 2)
  File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\managers\", line 413, in _echo_line
    click.secho(line, fg=fg, err=level > 1)

  File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\", line 114, in <lambda>
    click.secho = lambda *args, **kwargs: _safe_echo(1, *args, **kwargs)
  File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\", line 111, in _safe_echo
    sys.stdout.write)("%s\n" % (args[0] if args else ""))
IOError: [Errno 0] Error

and then it stop (no further response) after the last line (WIZnetInterface.o)

Compiling .pioenvs\nucleo_l476rg\libac8\WIZnetInterface\Socket.o
Compiling .pioenvs\nucleo_l476rg\libac8\WIZnetInterface\TCPSocketConnection.o
Compiling .pioenvs\nucleo_l476rg\libac8\WIZnetInterface\TCPSocketServer.o
Compiling .pioenvs\nucleo_l476rg\libac8\WIZnetInterface\UDPSocket.o
Compiling .pioenvs\nucleo_l476rg\libac8\WIZnetInterface\W5100.o
Compiling .pioenvs\nucleo_l476rg\libac8\WIZnetInterface\W5200.o
Compiling .pioenvs\nucleo_l476rg\libac8\WIZnetInterface\W5500.o
Compiling .pioenvs\nucleo_l476rg\libac8\WIZnetInterface\WIZnetInterface.o

Anything messed up with my PlatformIO / Atom installation? What is the best way to clean reinstall Atom/PlatformIO?

Thank you again for your help.


> pio update
Updating tool-scons                      @ 3.30001.0      [Up-to-date]
Updating tool-unity                      @ 1.20302.1      [Up-to-date]
Updating contrib-piohome                 @ 0.6.1          [Up-to-date]
Updating tool-pioplus                    @ 0.13.4         [Up-to-date]
Platform Manager
Platform ST STM32
Updating ststm32                         @ 3.8.0          [Up-to-date]
Updating framework-mbed                  @ 4.50701.0      [Up-to-date]

> pio run
PackageManager: Installing toolchain-gccarmnoneeabi @ >=1.60301.0

After this everything is the same as in my last reply.

I don’t know exact locations on Windows.
Try to delete .platformio from your user profile directory to clean up all installed frameworks, toolchains etc

Try one of these solutions to install package: