|
| 1 | +.. _GUI_Frameworks_User_Guide: |
| 2 | + |
| 3 | +############# |
| 4 | +UI Frameworks |
| 5 | +############# |
| 6 | + |
| 7 | +This document provides an overview of how to develop with different UI frameworks on |
| 8 | +the |__PART_FAMILY_NAME__| platform. The SDK supports many UI frameworks, including |
| 9 | +QT, Flutter and Slint. Use these frameworks to create rich graphical user interfaces |
| 10 | +for embedded applications. |
| 11 | + |
| 12 | +See the :ref:`TI-Apps-Launcher-User-Guide-label` documentation for more information about Qt-based demos. |
| 13 | +This guide provides a brief overview of Flutter and Slint, along with instructions on how to build and run demos for each. |
| 14 | + |
| 15 | +*************************** |
| 16 | +How to Develop With Flutter |
| 17 | +*************************** |
| 18 | + |
| 19 | +Overview |
| 20 | +======== |
| 21 | + |
| 22 | +The `Flutter <https://flutter.dev/>`__ software development kit from Google is a popular |
| 23 | +open source framework for building natively compiled, multi-platform applications from a |
| 24 | +single codebase. It offers fast development cycles, expressive UI, and excellent performance. |
| 25 | + |
| 26 | +Build Instructions |
| 27 | +================== |
| 28 | + |
| 29 | +Developers who want to use Flutter to build applications on TI embedded platforms, |
| 30 | +can follow the process described in the following steps: |
| 31 | + |
| 32 | +#. **Prepare your Yocto environment:** |
| 33 | + Complete the one-time setup prerequisites listed in the |__SDK_FULL_NAME__| documentation at :ref:`building-the-sdk-with-yocto`. |
| 34 | + |
| 35 | +#. **Configure and build the SDK:** |
| 36 | + The following commands will set up the necessary flutter layers(`meta-flutter <https://layers.openembedded.org/layerindex/branch/master/layer/meta-flutter/>`__) and build the image. |
| 37 | + |
| 38 | + .. code-block:: bash |
| 39 | +
|
| 40 | + # Set up the base SDK layers |
| 41 | + git clone https://git.ti.com/git/arago-project/oe-layersetup.git tisdk |
| 42 | + cd tisdk |
| 43 | +
|
| 44 | + # Replace <oeconfig-file> with the appropriate file for the release |
| 45 | + # uncomment the meta-flutter layer configuration in the selected <oeconfig-file> |
| 46 | + ./oe-layertool-setup.sh -f configs/processor-sdk/<oeconfig-file> |
| 47 | + cd build |
| 48 | +
|
| 49 | + # Add the flutter example demo package to the image |
| 50 | + echo 'IMAGE_INSTALL:append = " flutter-wayland-client flutter-samples-material-3-demo"' >> conf/local.conf |
| 51 | +
|
| 52 | + # Source the environment and build the image |
| 53 | + . conf/setenv |
| 54 | + MACHINE=<machine> bitbake -k tisdk-default-image |
| 55 | +
|
| 56 | + .. note:: |
| 57 | + |
| 58 | + Please refer to the :ref:`Yocto Layer Configuration <yocto-layer-configuration>` guide to |
| 59 | + find the correct :file:`<oeconfig-file>` for the SDK release. The ``<machine>`` variable should |
| 60 | + be set to your target device as in :ref:`Build_Options`. |
| 61 | + |
| 62 | +#. **Flash the SD Card:** |
| 63 | + Once the build is complete, flash the generated image at :file:`build/deploy-ti/images/<machine>/tisdk-default-image-<machine>.wic.xz` |
| 64 | + on to a SD card. Please follow the instructions from here to :ref:`Flash an SD card <processor-sdk-linux-create-sd-card>`. |
| 65 | + |
| 66 | +Running the Demo |
| 67 | +================ |
| 68 | + |
| 69 | +After booting the board with the new image, the following :file:`flutter-samples-material-3-demo` shows on the Wayland display after running the following commands: |
| 70 | + |
| 71 | +.. code-block:: bash |
| 72 | +
|
| 73 | + systemctl stop ti-apps-launcher |
| 74 | + WAYLAND_DISPLAY=/run/user/1000/wayland-1 LD_LIBRARY_PATH=/usr/share/flutter/flutter-samples-material-3-demo/3.38.3/release/lib flutter-client --bundle=/usr/share/flutter/flutter-samples-material-3-demo/3.38.3/release |
| 75 | +
|
| 76 | +.. image:: /images/flutter-samples-material-3-demo.png |
| 77 | + :width: 50% |
| 78 | + :align: center |
| 79 | + :alt: Flutter Samples Material 3 Demo |
| 80 | + |
| 81 | +For application specific performance imporvements, refer this `App note <https://www.ti.com/lit/po/sprt761a/sprt761a.pdf>`__. |
| 82 | + |
| 83 | +************************* |
| 84 | +How to Develop With Slint |
| 85 | +************************* |
| 86 | + |
| 87 | +Overview |
| 88 | +======== |
| 89 | + |
| 90 | +`Slint <https://slint.dev/>`_ is a declarative GUI toolkit to build native user interfaces |
| 91 | +for embedded systems and desktop applications. It is designed to be lightweight and efficient, |
| 92 | +making it a good choice for resource-constrained embedded systems. |
| 93 | + |
| 94 | +Slint uses a flexible architecture with interchangeable rendering backends. By default, |
| 95 | +it uses its own built-in **FemtoVG** renderer, which is a lightweight, hardware-accelerated |
| 96 | +engine that leverages OpenGL ES 2.0. This makes it highly efficient and well-suited for |
| 97 | +embedded GPUs like the PowerVR series on the |__PART_FAMILY_NAME__|, providing a great |
| 98 | +balance of performance and low resource usage out-of-the-box. |
| 99 | + |
| 100 | +Build Instructions |
| 101 | +================== |
| 102 | + |
| 103 | +This guide provides instructions on how to add the `meta-slint <https://layers.openembedded.org/layerindex/branch/master/layer/meta-slint/>`__ layer |
| 104 | +to the Yocto build system of the TI Processor SDK to build and run Slint applications. |
| 105 | + |
| 106 | +#. **Prepare your Yocto environment:** |
| 107 | + Complete the one-time setup prerequisites listed in the |__SDK_FULL_NAME__| documentation at :ref:`building-the-sdk-with-yocto`. |
| 108 | + |
| 109 | +#. **Configure and build the SDK:** |
| 110 | + The following commands will set up the necessary Slint and dependent layers and build the image. |
| 111 | + |
| 112 | + .. code-block:: bash |
| 113 | +
|
| 114 | + # Set up the base SDK layers |
| 115 | + git clone https://git.ti.com/git/arago-project/oe-layersetup.git tisdk |
| 116 | + cd tisdk |
| 117 | +
|
| 118 | + # Create a new config for Slint and add the required meta-layers |
| 119 | + # Replace <oeconfig-file> with the appropriate file for the release |
| 120 | + cp configs/processor-sdk/<oeconfig-file> configs/slint-config.txt |
| 121 | + echo "meta-slint,https://github.com/slint-ui/meta-slint.git,main,7406ee51c140968345b86f3927a8c67984a2dda8,layers=" >> configs/slint-config.txt |
| 122 | + echo "meta-rust-bin,https://github.com/rust-embedded/meta-rust-bin.git,master,79c077fac9694eb5fbcee7b15e800c21e887bb5d,layers=" >> configs/slint-config.txt |
| 123 | +
|
| 124 | + # Set up the bitbake build environment |
| 125 | + ./oe-layertool-setup.sh -f configs/slint-config.txt |
| 126 | + cd build/ |
| 127 | +
|
| 128 | + # Add the slint-demos package to the image |
| 129 | + echo 'IMAGE_INSTALL:append = " slint-demos"' >> conf/local.conf |
| 130 | +
|
| 131 | + # Source the environment and build the image |
| 132 | + . conf/setenv |
| 133 | + MACHINE=<machine> bitbake -k tisdk-default-image |
| 134 | +
|
| 135 | + .. note:: |
| 136 | + |
| 137 | + Please refer to the :ref:`Yocto Layer Configuration <yocto-layer-configuration>` guide to |
| 138 | + find the correct ``<oeconfig-file>`` for your SDK release. The ``<machine>`` variable should |
| 139 | + be set to your target device as in :ref:`Build_Options`. |
| 140 | + |
| 141 | +#. **Flash the SD Card:** |
| 142 | + Once the build is complete, flash the generated image at :file:`build/deploy-ti/images/<machine>/tisdk-default-image-<machine>.wic.xz` |
| 143 | + on to a SD card. Please follow the instructions from here to :ref:`Flash an SD card <processor-sdk-linux-create-sd-card>`. |
| 144 | + |
| 145 | +Running the Demos |
| 146 | +================= |
| 147 | + |
| 148 | +After booting the board with the new image, you will find several Slint demo binaries located in :file:`/usr/bin`, including: |
| 149 | + |
| 150 | +* :file:`energy-monitor` |
| 151 | +* :file:`gallery` |
| 152 | +* :file:`home-automation` |
| 153 | +* :file:`opengl_texture` |
| 154 | +* :file:`opengl_underlay` |
| 155 | +* :file:`printerdemo` |
| 156 | +* :file:`slide_puzzle` |
| 157 | + |
| 158 | +To run a demo, first stop the ti-apps-launcher that runs out-of-box and then execute the desired binary. |
| 159 | +For example, to run the "home-automation" demo on a Wayland display: |
| 160 | + |
| 161 | +.. code-block:: bash |
| 162 | +
|
| 163 | + systemctl stop ti-apps-launcher |
| 164 | + WAYLAND_DISPLAY=/run/user/1000/wayland-1 /usr/bin/home-automation |
| 165 | +
|
| 166 | +
|
| 167 | +.. image:: /images/slint_home_automation.png |
| 168 | + :width: 50% |
| 169 | + :alt: Slint Home Automation Demo |
| 170 | + |
| 171 | +Here are some snapshots of the other demos running on the device. |
| 172 | + |
| 173 | +.. list-table:: |
| 174 | + :widths: 50 50 |
| 175 | + :header-rows: 0 |
| 176 | + |
| 177 | + * - .. figure:: /images/slint_opengl_texture.png |
| 178 | + :align: center |
| 179 | + :alt: Slint OpenGL Texture Demo |
| 180 | + |
| 181 | + OpenGL Texture Demo |
| 182 | + |
| 183 | + - .. figure:: /images/slint_opengl_underlay.png |
| 184 | + :align: center |
| 185 | + :alt: Slint OpenGL Underlay Demo |
| 186 | + |
| 187 | + OpenGL Underlay Demo |
| 188 | + |
| 189 | + * - .. figure:: /images/slint_printer_demo.png |
| 190 | + :align: center |
| 191 | + :alt: Slint Printer Demo |
| 192 | + |
| 193 | + Printer Demo |
| 194 | + |
| 195 | + - .. figure:: /images/slint_puzzle_demo.png |
| 196 | + :align: center |
| 197 | + :alt: Slint Puzzle Demo |
| 198 | + |
| 199 | + Puzzle demo |
0 commit comments