In Mbed OS, a build target is a destination for a software build, for example an MCU, development board or custom board. A build is always done for a specific target.
Mbed Studio has a list of build targets for all Mbed Enabled development boards (filtered to match your program's version of Mbed OS). In some cases, you may want to create a custom target. For example, you may:
- Have a debug probe to a board that doesn't have an integrated interface chip. When you plug in a debug probe, Mbed Studio will need to know the target to build and debug for, so you need to specify it.
- Use a debugger configuration that isn't the default for your board, such as one found in a CMSIS-Pack. The software debugger will need to know what pack and debug target to use.
- Added hardware components to your development boards, and want a build target that works with the additional components. You need to edit the file
custom_target.json, or use a derived build target.
A custom target is tied to an individual board or debug probe (based on its USB Serial Number); every time you plug it in, Mbed Studio automatically chooses the custom target you set up for it.
Warning: Flashing and debugging in an incompatible way can "brick" your board.
Setting up a custom target
Connect your hardware over USB. Mbed Studio detects the target.
If your target is a debug probe, or if your board is not supported by your program's version of Mbed OS, the Manage Custom Target window opens automatically.
If your target is a development board, open the Target drop-down list and click the custom target button:
The Manage Custom Target window shows all USB-connected devices in the USB device drop-down. Select the one you want to create a target for.
All fields are populated with the default value for the target.
In the Build target drop-down, you can:
- Select a different supported target for the develop build.
Selecting a build target populates the Target name and Deploy and debug target fields with matching values, unless you've already manually edited them.
- Click the custom target button to create a
custom_target.jsonfile in the root folder of your program.
You may want to do this if you're inheriting from another target, or creating a new target, because you have additional hardware components on your board.
To learn how to use the
custom_targetfile, please see the Mbed OS documentation.
In the Deploy and debug target drop-down, select a target to use for debug and deploy builds.
Resetting a target
To reset a target, open the Manage Custom Target again and click the Reset button: