1```eval_rst
2.. include:: /header.rst
3:github_url: |github_link_base|/get-started/nxp.md
4```
5# NXP
6NXP has integrated LVGL into the MCUXpresso SDK packages for several of their general
7purpose and crossover microcontrollers, allowing easy evaluation and migration into your
8product design. [Download an SDK for a supported board](https://www.nxp.com/design/software/embedded-software/littlevgl-open-source-graphics-library:LITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY?&tid=vanLITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY)
9today and get started with your next GUI application.
10
11## Creating new project with LVGL
12Downloading the MCU SDK example project is recommended as a starting point. It comes fully
13configured with LVGL (and with PXP support if module is present), no additional integration
14work is required.
15
16## Adding HW acceleration for NXP iMX RT platforms using PXP (PiXel Pipeline) engine for existing projects
17Several drawing features in LVGL can be offloaded to the PXP engine. The CPU is available for other operations while the PXP is running. An RTOS is required to block the LVGL drawing thread and switch to another task or suspend the CPU for power savings.
18
19#### Features supported:
20  - RGB565 color format
21  - Area fill + optional transparency
22  - BLIT (BLock Image Transfer) + optional transparency
23  - Color keying + optional transparency
24  - Recoloring (color tint) + optional transparency
25  - RTOS integration layer
26  - Default FreeRTOS and bare metal code provided
27
28#### Basic configuration:
29  - Select NXP PXP engine in lv_conf.h: Set `LV_USE_GPU_NXP_PXP` to 1
30  - Enable default implementation for interrupt handling, PXP start function and automatic initialization: Set `LV_USE_GPU_NXP_PXP_AUTO_INIT` to 1
31  - If `FSL_RTOS_FREE_RTOS` symbol is defined, FreeRTOS implementation will be used, otherwise bare metal code will be included
32
33#### Basic initialization:
34  - If `LV_USE_GPU_NXP_PXP_AUTO_INIT` is enabled, no user code is required; PXP is initialized automatically in `lv_init()`
35  - For manual PXP initialization, default configuration structure for callbacks can be used. Initialize PXP before calling `lv_init()`
36```c
37      #if LV_USE_GPU_NXP_PXP
38        #include "lv_gpu/lv_gpu_nxp_pxp.h"
39        #include "lv_gpu/lv_gpu_nxp_pxp_osa.h"
40      #endif
41      . . .
42      #if LV_USE_GPU_NXP_PXP
43        if (lv_gpu_nxp_pxp_init(&pxp_default_cfg) != LV_RES_OK) {
44            PRINTF("PXP init error. STOP.\n");
45            for ( ; ; ) ;
46        }
47      #endif
48```
49
50#### Project setup:
51  - Add PXP related files to project:
52    - lv_gpu/lv_gpu_nxp.c, lv_gpu/lv_gpu_nxp.h: low level drawing calls for LVGL
53    - lv_gpu/lv_gpu_nxp_osa.c, lv_gpu/lv_gpu_osa.h: default implementation of OS-specific functions (bare metal and FreeRTOS only)
54        - optional, required only if `LV_USE_GPU_NXP_PXP_AUTO_INIT` is set to 1
55  - PXP related code depends on two drivers provided by MCU SDK. These drivers need to be added to project:
56      - fsl_pxp.c, fsl_pxp.h: PXP driver
57      - fsl_cache.c, fsl_cache.h: CPU cache handling functions
58
59#### Advanced configuration:
60  - Implementation depends on multiple OS-specific functions. The struct `lv_nxp_pxp_cfg_t` with callback pointers is used
61    as a parameter for the `lv_gpu_nxp_pxp_init()` function. Default implementation for FreeRTOS and baremetal is provided in lv_gpu_nxp_osa.c
62      - `pxp_interrupt_init()`: Initialize PXP interrupt (HW setup, OS setup)
63      - `pxp_interrupt_deinit()`: Deinitialize PXP interrupt (HW setup, OS setup)
64      - `pxp_run()`: Start PXP job. Use OS-specific mechanism to block drawing thread. PXP must finish drawing before leaving this function.
65  - There are configurable area thresholds which are used to decide whether the area will be processed by CPU, or by PXP. Areas smaller than a
66    defined value will be processed by CPU and those bigger than the threshold will be processed by PXP. These thresholds may be defined as
67    preprocessor variables. Default values are defined lv_gpu/lv_gpu_nxp_pxp.h
68      - `GPU_NXP_PXP_BLIT_SIZE_LIMIT`: size threshold for image BLIT, BLIT with color keying, and BLIT with recolor (OPA > LV_OPA_MAX)
69      - `GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT`: size threshold for image BLIT and BLIT with color keying with transparency (OPA < LV_OPA_MAX)
70      - `GPU_NXP_PXP_FILL_SIZE_LIMIT`: size threshold for fill operation (OPA > LV_OPA_MAX)
71      - `GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT`: size threshold for fill operation with transparency (OPA < LV_OPA_MAX)
72