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 <stdint.h> 38#if defined(_RTE_) 39 #include "RTE_Components.h" 40#endif 41... 42``` 43 444. Remove macro definitions for 45 - LV_USE_GPU_STM32_DMA2D 46 - LV_USE_GPU_NXP_PXP 47 - LV_USE_GPU_NXP_VG_LITE 48 - LV_USE_GPU_SWM341_DMA2D 49 - LV_USE_GPU_ARM2D 50 - LV_USE_IME_PINYIN 51 - LV_USE_PNG 52 - LV_USE_BMP 53 - LV_USE_SJPG 54 - LV_USE_GIF 55 - LV_USE_QRCODE 56 - LV_USE_FREETYPE 57 - LV_USE_TINY_TTF 58 - LV_USE_RLOTTIE 59 - LV_USE_FFMPEG 60 - LV_USE_SNAPSHOT 61 - LV_USE_MONKEY 62 - LV_USE_GRIDNAV 63 - LV_USE_FRAGMENT 64 - LV_USE_IMGFONT 65 - LV_USE_MSG 66 - LV_USE_IME_PINYIN 675. Update macro `LV_ATTRIBUTE_MEM_ALIGN` and `LV_ATTRIBUTE_MEM_ALIGN_SIZE` to force a WORD alignment. 68```c 69#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 4 70#define LV_ATTRIBUTE_MEM_ALIGN __attribute__((aligned(4))) 71``` 72Update macro `LV_MEM_SIZE` to `(64*1024U)`. 73 74Update macro `LV_FONT_MONTSERRAT_12` to `1`. 75 76Update macro `LV_FONT_MONTSERRAT_12` to `1`. 77 786. Update Theme related macros: 79 80```c 81#ifdef RTE_GRAPHICS_LVGL_USE_EXTRA_THEMES 82 /*A simple, impressive and very complete theme*/ 83 #define LV_USE_THEME_DEFAULT 1 84 #if LV_USE_THEME_DEFAULT 85 86 /*0: Light mode; 1: Dark mode*/ 87 #define LV_THEME_DEFAULT_DARK 0 88 89 /*1: Enable grow on press*/ 90 #define LV_THEME_DEFAULT_GROW 1 91 92 /*Default transition time in [ms]*/ 93 #define LV_THEME_DEFAULT_TRANSITION_TIME 80 94 #endif /*LV_USE_THEME_DEFAULT*/ 95 96 /*A very simple theme that is a good starting point for a custom theme*/ 97 #define LV_USE_THEME_BASIC 1 98 99 /*A theme designed for monochrome displays*/ 100 #define LV_USE_THEME_MONO 1 101#else 102 #define LV_USE_THEME_DEFAULT 0 103 #define LV_USE_THEME_BASIC 0 104 #define LV_USE_THEME_MONO 0 105#endif 106``` 1077. Update `LV_TICK_CUSTOM` related macros: 108```c 109/*Use a custom tick source that tells the elapsed time in milliseconds. 110 *It removes the need to manually update the tick with `lv_tick_inc()`)*/ 111#ifdef __PERF_COUNTER__ 112 #define LV_TICK_CUSTOM 1 113 #if LV_TICK_CUSTOM 114 extern uint32_t SystemCoreClock; 115 #define LV_TICK_CUSTOM_INCLUDE "perf_counter.h" 116 #define LV_TICK_CUSTOM_SYS_TIME_EXPR get_system_ms() 117 #endif /*LV_TICK_CUSTOM*/ 118#else 119 #define LV_TICK_CUSTOM 0 120 #if LV_TICK_CUSTOM 121 #define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ 122 #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ 123 /*If using lvgl as ESP32 component*/ 124 // #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h" 125 // #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL)) 126 #endif /*LV_TICK_CUSTOM*/ 127#endif /*__PERF_COUNTER__*/ 128``` 129 130 1319. Remove all content in `DEMO USAGE` section but keep the following: 132 133```c 134/*Show some widget. It might be required to increase `LV_MEM_SIZE` */ 135#if LV_USE_DEMO_WIDGETS 136 #define LV_DEMO_WIDGETS_SLIDESHOW 0 137#endif 138 139/*Benchmark your system*/ 140#if LV_USE_DEMO_BENCHMARK 141/*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/ 142 #define LV_DEMO_BENCHMARK_RGB565A8 1 143#endif 144``` 145 146 147 14810. Thoroughly remove the `3rd party libraries` section. 14911. rename '**lv_conf_template.h**' to '**lv_conf_cmsis.h**'. 150 151 152 153## STEP 2 Check, Update and Run the 'gen_pack.sh' 154 155```sh 156if [ `uname -s` = "Linux" ] 157 then 158 CMSIS_PACK_PATH="/home/$USER/.arm/Packs/ARM/CMSIS/5.7.0/" 159 PATH_TO_ADD="$CMSIS_PACK_PATH/CMSIS/Utilities/Linux64/" 160else 161 CMSIS_PACK_PATH="/C/Users/gabriel/AppData/Local/Arm/Packs/ARM/CMSIS/5.7.0" 162 PATH_TO_ADD="/C/Program Files (x86)/7-Zip/:$CMSIS_PACK_PATH/CMSIS/Utilities/Win32/:/C/xmllint/" 163fi 164[[ ":$PATH:" != *":$PATH_TO_ADD}:"* ]] && PATH="${PATH}:${PATH_TO_ADD}" 165echo $PATH_TO_ADD appended to PATH 166echo " " 167``` 168 169 170 171### A. For Windows users 172 173Update the '**CMSIS_PACK_PATH**' accordingly (Usually just replace the name gabriel with your own windows account name is sufficient.). 174 175Update the '**PATH_TO_ADD**' to point to the installation folders of **7Zip** and **xmllint**. 176 177Launch the git-bash and go to the cmsis-pack folder. 178 179enter the following command: 180 181```sh 182./gen_pack.sh 183``` 184 185 186 187### B. For Linux Users 188 189Update '**PATH_TO_ADD**' if necessary. 190 191go to the **cmsis-pack** folder. 192 193enter the following command: 194 195```sh 196./gen_pack.sh 197``` 198 199