连接裸机设备

You can configure build and run kits to use Bare Metal tool chains installed on the development host to build applications for Bare Metal devices. You can connect the devices to the development host to run and debug applications on them from Qt Creator using GDB or a hardware debugger. This enables you to debug on small devices that are not supported by the generic remote Linux device plugin.

注意: If you use qmake to build the project and the device does not have Qt libraries, you need a fake Qt installation.

The following tool chains are supported for building applications:

  • GCC: Microchip Technology (AVR, AVR32, PIC16, PIC32), NXP Semiconductors (ColdFire, M68K), Texas Instruments (MSP430), National Semiconductor (CR16C), Renesas Electronics (M32R, M32C, RL78, RX, SuperH, V850), Tensilica XTENSA (ESP8266, ESP32), RISC-V, Arm
  • IAR EW : Microchip Technology (AVR, AVR32), NXP Semiconductors (ColdFire, M68K), Texas Instruments (MSP430), National Semiconductor (CR16C), Renesas Electronics (78K, M16/R8C, M32C, R32C, RH850, RL78, RX, SuperH, V850), STMicroelectronics (STM8), 8051, RISC-V, Arm
  • Keil : Arm, C51 (8051), C251 (80251), C166 (C16x, XC16x)
  • SDCC : STMicroelectronics (STM8), 8051

The bare metal device type accepts custom GDB commands that you specify in the device options. You can specify the commands to execute when connecting using a particular debug server provider.

The following debug server providers are supported when using GDB:

ST-Link and J-Link debug server providers can be used together with the uVision IDE .

Enabling the Bare Metal Device Plugin

To enable the Bare Metal Device plugin:

  1. 选择 Help > About Plugins > Device Support > 裸机 .
  2. 选择 Restart Now to restart Qt Creator and load the plugin.

Specifying Settings for Debug Server Providers

To create connections to bare metal devices using a debug server provider, select 工具 > Options > Devices > 裸机 > Add > 默认 . The available settings depend on the debug server provider.

EBlink is an ARM Cortex-M debug tool that supports squirrel scripting, live variables, and hot-plugging.

"Bare metal device options for EBlink"

To specify settings for EBlink:

  1. Name field, enter a name for the connection.
  2. Startup mode field, select the mode to start the debug server provider in.
  3. Host field, select the host name and port number to connect to the debug server provider.
  4. Executable file field, enter the path to the debug server provider executable.
  5. Script file field, enter the path to a device script file.
  6. Verbosity level field, enter the level of verbose logging.
  7. Select the Connect under reset check box to use the ST-Link interface. Deselect the check box for hot-plugging.
  8. Type field, select the interface type.
  9. Speed field, enter the interface speed between 120 and 8000 kiloherz (kHz).
  10. Select the Disable cache check box to disable the EBlink flash cache.
  11. Select the Auto shutdown check box to automatically shut down the EBlink server after disconnecting.
  12. Init commands field, enter the commands to execute when initializing the connection.
  13. Reset commands field, enter the commands to execute when resetting the connection.
  14. 选择 Apply to add the debug server provider.

J-Link is a line of debug probes by Segger.

"Bare metal device options for J-Link"

To specify settings for J-Link debug probes:

  1. Name field, enter a name for the connection.
  2. Startup mode field, select the mode to start the debug server provider in.
  3. Host field, select the host name and port number to connect to the debug server provider.
  4. Executable file field, enter the path to the debug server provider executable.
  5. Host interface field, select the connection type, IP or USB, or use the default connection.
  6. Target interface field, select the target interface type.
  7. Speed field, enter the interface speed in kHz.
  8. Device field, select the device to connect to.
  9. Additional arguments field, enter arguments for the commands.
  10. Init commands field, enter the commands to execute when initializing the connection.
  11. Reset commands field, enter the commands to execute when resetting the connection.
  12. 选择 Apply to add the debug server provider.

OpenOCD

OpenOCD (Open On-Chip Debugger) is an on-chip debug solution for targets based on the ARM7 and ARM9 family with Embedded-ICE (JTAG) facility. It enables source level debugging with the GDB compiled for the ARM architecture.

"Bare metal device options for OpenOCD"

To specify settings for OpenOCD:

  1. Name field, enter a name for the connection.
  2. Startup mode field, select the mode to start the debug server provider in.
  3. Host field, select the host name and port number to connect to the debug server provider.
  4. Executable file field, enter the path to the debug server provider executable.
  5. Root scripts directory field, enter the path to the directory that contains configuration scripts.
  6. 配置文件 field, enter the path to the device configuration file.
  7. Additional arguments field, enter arguments for the commands.
  8. Init commands field, enter the commands to execute when initializing the connection.
  9. Reset commands field, enter the commands to execute when resetting the connection.
  10. 选择 Apply to add the debug server provider.

ST-LINK Utility is used for programming STM32 microcontrollers.

"Bare metal device options for St-Link"

To specify settings for St-Link:

  1. Name field, enter a name for the connection.
  2. Startup mode field, select the mode to start the debug server provider in.
  3. Host field, select the host name and port number to connect to the debug server provider.
  4. Executable file field, enter the path to the debug server provider executable.
  5. Verbosity level field, enter the level of verbose logging.
  6. Select the Extended mode check box to continue listening for connection requests after after the connection is closed.
  7. Select the Reset on connection check box to reset the board when the connection is created.
  8. 版本 field, select the transport layer type supported by the device.
  9. Init commands field, enter the commands to execute when initializing the connection.
  10. Reset commands field, enter the commands to execute when resetting the connection.
  11. 选择 Apply to add the debug server provider.

uVision IDE

uVision is an IDE for developing applications for embedded devices. Applications can be debugged by using uVision Simulator or directly on hardware by using St-Link and J-Link.

You can view the current state of peripheral registers in the Peripheral Registers view in Debug mode. The view is hidden by default.

uVision Simulator

"Bare metal device options for uVision Simulator"

To specify settings for uVision Simulator or uVision St-Link Debugger:

  1. Name field, enter a name for the connection.
  2. Host field, select the host name and port number to connect to the debug server provider.
  3. Tools file path field, enter the path to the Keil toolset configuration file.
  4. Target device field, select the device to debug.
  5. Target driver field, select the driver for connecting to the target device.
  6. Select the Limit speed to real-time check box to limit the connection speed.
  7. 选择 Apply to add the debug server provider.

"Bare metal device options for uVision St-Link"

To specify settings for uVision St-Link Debugger:

  1. Name field, enter a name for the connection.
  2. Host field, select the host name and port number to connect to the debug server provider.
  3. Tools file path field, enter the path to the Keil toolset configuration file.
  4. Target device field, select the device to debug.
  5. Target driver field, select the driver for connecting to the target device.
  6. Adapter options field specify the adapter interface type and speed in MHz.
  7. 选择 Apply to add the debug server provider.

Adding Bare Metal Devices

"Bare Metal device options"

To add a bare metal device:

  1. 选择 工具 > Options > Devices > Add > Bare Metal Device > Start Wizard .
  2. Debug server provider field, select a debug server provider.
  3. 选择 Apply to add the device.

Building for and Running on Bare Metal Devices

To add a kit for building applications and running them on bare metal devices, select 工具 > Options > Kits > Add 。更多信息,见 Adding Kits .

"Kit options for Bare Metal"

You can build applications for and run them on bare metal devices in the same way as for and on the desktop. For more information, see 为多个平台进行构建 and 在多个平台上运行 .