Skip to content

[Workaround] Library uncompilable for mbed 5 platformIO because of yield() function #17

@maxgerhardt

Description

@maxgerhardt

Your code reads

https://github.com/davetcc/TaskManagerIO/blob/2840e53c91f4184497180c27c8bbafc851fdc10c/src/TaskManagerIO.cpp#L410-L412

However, this throws the error message

.pio\libdeps\disco_f051r8\TaskManagerIO\src\TaskManagerIO.cpp:404:5: error: 'ThisThread' has not been declared
  404 |     ThisThread::yield();
      |     ^~~~~~~~~~
*** [.pio\build\disco_f051r8\libca9\TaskManagerIO\TaskManagerIO.o] Error 1

and is fixed by explicitily including rtos/rtos.h and using rtos::ThisThread::yield();.

#include <rtos/rtos.h>
void yield() {
    //ThisThread::yield();
    rtos::ThisThread::yield();
}

The platformio.ini used here is

[env:disco_f051r8]
platform = ststm32
board = disco_f051r8
framework = mbed
lib_deps = 
    davetcc/LiquidCrystalIO @ ^1.4.0
    davetcc/IoAbstraction @ ^1.6.4

With the current versions of all platform that's using mbed-os 5.15.4. On the other hand, this compiles fine for the L476RG board which uses mbed 6.2.0. So I'm not entirely sure on what the correct fix here is, but primarily leaving this issue in case someone runs in the same compile error.

See reference project at https://github.com/maxgerhardt/pio-mbed-i2c-lcd-example/.

Metadata

Metadata

Assignees

Labels

instructionalIt documents a problem that is outside of our scope

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions