Console IO

GAP and GAP SDK provides you the possibilities of console (printf) with JTAG or UART.

Console IO via JTAG

The make option io=host, the default console mode, will direct the printf on the jtag. The printf in this case is implemented based on semihosting, works with openOCD.

Warning

This mode only can be used when boot from JTAG. It will cause the process hang if it’s used in boot from flash.

Console IO via UART

This mode will triggered by using the option io=uart, which will redirect the printf on the UART.

Warning

If using any UART in your application, beware of the conflicts that might occured if using the same UART (same id).

By default, the uart will be configured as:

  • UART ID: 1

  • Baudrate: 115200

  • HW Flow Control: No

  • Timeout: No

All these parameters can be configured by using the following makefile options:

  • UART ID: CONFIG_IO_UART_ITF=<UART ID you want to use>

  • Baudrate: CONFIG_IO_UART_BAUDRATE=<baudrate of uart>

  • Enable the HW Flow Control: APP_CFLAGS += -DCONFIG_IO_UART_FLOW_CONTROL

  • Enable Timeout: APP_CFLAGS += -DCONFIG_UART_IO_UART_TIMEOUT -DCONFIG_UART_IO_UART_TIMEOUT_US=<timeout in us>

These options can be used separatly to enable/disable the feature(s) you want.

Warning

The HW Flow Control cannot be used with the FTDI2232 chip on GAP EVK.

Console IO via Host GAP CLI

Note

To use this feature you must enable the host GAP CLI (CONFIG_ENABLE_GAP_CLI=y). See Host GAP CLI for more details.

Quite similar to IO via UART, however it uses the UART of the CLI. And logs will be printed on the console (for now. In a dedicated window in the future) of the CLI.

To use this feature, put CONFIG_IO_TYPE_CLI=y in your sdk.config file, or select the option in the menuconfig.

As the UART is the one of the CLI, go to the CLI menu to configure the UART.

Disable the Console

If you don’t need printf anymore, we strongly suggest you to disable the console with io=disable, which will help you to save the footprint of your application.