cancel
Showing results for 
Search instead for 
Did you mean: 

Resource Library

Cypress Support for Mbed OS 6.0

Employee

Cypress Support for Mbed OS 6.0

Arm just introduced Mbed OS 6. The new OS runs perfectly on Cypress' Mbed-Enabled boards and you should feel free to try it out with the standard examples (ARMmbed/mbed-os-example-*).

However, Mbed OS 6 removes a small number deprecated API functions that are used in Cypress Code Examples (cypresssemiconductorco/mbed-os-example-*). There are three types of impacted API:

  • TCPServer class is replaced by TCPSocket
  • char* IP address function arguments now use SocketAddress type
  • wait() and wait_for() functions are replaced by ThisThread::sleep_for()

As a result, most of the Cypress-hosted examples will fail to build without modifying the source code. Cypress remains fully committed to supporting Mbed OS and we shall be updating the examples in due course. Until the examples are updated, however, we recommend using Mbed OS v5.15.x for production builds or if your project is nearing completion.

UPDATE on October 25th: All impacted libraries and examples have been updated to support Mbed OS 6. We now recommend Mbed OS6.x for production with PSoC 6 devices.

A full list of deprecated API functions is available in Mbed OS Reference | Deprecated List. The ones used in Cypress examples are as follows:

File
Deprecated API
New Usage
features/netsocket/NetworkInterface.hvirtual const char *get_ip_address();virtual nsapi_error_t get_ip_address(SocketAddress *address);
virtual const char *get_netmask();virtual nsapi_error_t get_netmask(SocketAddress *address);
virtual const char *get_gateway();virtual nsapi_error_t get_gateway(SocketAddress *address);
virtual nsapi_error_t set_network(const char *ip_address, const char *netmask, const char *gateway);virtual nsapi_error_t set_network(const SocketAddress &ip_address, const SocketAddress &netmask, const SocketAddress &gateway);
features/netsocket/TCPServer.h (deprecated)TCPServer class is deprecated.Use TCPSocket instead.
features/netsocket/TCPSocket.hnsapi_error_t connect(const char *host, uint16_t port);nsapi_error_t connect(const SocketAddress &address)
features/netsocket/TLSSocket.hnsapi_error_t connect(const SocketAddress &address)nsapi_error_t connect(const SocketAddress &address)
platform/mbed_wait_api.hwait(…) and wait_ms(…)

void wait_us(int us)

void wait_ns(unsigned int ns)

ThisThread::sleep_for();

0 Likes
Comments
New Contributor II

Here are some other changes needed to update code examples:

1) Time intervals are not implict milliseconds.

  Now we must use expresions from templates definined in the chronos:: namespace

OS-5 API:

    ThisThread::sleep_for(500); // deprecated in 6.2.0

   

    using variables:

   

        uint32_t sleepTime = 1000 * 60 * 5 ; // 5 minutes

       

        ThisThread::sleep_for(sleepTime);

       

OS-6 API :

     ThisThread::sleep_for(500ms); // ms is a short hand template magic

        chrono::seconds sleepTime = chrono::seconds(5*60);

  or:       

        auto sleepTime = chrono::seconds(5*60);

  or:       

        auto sleepTime = chrono::minutes(5); 

       

        ThisThread::sleep_for(sleepTime);

    

     

2) Queue has changed its API completely (for the best I believe).

OS-5 API:

    queue.put(message);

    osEvent evt = queue.get();

    if (evt.status == osEventMessage)

    {

      msg_t *message = (msg_t*)evt.value.p;

    }

or:

        osEvent evt = queue.get(200);

        if (evt.status == osEventMessage)

        {

            msg_t *message = (msg_t*)evt.value.p;

    }

   

OS-6 API:

    queue.try_put(message);

        

        msg_t *message;

        if (queue.try_get(&message) )

    {

    }

or:

       if (queue.try_get_for(200ms,&message))

        {

        }

3) In Mbed OS 6.0 and up, the default configuration is Minimal printf and snprintf with floating point disabled.

With that change the result of:

    sprintf(buffer,"Temperature = %2.1fF", message->value);

is

    buffer = "Temperature = %2.1fF" instead of "Temperature = 70.5F" for example.

   

a quick way to fix this is in mbed_app.json add the following:

"target.printf_lib": "std"

like this:

{

     "target_overrides":

     {

     "*":

         {

         "target.printf_lib": "std"

         }

     }

}

More info:

https://github.com/ARMmbed/mbed-os/blob/master/platform/source/minimal-printf/README.md

4) cycfg_capsense.h and cycfg_capsense.c are now autogenerated as part of the Board Support Package (BSP)

there is no need to manually generate those files anymore.

5) in cycfg_capsense.h there is a deprecated include file:

#include <stddef.h>

This file will be removed from the next major revision (OS-7). Cypress will have to review the code generator.

Employee

The Infineon software has now been updated and Mbed OS 6 is fully supported for production development.

Version history
Revision #:
1 of 1
Last update:
‎Jun 09, 2020 05:58 PM
Updated by:
 
Contributors