Mbed.h not found with STM32F302R8 target

Hi All,

I try to use Mbed for a STM32F302R8 µC. Mbstudio found my target and propose the first example “blinking a led”.

I have an error Mbed don’t found “mbed.h” but it can found " platform/mbed_thread.h"


/* mbed Microcontroller Library

  • Copyright (c) 2019 ARM Limited
  • SPDX-License-Identifier: Apache-2.0
    */

#include “mbed.h”
#include “platform/mbed_thread.h”

// Blinking rate in milliseconds
#define BLINKING_RATE_MS 500

int main()
{
// Initialise the digital pin LED1 as an output
DigitalOut led(LED1);

while (true) {
led = !led;
thread_sleep_for(BLINKING_RATE_MS);
}
}


thanks in advance for your help.

Joël

Hi Joel,

C/C++ intellisense fails for this board in Mbed Studio because this board supports only Mbed OS 2 (NUCLEO-F302R8 | Mbed). Mbed Studio is designed to work with Mbed OS 5.12.0 and higher.
To enable support for this board you can try using bare metal profile. More information about it can be found here: https://os.mbed.com/docs/mbed-studio/current/mbed-os/bare-metal.html

Thanks,
Arek - Mbed Studio team

Thanks Arek,

I will try tomorrow.

Joël

Hi,

I install bare metal with the procedure in the readme of Mbed-Cli and after when I open Mbed studio, I have the possibility to use the exemple “blink with bare metal”. I try it and works fine in my STM32F302R8.


Download and run the Windows installer for Mbed CLI.

a part of readme in Mbed-Cli folder.

in a terminal :

$ mbed new mbed-os-program
[mbed] Creating new program "mbed-os-program" (git)
[mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os" at latest revision in the current branch
[mbed] Updating reference "mbed-os" -> "https://github.com/ARMmbed/mbed-os/#89962277c20729504d1d6c95250fbd36ea5f4a2d"

This creates a new folder “mbed-os-program”, initializes a new repository and imports the latest revision of the mbed-os dependency to your program tree.

Creating a new program for Mbed OS 2

Mbed CLI is also compatible with Mbed OS 2 programs based on the Mbed library, and it automatically imports the latest Mbed library release if you use the --mbedlib option:

in a terminal :

$ mbed new mbed-classic-program --mbedlib
[mbed] Creating new program "mbed-classic-program" (git)
[mbed] Adding library "mbed" from "https://mbed.org/users/mbed_official/code/mbed/builds" at latest revision in the current branch
[mbed] Downloading mbed library build "f9eeca106725" (might take a minute)
[mbed] Unpacking mbed library build "f9eeca106725" in "D:\Work\examples\mbed-classic-program\mbed"
[mbed] Updating reference "mbed" -> "https://mbed.org/users/mbed_official/code/mbed/builds/f9eeca106725"
[mbed] Couldn't find build tools in your program. Downloading the mbed 2.0 SDK tools...

Thanks,

Joël