README.md
1# How to Create CMSIS-Pack
2
3
4
5## STEP 1 Update 'lv_conf_cmsis.h'
6
71. Copy the **lv_conf_template.h** to '**cmsis-pack**' directory
8
92. Set the macro protector to '1'
10
11```c
12...
13/* clang-format off */
14#if 1 /*Set it to "1" to enable content*/
15...
16```
17
18remove the misleading guide above this code segment.
19
20```c
21/*
22 * Copy this file as `lv_conf.h`
23 * 1. simply next to the `lvgl` folder
24 * 2. or any other places and
25 * - define `LV_CONF_INCLUDE_SIMPLE`
26 * - add the path as include path
27 */
28```
29
30
313. Add including for '**RTE_Components.h**'
32
33```c
34#ifndef LV_CONF_H
35#define LV_CONF_H
36
37#include "RTE_Components.h"
38...
39```
404. Remove macro definitions for
41
42 - LV_USE_DEMO_WIDGETS
43 - LV_USE_DEMO_BENCHMARK
44 - LV_USE_IME_PINYIN
45 - LV_USE_OS
46 - LV_USE_FILE_EXPLORER
47 - LV_USE_DEMO_WIDGETS
48 - LV_USE_DEMO_KEYPAD_AND_ENCODER
49 - LV_USE_DEMO_BENCHMARK
50 - LV_USE_DEMO_RENDER
51 - LV_USE_DEMO_STRESS
52 - LV_USE_DEMO_MUSIC
53 - LV_USE_DEMO_FLEX_LAYOUT
54 - LV_USE_DEMO_MULTILANG
55 - LV_USE_DEMO_TRANSFORM
56 - LV_USE_DEMO_SCROLL
57 - LV_USE_DEMO_VECTOR_GRAPHIC
58 - LV_USE_DEMO_EBIKE
59 - LV_USE_DRAW_VGLITE
60 - LV_USE_DRAW_VG_LITE
61 - LV_USE_PXP
62 - LV_USE_DRAW_SDL
63 - LV_USE_DRAW_ARM2D_SYNC
64 - LV_USE_DRAW_ARM2D_ASYNC
65 - LV_USE_DRAW_DAVE2D
66 - LV_USE_DRAW_DMA2D
67 - LV_USE_SNAPSHOT
68 - LV_USE_MONKEY
69 - LV_USE_GRIDNAV
70 - LV_USE_FRAGMENT
71 - LV_USE_IMGFONT
72 - LV_USE_LINUX_DRM
73 - LV_USE_LINUX_FBDEV
74 - LV_USE_WINDOWS
75 - LV_USE_TFT_ESPI
76 - LV_USE_ST7735
77 - LV_USE_ST7789
78 - LV_USE_ST7796
79 - LV_USE_ST_LTDC
80 - LV_USE_ILI9341
81 - LV_USE_RENESAS_GLCDC
82 - LV_USE_NEMA_GFX
83 - LV_USE_SVG
845. Update `LV_LOG_PRINTF` to `1` and `LV_LOG_LEVEL` to `LV_LOG_LEVEL_USER`
85
86
876. Set `LV_FONT_MONTSERRAT_12`, ``LV_FONT_MONTSERRAT_20`, `LV_FONT_MONTSERRAT_24`, `LV_FONT_MONTSERRAT_26` and `LV_FONT_MONTSERRAT_16` to `1` (So Widgets and Benchmark can be compiled correctly, this is for improving the out of box experience.)
88
89
907. Update macro `LV_ATTRIBUTE_MEM_ALIGN` and `LV_ATTRIBUTE_MEM_ALIGN_SIZE` to force a WORD alignment.
91```c
92#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1
93#define LV_DRAW_BUF_STRIDE_ALIGN 4
94#define LV_ATTRIBUTE_MEM_ALIGN __attribute__((aligned(4)))
95```
96Make sure `LV_MEM_SIZE` is no less than `(128*1024U)`.
97
988. Remove following macro definitions in the `3rd party libraries` section:
99
100 - \#define LV_USE_FS_STDIO 0
101 - \#define LV_USE_FS_POSIX 0
102 - \#define LV_USE_FS_WIN32 0
103 - \#define LV_USE_FS_FATFS 0
104 - #define LV_USE_FS_LITTLEFS 0
105 - #define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0
106 - #define LV_USE_FS_ARDUINO_SD 0
107 - #define LV_USE_FS_MEMFS 0
108 - \#define LV_USE_LODEPNG 0
109 - #define LV_USE_LIBPNG 0
110 - \#define LV_USE_BMP 0
111 - \#define LV_USE_RLE 0
112 - #define LV_USE_TJPGD 0
113 - #define LV_USE_LIBJPEG_TURBO 0
114 - \#define LV_USE_GIF 0
115 - \#define LV_USE_BARCODE 0
116 - \#define LV_USE_QRCODE 0
117 - \#define LV_USE_FREETYPE 0
118 - \#define LV_USE_TINY_TTF 0
119 - \#define LV_USE_RLOTTIE 0
120 - \#define LV_USE_FFMPEG 0
121 - #define LV_USE_FONT_MANAGER 0
122
1239. update the definition of following macros: `LV_USE_VECTOR_GRAPHIC`, `LV_USE_THORVE_INTERNAL` and `LV_USE_THORVE_EXTERNAL` as
124
125 ```c
126 /*Enable Vector Graphic APIs*/
127 #ifndef LV_USE_VECTOR_GRAPHIC
128 # define LV_USE_VECTOR_GRAPHIC 0
129
130 /* Enable ThorVG (vector graphics library) from the src/libs folder */
131 # define LV_USE_THORVG_INTERNAL 0
132
133 /* Enable ThorVG by assuming that its installed and linked to the project */
134 # define LV_USE_THORVG_EXTERNAL 0
135 #endif
136 ```
137
13810. update the definition of following macros: `LV_USE_LZ4`, `LV_USE_LZ4_INTERNAL` and `LV_USE_LZ4_EXTERNAL` as
139
140 ```c
141 /*Enable LZ4 compress/decompress lib*/
142 #ifndef LV_USE_LZ4
143 # define LV_USE_LZ4 0
144
145 /*Use lvgl built-in LZ4 lib*/
146 # define LV_USE_LZ4_INTERNAL 0
147
148 /*Use external LZ4 library*/
149 # define LV_USE_LZ4_EXTERNAL 0
150 #endif
151 ```
152
153
15411. Add the following code to `HAL SETTINGS`:
155
156```c
157/*customize tick-get */
158#if defined(__PERF_COUNTER__) && __PERF_COUNTER__
159 #define LV_GLOBAL_INIT(__GLOBAL_PTR) \
160 do { \
161 lv_global_init((lv_global_t *)(__GLOBAL_PTR)); \
162 extern uint32_t perfc_tick_get(void); \
163 (__GLOBAL_PTR)->tick_state.tick_get_cb = perfc_tick_get; \
164 } while(0)
165#endif
166```
167
168
169
17012. Replace the macro definition:
171
172```c
173#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE
174```
175
176with:
177
178```c
179 #if !defined(LV_USE_DRAW_SW_ASM) && defined(RTE_Acceleration_Arm_2D)
180 /*turn-on helium acceleration when Arm-2D and the Helium-powered device are detected */
181 #if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE
182 #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_HELIUM
183 #define LV_USE_DRAW_ARM2D_SYNC 1
184 #endif
185 #endif
186
187 #ifndef LV_USE_DRAW_SW_ASM
188 #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE
189 #endif
190```
191
19213. Update macro `LV_PROFILER_INCLUDE`:
193
194```c
195#define LV_PROFILER_INCLUDE "src/misc/lv_profiler_builtin.h"
196```
197
198
199
20014. Add the following macro definition to **COLOR SETTINGS** section:
201
202```c
203/** Swap the high and low bytes for RGB565 */
204#define LV_COLOR_16_SWAP 0
205```
206
207
208
20914. rename '**lv_conf_template.h**' to '**lv_conf_cmsis.h**'.
210
211
212
213## STEP 2 Check, Update and Run the 'gen_pack.sh'
214
215```sh
216if [ `uname -s` = "Linux" ]
217 then
218 CMSIS_PACK_PATH="/home/$USER/.arm/Packs/ARM/CMSIS/5.7.0/"
219 PATH_TO_ADD="$CMSIS_PACK_PATH/CMSIS/Utilities/Linux64/"
220else
221 CMSIS_PACK_PATH="/C/Users/$USER/AppData/Local/Arm/Packs/ARM/CMSIS/5.7.0"
222 PATH_TO_ADD="/C/Program Files (x86)/7-Zip/:$CMSIS_PACK_PATH/CMSIS/Utilities/Win32/:/C/xmllint/"
223fi
224[[ ":$PATH:" != *":$PATH_TO_ADD}:"* ]] && PATH="${PATH}:${PATH_TO_ADD}"
225echo $PATH_TO_ADD appended to PATH
226echo " "
227```
228
229
230
231### A. For Windows users
232
233Update the '**CMSIS_PACK_PATH**' accordingly (Usually just replace the name gabriel with your own windows account name is sufficient.).
234
235Update the '**PATH_TO_ADD**' to point to the installation folders of **7Zip** and **xmllint**.
236
237Launch the git-bash and go to the cmsis-pack folder.
238
239enter the following command:
240
241```sh
242./gen_pack.sh
243```
244
245
246
247### B. For Linux Users
248
249Update '**PATH_TO_ADD**' if necessary.
250
251go to the **cmsis-pack** folder.
252
253enter the following command:
254
255```sh
256./gen_pack.sh
257```
258