7 years, 2 months ago.

Select Custom Target

I create here a further question related to /questions/79176/NUCLEO-F302R8-with-HSI/

How can I select the custom target.

I created a

custom_targets.json

{
    "myboard": {
        "inherits": ["NUCLEO_F302R8"],
        "overrides": {
            "clock_source": "USE_PLL_HSI"
         }
}

in the root of my project. As described in https://docs.mbed.com/docs/mbed-os-handbook/en/latest/advanced/mbed_targets/

But it seems as not recognized at compilation. Maybe it is not selected. How can I select it? The "select a platform" button on the top left of the online IDE only shows me a popup window with registered board. What is missed?

3 Answers

5 years, 11 months ago.

I am really not impressed with MBED CLI. You have to pick a compiler in addition to MBED CLI to get things working. Two of the compilers require you to pay, to get a useful working version (and appear to be hidden). The third compiler is plagued with bugs, which leads to more hair pulling until you discover the bugs.

The whole use of json files to configure the included parameters in a compiled library is also lame. For years the #define with #ifndef options were used to evaluate if a component should be included or not in C++. And if json files were really needed then they should include a method to indicate the default configuration to compile.

And why would a key library for mbed compiler exclude the use of their online compiler?

I know it is a bit of a rant, but these details are not clear when you scan the documentation. The information is either old, outdated, or just missing. Adding mbed-os to your online code will not give you all of the features that is not incorporated into mbed-os. All those deprecated projects that are now inside mbed-os could be locked away.

7 years, 2 months ago.

I would suggest taking this project offline and using mbed CLI to compile - https://os.mbed.com/docs/v5.6/tools/mbed-cli.html. The online IDE GUI choices are limited to boards in the "boards" section of os.mbed.com. I will see about getting the documentation updated.

I tried it with mbed CLI

  • When it was named as custom_targets.json nothing changed. Like the Online IDE
  • Change the filename to targets.json an comile it with -m myboard. I got make.py: error: argument -m/--mcu: myboard is not a supported MCU...#
  • with targets.json and -m NUCLEO_F302R8 I got [ERROR] 'NUCLEO_F302R8'
posted by Gerhard Herrmann 10 Oct 2017

May I ask what version of mbed you are using? I used made a custom_target.json in the mbed-os-example-blinky project with the following:

{
    "myboard": {
        "inherits": ["NUCLEO_F302R8"],
        "overrides": {
            "clock_source": "USE_PLL_HSI"
         }
    }
}

I received the following error: "Could not compile for myboard: Target does not support mbed OS 5"

The target you are inheriting from does not support mbed OS 5 - https://github.com/ARMmbed/mbed-os/blob/master/targets/targets.json#L883.

So, I can only assume you are using previous versions of mbed. The docs you referenced are for mbed OS 5. Those docs do not apply to previous versions of mbed. So, Bill's answer below might be of use if you want to use mbed-dev.

If you do want to use mbed OS, I was able to compile for this target by modifying the custom_targets.json like so:

{
    "myboard": {
        "inherits": ["NUCLEO_F302R8"],
        "overrides": {
            "clock_source": "USE_PLL_HSI"
        },
        "release_versions": ["2", "5"]
    }
}
posted by Sarah Marsh 10 Oct 2017
7 years, 2 months ago.

I personally dislike all the push for CLI and prefer to use the cloud-based tools. In order to use a custom board online you will have to select a target that exists for the online compiler. Then import the mbed-dev or mbed-os source from github into your project (google how to do this). In the targets folder, just edit the targets.json file and make the appropriate changes for your custom board. I currently use this method for a custom board I have.

Thanks for the feedback Bill. Do you mind starting a discussion in the forum? https://os.mbed.com/forum/bugs-suggestions/

posted by Sam Grove 10 Oct 2017