-
Notifications
You must be signed in to change notification settings - Fork 12
Connecting Serial Terminal
Arduino-CMake has the ability to connect the board through a serial terminal, just as you would with Arduino IDE.
To do that, you should pass the SERIAL
parameter to the generate_arduino_firmware
function.
The example below attempts to connect the board through the picocom
serial interface:
generate_arduino_firmware(${CMAKE_PROJECT_NAME}
SRCS main.cpp
PORT /dev/ttyUSB0
SERIAL picocom [SERIAL_PORT] -b 9600 -l
BOARD uno)
Where [SERIAL_PORT]
is the port used for serial connection.
The example above will create a target named ${CMAKE_PROJECT_NAME}-serial
used specifically for connecting the program on the board through a serial terminal.
Each OS has its' own set of serial terminals, named differently. Below is the list of known serial terminals on each supported OS:
Linux has a variety of popular terminals that can be used. Below is a list of the most popular:
- minicom
- picocom
- gtkterm
- screen
In order to use one of them in Arduino-CMake, you should include the following line in your CMakeLists.txt
:
set(${FIRMWARE_NAME}_SERIAL [TERMINAL] [SERIAL_PORT])
Where:
- [TERMINAL] is the name of the serial terminal used
- [SERIAL_PORT] is the terminal device (Such as
/dev/tty.usbmodemXXX
)
The easiest way to use a serial terminal in Mac is using the screen terminal emulator.
In order to use screen in Arduino-CMake, you should include the following line in your CMakeLists.txt
:
set(${FIRMWARE_NAME}_SERIAL screen [SERIAL_PORT])
Where [SERIAL_PORT] is the terminal device (Such as /dev/tty.usbmodemXXX
).
The most popular serial terminal for Windows systems which has multiple purposes and supports a handful of protocols is Putty.
In order to use putty in Arduino-CMake, you should add its' binary path to the System Path
, then include the following line in your CMakeLists.txt
:
set(${FIRMWARE_NAME}_SERIAL putty -serial [SERIAL_PORT])
Where [SERIAL_PORT] is the terminal device.