# K230 Third-party Library Reference

## Overview

The K230 RT-Smart SDK integrates a set of commonly used third-party libraries, mainly for font rendering, GUI development, TLS/encryption, HTTP, MQTT, and cloud platform access. These components primarily expose the original interfaces of their upstream projects. On the SDK side, the work mainly covers build integration, header file export, and sample project organization, so the complete APIs are not duplicated in this manual.

This document provides a concise integration-oriented description to help users confirm:

- Which third-party components are integrated into the SDK
- Where the corresponding source code is located
- Which Kconfig options need to be enabled
- Which examples can be used as references
- Which official documentation should be read first

## Code location

- Third-party library source: `src/rtsmart/libs/3rd-party`
- Third-party library build entry: `src/rtsmart/libs/3rd-party/Makefile`
- Third-party sample entry: `src/rtsmart/examples/3rd-party/Makefile`
- Third-party library configuration: `src/rtsmart/libs/3rd-party/Kconfig`
- Third-party sample configuration: `src/rtsmart/examples/3rd-party/Kconfig`

## Integrated libraries

| Component | SDK directory | Enable option | Optional samples/tests | Official references |
| :-- | :-- | :-- | :-- | :-- |
| FreeType | `libs/3rd-party/freetype` | `RTSMART_3RD_PARTY_ENABLE_FREETYPE` | `examples/3rd-party/freetype/freetype_basic` | [FreeType Docs](https://freetype.org/freetype2/docs/) |
| LVGL | `libs/3rd-party/lvgl` | `RTSMART_3RD_PARTY_ENABLE_LVGL` | `examples/3rd-party/lvgl/lvgl_basic`, `lvgl_sensor` | [LVGL Docs](https://docs.lvgl.io/) |
| Mbed TLS | `libs/3rd-party/mbedtls` | `RTSMART_3RD_PARTY_ENABLE_MBEDTLS` | `RTSMART_3RD_PARTY_ENABLE_MBEDTLS_TESTS` | [Mbed TLS Docs](https://mbed-tls.readthedocs.io/) |
| MQTTClient | `libs/3rd-party/mqttclient` | `RTSMART_3RD_PARTY_ENABLE_MQTTCLIENT` | `RTSMART_LIBS_MQTTCLIENT_ENABLE_TESTS` | [Paho Embedded C](https://github.com/eclipse-paho/paho.mqtt.embedded-c) |
| miniHTTP | `libs/3rd-party/minihttp` | `RTSMART_3RD_PARTY_ENABLE_MINIHTTP` | `examples/3rd-party/minihttp/minihttp_basic`, `minihttp_advanced` | Refer to the project source repository and header file descriptions |
| Tuya IoT Core SDK | `libs/3rd-party/tuya-iot-core-sdk` | `RTSMART_3RD_PARTY_ENABLE_TUYALINKSDK` | `examples/3rd-party/tuya/tuya_basic` | [Tuya Developer Docs](https://developer.tuya.com/en/docs/iot-device-dev/TuyaOS-iot_abi?id=Kcoglhn5r7ajr) |
| OpenCV samples | SDK OpenCV integration directory | Sample option `RTSMART_3RD_PARTY_ENABLE_OPENCV_SAMPLES` | `examples/3rd-party/opencv` | [OpenCV Docs](https://www.bing.com/search?q=opencv+docs) |
| OpenBLAS samples | SDK OpenBLAS integration directory | Sample option `RTSMART_3RD_PARTY_ENABLE_OPENBLAS_SAMPLES` | `examples/3rd-party/openblas` | [OpenBLAS Docs](https://www.openblas.net/) |

## Usage suggestions

### Check the SDK integration method first

If your goal is to integrate third-party libraries into a K230 project, read the following first:

- The master switches and dependencies in `libs/3rd-party/Kconfig`
- How build subdirectories are organized in `libs/3rd-party/Makefile`
- The `Makefile`, `CMakeLists.txt`, and sample source code in the corresponding sample directory

### Then read the official third-party documentation

If your goal is to learn the API of the library itself, read the official documentation first rather than this SDK documentation. The reasons are:

- Third-party library APIs are usually much larger than SDK-owned interfaces.
- Upstream project APIs are updated more frequently.
- Official documentation usually contains more complete parameter descriptions, limitations, and migration instructions.

### Pay attention to SDK-side differences

When using third-party libraries, also pay attention to the following SDK-side differences:

- Whether the corresponding Kconfig option must be enabled
- Whether a porting layer or platform adaptation layer is provided
- Whether K230-specific samples are available and can be run directly
- Whether the library depends on other components, for example Tuya depends on Mbed TLS

## Notes

- This section does not duplicate the complete API manuals of third-party projects. It only provides SDK integration entry points.
- If the official documentation is inconsistent with the actual directories in the SDK, refer to the header files, Makefiles, and sample projects in the current SDK.
- If you need K230-specific instructions for a third-party library, check the corresponding sample directory first, because it usually best reflects the currently runnable usage.

```{admonition} Tip
The recommended reading order for third-party library documentation is usually: first review the SDK Kconfig options and samples, then consult the official documentation and API manual of the third-party project.
```
