This example demonstrates use of the Universal Asynchronous Receiver-Transmitter (UART) driver in KasperskyOS.
Example directory in the SDK
The code of the example and build scripts are available at the following path:
/opt/KasperskyOS-Community-Edition-<platform>-<version>/examples/uart
List of programs
Client – application that uses the UART driver interface. A full description of the UART driver interface is contained in the file /opt/KasperskyOS-Community-Edition-<platform>-<version>/sysroot-*-kos/include/uart/uart.h.UART is a driver for working with a universal asynchronous receiver-transmitter.DCM – system program that lets you dynamically create IPC channels.When you build an example for the target hardware platform, platform-specific drivers are automatically included in the solution:
BSP – Board Support Package that provides cross-platform peripheral configuration for the Radxa ROCK 3A and Raspberry Pi 4 B.Bcm2711MboxArmToVc – driver for working with the VideoCore (VC6) coprocessor via mailbox technology for Raspberry Pi 4 B.Initialization description
The solution initialization description file named init.yaml is generated during the solution build process based on the ./einit/src/init.yaml.in and ./einit/init_qemu.yaml.in templates. Macros in @INIT_*@ format contained in the template are automatically expanded in the resulting init.yaml file. For more details, refer to init.yaml.in template.
Security policy description
The security.psl file contains the solution security policy description and is generated based on the ./einit/src/security.psl.in template during the solution build process. For more details, refer to "security.psl.in template".
The solution security policy description in this example allows any interaction between different processes and between processes and the kernel. This policy can be used only as a stub during the early stages of a solution development so that the security module does not interfere with interactions. It would be unacceptable to apply such a policy in a real-world KasperskyOS-based solution.
Resources
The directory ./resources/xdl/uart contains the EDL description for the Client program.
Operating scenario
The Client program performs the following actions:
PORT_NAME macro and configures it with the defined parameters.Hello world with UART! to the open port.EXIT_SUCCESS code if there are no errors. Otherwise it shows the EXIT_FAILURE code.Building and running the example
The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example.
For the example to work correctly on the Radxa ROCK 3A, do the following:
UART8_TX_M1 (pin 29) on the Radxa ROCK 3A board to the RXD output of the USB-UART converter.rk3568-uart2-m0.dtbo to the hardware configuration description binary file rk3568-rock-3a.dtb according to the instructions on applying overlays provided in the section titled Building drivers for the Radxa ROCK 3A hardware platform.See Building and running examples section.
Page top