【前言】
Zephyr已经支持STM32H747的官方开发板。本篇将分享如何实现零代码体验LVGL。
【开发环境】
1、wsl2
2、west
【实现步骤】
1、复制lvgl demo工程
cp -r ~/zephyrproject/zephyr/samples/modules/lvgl/demos/ h747_lvgl_demos
2、加载虚拟环境:
~/zephyrproject/app/stm32h747/hello_world$ source ~/zephyrproject/zephyr/zephyr-env.sh
3、进入lcd工程
cd h747_lvgl_demos/ CMakeLists.txt README.rst boards build prj.conf src
4、在stm32h747的网页中,如果使用lcd屏,必须指定设备树:

经查看屏的型号为MB1166-A09,因此在编译时需要指定参数如下:
west build -b stm32h747i_disco/stm32h747xx/m7 --shield st_b_lcd40_dsi1_mb1166_a09
5、编译
west build -p auto -b stm32h747i_disco/stm32h747xx/m7 --shield st_b_lcd40_dsi1_mb1166_a09 -- Zephyr version: 4.3.0 (/home/lugl/zephyrproject/zephyr), build: v4.3.0 [600/600] Linking C executable zephyr/zephyr.elf Memory region Used Size Region Size %age Used FLASH: 966044 B 1 MB 92.13% RAM: 147104 B 512 KB 28.06% EXTMEM: 0 GB 64 MB 0.00% SRAM0: 0 GB 512 KB 0.00% SRAM1: 0 GB 128 KB 0.00% SRAM2: 0 GB 128 KB 0.00% SRAM3: 16 KB 32 KB 50.00% SRAM4: 0 GB 64 KB 0.00% SDRAM2: 3000 KB 32 MB 9.16% IDT_LIST: 0 GB 32 KB 0.00% Generating files from /home/lugl/zephyrproject/app/stm32h747/h747_lvgl_demos/build/zephyr/zephyr.elf for board: stm32h747i_disco
7、下载
加载st-link到wsl中
PS C:WINDOWSsystem32> usbipd attach --wsl --busid 2-2 usbipd: info: Using WSL distribution 'Ubuntu-22.04' to attach; the device will be available in all WSL 2 distributions. usbipd: info: Detected networking mode 'nat'. usbipd: info: Using IP address 172.29.112.1 to reach the host.
然后执行下载:
lugl@lugl:~/zephyrproject/app/stm32h747/blinky$ west flash --runner openocd )

画面非常清晰,但是运行时会有一点闪,想要非常好的效果,还需要自己调整一下参数。
【总结】
stm32H747已经完美的适配好zephyr生态,可以非常快速的创建开发环境。可以轻松实现零代码体验LVGL。
我要赚赏金
