Skip to content

Handling no RTOS is done wrong #9133

@embeddedteam103

Description

@embeddedteam103

Description

This is a very annoying little bug:
In certain in mbed there is conditioning on whether rtos is present or not (or any other module). The problem is that in many place the conditional to check for it is wrong (which causes a compile time error).
The check should be

#if MBED_CONF_RTOS_PRESENT
....
#endif

But in many places it is defined as #ifdef or #if defined() which give the wrong result.

The way to remove rtos or anything else optional in mbed (the way I understand it, maybe I'm wrong) is to have an mbed_app.json file and have there module-name : {present: "0"} that overrides the defaulted "1" value.
When we do this - the macro MBED_CONF_RTOS_PRESENT is defined to be zero and therefore the tests for it should be the value and not if it is defined.
I see https://github.com/ARMmbed/mbed-os/pull/8957/files which encounters a similar problem.

Some of the files affected (we used a number of regex searches in mbed 5.8.3 with some modules missing to produce the list, so it might not be complete):

  • events\mbed_shared_queues.h
  • events\mbed_shared_queues.cpp
  • events\equeue\equeue_platform.h
  • events\equeue\equeue_mbed.cpp
  • platform\mbed_retarget.cpp
  • platform\mbed_sdk_boot.cpp
  • platform\Platformmutex.h
  • platform\SingletonPtr.h
  • platform\mbed_poll.cpp
  • platform\mbed_wait_api_rtos.cpp

Issue request type

[ ] Question
[ ] Enhancement
[x] Bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions