|
| 1 | +--- |
| 2 | +sidebar_position: 3 |
| 3 | +--- |
| 4 | +# 适配TFT屏与HDMI功能 |
| 5 | + |
| 6 | +本章节将讲解如何基于 Tina5 v1.2 SDK 在 T113s3-i 开发板上实现TFT屏与HDMI显示功能。 |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +如果需要先查看显示效果,可以下载下面这个镜像: |
| 11 | + |
| 12 | +[T113i-DevKit-Support-MIPI-To-HDMI](https://dl.100ask.net/Hardware/MPU/T113i-Industrial/Images/T113i-DevKit-Support-MIPI-To-HDMI.7z) |
| 13 | + |
| 14 | +硬件可以准备这些: |
| 15 | + |
| 16 | +[韦东山全志T113i嵌入式Linux开发板超高性价比板载WIFI MIPI显示-tmall.com天猫](https://detail.tmall.com/item.htm?id=795375482080&skuId=6054280651964&spm=a21xtw.29178619.0.0) |
| 17 | + |
| 18 | +## 一、获取Tina5-V1.2_SDK源码 |
| 19 | + |
| 20 | +### 1. 获取源码 |
| 21 | + |
| 22 | +获取源码链接如下: |
| 23 | +https://pan.baidu.com/s/1A_HER2QyTk0BIVxOuGoAyQ?pwd=n8ii |
| 24 | + |
| 25 | +上传至虚拟机~/Downloads/ 。获取文件如下: |
| 26 | +~~~bash |
| 27 | +. |
| 28 | +├── md5.txt |
| 29 | +├── 100ASK_T113s3-PRO_TinaSDK5.tar.gz.00 |
| 30 | +├── 100ASK_T113s3-PRO_TinaSDK5.tar.gz.01 |
| 31 | +└── 100ASK_T113s3-PRO_TinaSDK5.tar.gz.02 |
| 32 | + |
| 33 | +0 directories, 4 files |
| 34 | +~~~ |
| 35 | + |
| 36 | +执行以下指令,查看MD5校验值: |
| 37 | + |
| 38 | +~~~bash |
| 39 | +md5sum 100ASK_T113s3-PRO_TinaSDK5.tar.gz.0* |
| 40 | +~~~ |
| 41 | + |
| 42 | +如下: |
| 43 | + |
| 44 | +~~~bash |
| 45 | +35577ee74334ee8bd9c5fcca844795b3 100ASK_T113s3-PRO_TinaSDK5.tar.gz.00 |
| 46 | +3420eef596165883cde2e14a41a12358 100ASK_T113s3-PRO_TinaSDK5.tar.gz.01 |
| 47 | +ad730f3b76e3943652b56c8c5335f52c 100ASK_T113s3-PRO_TinaSDK5.tar.gz.02 |
| 48 | +~~~ |
| 49 | + |
| 50 | +确保校验值对上。否则需要重新上传。 |
| 51 | + |
| 52 | +### 2. 解压源码 |
| 53 | + |
| 54 | +执行以下指令,解压源码: |
| 55 | + |
| 56 | +~~~bash |
| 57 | +cat 100ASK_T113s3-PRO_TinaSDK5.tar.gz.0* | tar -xzvf - |
| 58 | +~~~ |
| 59 | + |
| 60 | +等待一段时间,即可解压完成。如下所示: |
| 61 | +~~~bash |
| 62 | +. |
| 63 | +├── 100ASK_T113s3-PRO_TinaSDK5 |
| 64 | +├── md5.txt |
| 65 | +├── 100ASK_T113s3-PRO_TinaSDK5.00 |
| 66 | +├── 100ASK_T113s3-PRO_TinaSDK5.01 |
| 67 | +└── 100ASK_T113s3-PRO_TinaSDK5.02 |
| 68 | + |
| 69 | +1 directory, 4 files |
| 70 | +~~~ |
| 71 | + |
| 72 | +我们现在用的开发板是 T113-i,给SDK换个名称,并移动到 ~/ 目录。执行指令如下: |
| 73 | + |
| 74 | +~~~bash |
| 75 | +mv 100ASK_T113s3-PRO_TinaSDK5 T113i-Tina5.0-v1.2-SDK |
| 76 | +mv T113i-Tina5.0-v1.2-SDK ~/ |
| 77 | +~~~ |
| 78 | + |
| 79 | +## 二、拉取SDK补丁包 |
| 80 | + |
| 81 | +### 1. 获取补丁包 |
| 82 | + |
| 83 | +补丁仓库目前已经更新,获取相应的补丁包,执行如下指令: |
| 84 | + |
| 85 | +~~~bash |
| 86 | +cd ~ |
| 87 | +git clone -b tft-and-hdmi --single-branch https://github.com/DongshanPI/T113i_DevKitF_Tina5SDK.git |
| 88 | +~~~ |
| 89 | + |
| 90 | +### 2. 拷贝补丁包 |
| 91 | + |
| 92 | +执行以下指令,拷贝补丁包: |
| 93 | + |
| 94 | +~~~bash |
| 95 | +cd ~/T113i_DevKitF_Tina5SDK |
| 96 | +cp * ~/T113i-Tina5.0-v1.2-SDK -rfvd |
| 97 | +~~~ |
| 98 | + |
| 99 | +## 三、编译SDK |
| 100 | + |
| 101 | +### 1. 下载编译环境依赖 |
| 102 | + |
| 103 | +编译SDK需要依赖虚拟机的环境,为了顺利编译SDK,执行如下指令: |
| 104 | + |
| 105 | +~~~bash |
| 106 | +sudo apt-get update |
| 107 | +sudo apt-get install build-essential subversion git libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip lib32z1 lib32z1-dev lib32stdc++6 libstdc++6 libc6:i386 libstdc++6:i386 lib32ncurses5 lib32z1 bison -y |
| 108 | +~~~ |
| 109 | + |
| 110 | +### 2. 编译固件 |
| 111 | + |
| 112 | +进入源码目录,执行: |
| 113 | + |
| 114 | +~~~bash |
| 115 | +cd ~/T113i-Tina5.0-v1.2-SDK |
| 116 | +source build/envsetup.sh |
| 117 | +~~~ |
| 118 | + |
| 119 | +打印信息如下: |
| 120 | + |
| 121 | +~~~bash |
| 122 | +ubuntu@ubuntu1804:~/T113i-Tina5.0-v1.2-SDK$ source build/envsetup.sh |
| 123 | +NOTE: The SDK(/home/ubuntu/T113i-Tina5.0-v1.2-SDK) was successfully loaded |
| 124 | +load openwrt... ok |
| 125 | +Please run lunch next for openwrt. |
| 126 | +load buildroot,bsp...ok |
| 127 | +Invoke . build/quick.sh from your shell to add the following functions to your environment: |
| 128 | + croot / cl - Changes directory to the top of the tree |
| 129 | + cbrandy - Changes directory to the brandy |
| 130 | + cspl / cboot0 - Changes directory to the spl |
| 131 | + csbi[10|14] / copensbi[10|14] - Changes directory to the opensbi |
| 132 | + cu / cuboot / cboot - Changes directory to the uboot |
| 133 | + cubsp / cubootbsp / cbootbsp - Changes directory to the uboot-bsp |
| 134 | + carisc - Changes directory to the arisc |
| 135 | + ck / ckernel - Changes directory to the kernel |
| 136 | + cbsp - Changes directory to the bsp |
| 137 | + cbsptest - Changes directory to the bsptest |
| 138 | + cdts - Changes directory to the kernel's dts |
| 139 | + cchip / cchips - Changes directory to the chip |
| 140 | + cbin - Changes directory to the chip's bin |
| 141 | + cboard / cconfigs / cbd - Changes directory to the board |
| 142 | + crootfs - Changes directory to the rootfs |
| 143 | + cdsp - Changes directory to the dsp |
| 144 | + crtos - Changes directory to the rtos |
| 145 | + crtoshal / crtos-hal - Changes directory to the rtos-hal |
| 146 | + cbuild - Changes directory to the build |
| 147 | + cbr - Changes directory to the buildroot |
| 148 | + copenssl - Changes directory to the product's openssl-1.0.0 |
| 149 | + cout - Changes directory to the product's output |
| 150 | + ckout / ckernelout - Changes directory to the kernel output |
| 151 | + ctarget - Changes directory to the target |
| 152 | + chostbin - Changes directory to the hostbin |
| 153 | + cplat - Changes directory to the platform |
| 154 | + ccommon - Changes directory to the common |
| 155 | +Usage: build.sh [args] |
| 156 | + build.sh - default build all |
| 157 | + build.sh bootloader - only build bootloader |
| 158 | + build.sh kernel - only build kernel |
| 159 | + build.sh buildroot_rootfs - only build buildroot |
| 160 | + build.sh uboot_menuconfig - edit uboot menuconfig |
| 161 | + build.sh uboot_saveconfig - save uboot menuconfig |
| 162 | + build.sh menuconfig - edit kernel menuconfig |
| 163 | + build.sh saveconfig - save kernel menuconfig |
| 164 | + build.sh recovery_menuconfig - edit recovery menuconfig |
| 165 | + build.sh recovery_saveconfig - save recovery menuconfig |
| 166 | + build.sh buildroot_menuconfig - edit buildroot menuconfig |
| 167 | + build.sh buildroot_saveconfig - save buildroot menuconfig |
| 168 | + build.sh clean - clean all |
| 169 | + build.sh distclean - distclean all |
| 170 | + build.sh pack - pack firmware |
| 171 | + build.sh pack_debug - pack firmware with debug info output to card0 |
| 172 | + build.sh pack_secure - pack firmware with secureboot |
| 173 | +Usage: pack [args] |
| 174 | + pack - pack firmware |
| 175 | + pack -d - pack firmware with debug info output to card0 |
| 176 | + pack -s - pack firmware with secureboot |
| 177 | + pack -sd - pack firmware with secureboot and debug info output to card0 |
| 178 | +~~~ |
| 179 | + |
| 180 | +接下来是板级配置,根据以下选项选择(**如果发现序号不一样,只选择与下面同名字的选项**): |
| 181 | + |
| 182 | +- All available platform: `linux` |
| 183 | +- All available linux_dev: `buildroot` |
| 184 | +- All available ic: `t113_i` |
| 185 | +- All available board: `evb1_auto` |
| 186 | +- All available flash: `default` |
| 187 | + |
| 188 | +执行指令如下: |
| 189 | + |
| 190 | +~~~bash |
| 191 | +./build.sh config |
| 192 | +~~~ |
| 193 | + |
| 194 | +相关打印信息如下: |
| 195 | + |
| 196 | +~~~bash |
| 197 | +ubuntu@ubuntu1804:~/T113i-Tina5.0-v1.2-SDK$ ./build.sh config |
| 198 | +08-01 06:25:47.354 4934 D mkcommon : ========ACTION List: mk_config ;======== |
| 199 | +08-01 06:25:47.355 4934 D mkcommon : options : |
| 200 | +All available platform: |
| 201 | + 0. android |
| 202 | + 1. linux |
| 203 | +Choice [linux]: 1 |
| 204 | +All available linux_dev: |
| 205 | + 0. bsp |
| 206 | + 1. buildroot |
| 207 | + 2. openwrt |
| 208 | +Choice [buildroot]: 1 |
| 209 | +All available ic: |
| 210 | + 0. t113 |
| 211 | + 1. t113_i |
| 212 | +Choice [t113_i]: 1 |
| 213 | +All available board: |
| 214 | + 0. evb1_auto |
| 215 | +Choice [evb1_auto]: 0 |
| 216 | +All available flash: |
| 217 | + 0. default |
| 218 | + 1. nor |
| 219 | +Choice [default]: 0 |
| 220 | +08-01 06:26:02.140 4934 I mkcommon : kernel relative recovery defconfig: ../../../../../device/config/chips/t113_i/configs/evb1_auto/linux-5.4/config-5.4-recovery |
| 221 | +08-01 06:26:02.141 4934 I mkcommon : kernel absolute recovery defconfig: /home/ubuntu/T113i-Tina5.0-v1.2-SDK/device/config/chips/t113_i/configs/evb1_auto/linux-5.4/config-5.4-recovery |
| 222 | +08-01 06:26:02.158 4934 I mkcommon : Prepare toolchain ... |
| 223 | +08-01 06:26:02.193 4934 I mkcommon : kernel defconfig: generate /home/ubuntu/T113i-Tina5.0-v1.2-SDK/out/t113_i/kernel/build/.config by /home/ubuntu/T113i-Tina5.0-v1.2-SDK/device/config/chips/t113_i/configs/evb1_auto/linux-5.4/config-5.4 |
| 224 | +08-01 06:26:02.195 4934 I mkcommon : Prepare toolchain ... |
| 225 | +08-01 06:26:02.231 4934 D mkcommon : make: Entering directory '/home/ubuntu/T113i-Tina5.0-v1.2-SDK/kernel/linux-5.4' |
| 226 | +08-01 06:26:02.235 4934 D mkcommon : make[1]: Entering directory '/home/ubuntu/T113i-Tina5.0-v1.2-SDK/out/t113_i/kernel/build' |
| 227 | +08-01 06:26:02.379 4934 D mkcommon : GEN Makefile |
| 228 | +08-01 06:26:02.402 4934 D mkcommon : *** Default configuration is based on '../../../../../device/config/chips/t113_i/configs/evb1_auto/linux-5.4/config-5.4' |
| 229 | +08-01 06:26:02.798 4934 D mkcommon : # |
| 230 | +08-01 06:26:02.799 4934 D mkcommon : # No change to .config |
| 231 | +08-01 06:26:02.800 4934 D mkcommon : # |
| 232 | +08-01 06:26:02.801 4934 D mkcommon : make[1]: Leaving directory '/home/ubuntu/T113i-Tina5.0-v1.2-SDK/out/t113_i/kernel/build' |
| 233 | +08-01 06:26:02.803 4934 D mkcommon : make: Leaving directory '/home/ubuntu/T113i-Tina5.0-v1.2-SDK/kernel/linux-5.4' |
| 234 | +make: Entering directory '/home/ubuntu/T113i-Tina5.0-v1.2-SDK/buildroot/buildroot-201902' |
| 235 | + GEN /home/ubuntu/T113i-Tina5.0-v1.2-SDK/out/t113_i/evb1_auto/buildroot/buildroot/Makefile |
| 236 | +../config/buildroot/allwinner/display/gpu_um_pub/Config.in:21:warning: config symbol defined without type |
| 237 | +Config.in.legacy:1769:warning: choice value used outside its choice group |
| 238 | +# |
| 239 | +# configuration written to /home/ubuntu/T113i-Tina5.0-v1.2-SDK/out/t113_i/evb1_auto/buildroot/buildroot/.config |
| 240 | +# |
| 241 | +make: Leaving directory '/home/ubuntu/T113i-Tina5.0-v1.2-SDK/buildroot/buildroot-201902' |
| 242 | +08-01 06:26:03.152 4934 I mkcommon : buildroot defconfig is sun8iw20p1_t113_defconfig |
| 243 | +08-01 06:26:03.439 4934 I mkcommon : clean buildserver |
| 244 | +08-01 06:26:03.442 4934 I mkcommon : prepare_buildserver |
| 245 | +~~~ |
| 246 | + |
| 247 | +接着,开始编译SDK,执行以下指令(这里打印信息省略): |
| 248 | + |
| 249 | +~~~bash |
| 250 | +./build.sh |
| 251 | +~~~ |
| 252 | + |
| 253 | +出现以下信息,即是编译成功: |
| 254 | + |
| 255 | +~~~bash |
| 256 | +08-01 06:29:51.482 6805 D mkcommon : root (0) |
| 257 | +08-01 06:29:51.483 6805 D mkcommon : Number of gids 1 |
| 258 | +08-01 06:29:51.484 6805 D mkcommon : root (0) |
| 259 | +08-01 06:29:51.486 6805 I mkcommon : pack rootfs ok ... |
| 260 | +08-01 06:29:51.487 6805 I mkcommon : ---------------------------------------- |
| 261 | +08-01 06:29:51.488 6805 I mkcommon : build OK. |
| 262 | +08-01 06:29:51.490 6805 I mkcommon : ---------------------------------------- |
| 263 | +~~~ |
| 264 | + |
| 265 | +编译完成后,打包固件,执行指令如下: |
| 266 | + |
| 267 | +~~~bash |
| 268 | +./build.sh pack |
| 269 | +~~~ |
| 270 | + |
| 271 | +最后,固件会存放在 `/home/ubuntu/T113i-Tina5.0-v1.2-SDK/out/t113_i_linux_evb1_auto_uart0.img`: |
| 272 | + |
| 273 | +~~~bash |
| 274 | +08-01 06:30:52.516 28395 D pack : FileLength=c0381c4 |
| 275 | +08-01 06:30:52.518 28395 D pack : BuildImg0 |
| 276 | +08-01 06:30:52.519 28395 D pack : Dragon execute image.cfg SUCCESS ! |
| 277 | +08-01 06:30:52.772 28395 D pack : ----------image is at---------- |
| 278 | +08-01 06:30:52.773 28395 I pack : 275M /home/ubuntu/T113i-Tina5.0-v1.2-SDK/out/t113_i_linux_evb1_auto_uart0.img |
| 279 | +08-01 06:30:52.775 28395 D pack : pack finish |
| 280 | +~~~ |
| 281 | + |
| 282 | +### 3. 烧录固件 |
| 283 | + |
| 284 | +参考 [更新系统固件 | 东山Π](https://docs.100ask.net/dshanpi/docs/T113i-Industrial/part1/03-1_FlashSystem) 文档进行烧录我们编译出来的固件。 |
| 285 | + |
| 286 | +## 四、TFT和HDMI屏幕显示效果 |
| 287 | + |
| 288 | +烧录固件之后,默认会启动程序。 |
| 289 | + |
| 290 | +可以看到TFT屏显示如下: |
| 291 | + |
| 292 | + |
| 293 | + |
| 294 | +接上HDMI屏幕,显示如下: |
| 295 | + |
| 296 | + |
0 commit comments