Taiyou Kuo
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
###### tags: `Embedded` # lvgl 使用記錄 [TOC] 如何在實際的硬體上部署?~~請參考 https://hackmd.io/@st9540808/NUCLEO-H755ZI-Q#LVGL-%E4%B8%AD%E6%96%87%E5%AD%97%E9%AB%94~~ 請參考底下 ## 安裝 simulator (MacOS 系統) 首先需要安裝 Eclipse IDE for C/C++ Developers 下載 [lvgl/lv_port_pc_eclipse](https://github.com/lvgl/lv_port_pc_eclipse),可參考 github 中的教學,下載完之後在 eclipse 裡面使用 import 匯入整個剛剛下載的資料夾。 > 目前 simulator 搭載的 lvgl 版本為 8.3.3 > [time=Fri, Dec 9, 2022 10:53 AM] 安裝 SDL2 ``` brew install SDL2 ``` 安裝完 SDL2 之後,在專案上點右鍵選取 properties,之後把下列路徑加到 includes 跟 libraries 的設定中。 :warning: 以下 sdl2, libpng 版本號碼需要使用者自己手動確認 ``` /opt/homebrew/Cellar/sdl2/2.26.1/include /opt/homebrew/Cellar/libpng/1.6.39/include /opt/homebrew/Cellar/libpng/1.6.39/lib /opt/homebrew/Cellar/sdl2/2.26.1/lib ``` 如下圖所示 ![](https://i.imgur.com/xstpRFD.jpg) ![](https://i.imgur.com/gW3CZgM.jpg) ### simulator 實際運行 到 Debug 目錄中點擊 lv_sim_eclipse_sdl,如下圖 ![](https://i.imgur.com/Buxy7sG.png) 點擊後就會執行 simulator,同時會開啟終端機顯示輸出 (解析度已經改成 800x480) ![](https://i.imgur.com/o2LBGaB.jpg) 當人機專案很大時,可能需要在 lv_conf.h 調整動態記憶體大小: ```c #define LV_MEM_SIZE (156 * 1024U) /*[bytes]*/ ``` 如果滑動很 lag,可開啟編譯器最佳化例如 `-O2`。 ## 安裝 simulator (Windows 系統) 目前已不推薦在 Windows 上使用 Eclipse IDE,是用了很久仍然沒辦法完整編譯,因此轉而使用 Visual Studio 建置的專案。 下載 [lvgl/lv_port_win_visual_studio ](https://github.com/lvgl/lv_port_win_visual_studio) > 目前 simulator 搭載的 lvgl 版本為 8.3.3 > [time=Fri, Dec 10, 2022 10:53 AM] 實際測試可以用 Visual Studio 2022 Community 開啟 https://visualstudio.microsoft.com/zh-hant/vs/ 下載完之後用 Visual Studio 開啟 lv_port_win_visual_studio資料夾中的 sln 檔,並將 LVGL.Simulator 設成啟動專案,如下圖 ![](https://i.imgur.com/2H9lvXr.png) 按下 "本機 Windows 偵錯工具啟動" simulator ![](https://i.imgur.com/l5vg3xR.png) ### simulator 實際運行 ![](https://i.imgur.com/XLW4PmQ.png) ## 真實硬體部屬 使用 MCU 為 STM32H755,設定核心頻率為 480 Mhz,並開啟 I-Cache 與 D-Cache,編譯器最佳化使用 `-O1` ## 移植 ```c void SysTick_Handler(void) { /* USER CODE BEGIN SysTick_IRQn 0 */ /* USER CODE END SysTick_IRQn 0 */ HAL_IncTick(); #if (INCLUDE_xTaskGetSchedulerState == 1 ) if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) { #endif /* INCLUDE_xTaskGetSchedulerState */ xPortSysTickHandler(); #if (INCLUDE_xTaskGetSchedulerState == 1 ) } #endif /* INCLUDE_xTaskGetSchedulerState */ /* USER CODE BEGIN SysTick_IRQn 1 */ lv_tick_inc(1); /* USER CODE END SysTick_IRQn 1 */ } ``` ## benchmark ```c #include "lv_port_disp.h" #include "lv_port_indev.h" #include "lvgl.h" ... lv_init(); lv_port_disp_init(); lv_port_indev_init(); lv_demo_benchmark(); while (1) { lv_task_handler(); osDelay(2); } ``` ### pixel-by-pixel benchmark 若不使用 DMA,則繪圖跟傳輸像素無法平行,測出來的 FPS 也會變低 ![](https://i.imgur.com/vfIYjGd.jpg) ### MDMA benchmark 使用 MDMA 讓 lvgl 繪圖跟傳輸像素平行執行 ![](https://i.imgur.com/nWph90B.jpg) ### Application benchmark - `LV_DEF_REFR_PERIOD`: 9.0.0 之後的更新週期 - `LV_USE_PERF_MONITOR`: CPU 使用率, FPS - `LV_USE_MEM_MONITOR`: 記憶體使用率 ## 字體 ascii ```! !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ``` 標點、特殊符號 ``` ,。、?㎜ ``` 中文 https://github.com/kaienfr/Font/blob/master/learnfiles/chinese%E7%AE%80%E7%B9%81%E5%B8%B8%E7%94%A8%E5%AD%97%E8%A1%A8.txt 特殊符號 https://docs.lvgl.io/master/overview/font.html?highlight=font#add-new-symbols ```c /*------------------------------- * Symbols from "normal" font *-----------------------------*/ #if !defined LV_SYMBOL_BULLET #define LV_SYMBOL_BULLET "\xE2\x80\xA2" /*20042, 0x2022*/ #endif /*------------------------------- * Symbols from FontAwesome font *-----------------------------*/ /*In the font converter use this list as range: 61441, 61448, 61451, 61452, 61453, 61457, 61459, 61461, 61465, 61468, 61473, 61478, 61479, 61480, 61502, 61507, 61512, 61515, 61516, 61517, 61521, 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556, 61559, 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61641, 61664, 61671, 61674, 61683, 61724, 61732, 61787, 61931, 62016, 62017, 62018, 62019, 62020, 62087, 62099, 62189, 62212, 62810, 63426, 63650 */ ``` ### `notosans_24` 1. notosans-TC medium: 简繁常用字、標點 2. NotoSans-CondensedSemiBold: abc123、特殊符號 3. FontAwesome5-Solid+Brands+Regular: Symbols from FontAwesome font ## 多國語言 i18n 如何在 lvgl 的介面中使用兩種以上的語言?答案是使用 [lvgl/lv_i18n](https://github.com/lvgl/lv_i18n) 這個專案,使用上不需要 clone 下來! 首先在 wsl 中安裝 nodejs 跟 npm ```bash $ sudo apt install nodejs npm ``` 接下來安裝 lvgl/lv_i18n,`-g` 代表全域安裝 ``` $ sudo npm i lv_i18n -g ``` 最後只需要兩個命令就能使用多國語言! ``` . └──translations ├── en.yml └── zh-TW.yml ``` ```awk! awk -v FS="" -v OFS="\t" '{for(i=1;i<=NF;i++) char[$i]++} END { for(i in char) printf("%c",i)}' BuildAllTargets.cmd ./LVGL.Simulator/translations/zh-TW.yml ``` ## Visual Studio 小技巧 在解決方案中加入檔案 ![](https://i.imgur.com/uDOnGBo.png) 在解決方案中加入新的 include path https://stackoverflow.com/questions/19415521/cannot-open-include-file-with-visual-studio ![](https://i.imgur.com/Z2Ht27l.png)

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully