2 years, 8 months ago.

"mbed-os-example-blinky" compiles with syntax errors

I tried to compile blinky example for NUCLEO_F401RE. I got this output:


I inspected the source code and found out that SystemReport object sys_state (a class defined in stats_report.h) contains sys_status structure that is supposed to have field ram_size.


include the mbed library with this snippet

#include "mbed.h"
#include "stats_report.h"

DigitalOut led1(LED1);

int main()
    SystemReport sys_state(500 );

    while (true) {
        led1 = !led1;

stats_report.h ...

include the mbed library with this snippet

class SystemReport {
    mbed_stats_heap_t   heap_stats;
    mbed_stats_cpu_t    cpu_stats;
    mbed_stats_sys_t    sys_stats;

I dived into the definition of sys_status structure (defined in mbed_stats.h) and it does not that that field indeed.


include the mbed library with this snippet

typedef struct {
    uint32_t os_version;                /**< Mbed OS version (populated only for tagged releases) */
    uint32_t cpu_id;                    /**< CPUID register data (Cortex-M only supported) */
    mbed_compiler_id_t compiler_id;     /**< Compiler ID \ref mbed_compiler_id_t */
    uint32_t compiler_version;          /**< Compiler version */
} mbed_stats_sys_t;

In main.cpp I commented out all code related to stats_report.h and it was compiled successfully.

So the question is how reports in main.cpp are supposed to work at all?

1 Answer

2 years, 8 months ago.

Hi Egor,

Thanks for catching this problem. The example accidentally references an outdated version of Mbed! An update was made several days ago to mbed.h that is required. To remedy this, please change into the "mbed-os" folder and perform an update to master:

$ mbed update master
[mbed] Updating library "mbed-os" to branch/tag "master"
[mbed] Updating reference "mbed-os" -> "https://github.com/ARMmbed/mbed-os/#ba6b36cb3bfb5181722f4e70bcaec66ab8b93788"

We have a PR in the works to get the example fixed ASAP.


Ralph, Team Mbed

Accepted Answer