2022-01-19 21:31:02 +00:00
# How to Create CMSIS-Pack
## STEP 1 Update 'lv_conf_cmsis.h'
1. Copy the **lv_conf_template.h** to '**cmsis-pack**' directory
2023-11-13 15:38:27 +08:00
2. Set the macro protector to '1'
2022-01-19 21:31:02 +00:00
```c
...
/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
...
```
2022-04-14 12:28:34 +01:00
remove the misleading guide above this code segment.
```c
/*
* Copy this file as `lv_conf.h`
* 1. simply next to the `lvgl` folder
* 2. or any other places and
* - define `LV_CONF_INCLUDE_SIMPLE`
* - add the path as include path
*/
```
2022-01-19 21:31:02 +00:00
3. Add including for '**RTE_Components.h**'
```c
#ifndef LV_CONF_H
#define LV_CONF_H
#include "RTE_Components.h"
...
```
2023-12-11 13:33:53 +00:00
4. Remove macro definitions for
2022-01-19 21:31:02 +00:00
2023-01-17 15:09:27 +08:00
- LV_USE_DEMO_WIDGETS
2023-12-27 03:10:16 +00:00
2023-01-17 15:09:27 +08:00
- LV_USE_DEMO_BENCHMARK
2023-12-27 03:10:16 +00:00
2022-07-01 19:20:48 +01:00
- LV_USE_IME_PINYIN
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_OS
2023-12-27 03:10:16 +00:00
2022-09-19 10:50:33 +01:00
- LV_USE_FILE_EXPLORER
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_WIDGETS
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_KEYPAD_AND_ENCODER
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_BENCHMARK
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_RENDER
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_STRESS
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_MUSIC
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_FLEX_LAYOUT
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_MULTILANG
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_TRANSFORM
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_SCROLL
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DEMO_VECTOR_GRAPHIC
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DRAW_VGLITE
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DRAW_PXP
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_DRAW_SDL
2023-12-27 03:10:16 +00:00
- LV_USE_DRAW_ARM2D
2023-12-11 13:33:53 +00:00
- LV_USE_SNAPSHOT
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_MONKEY
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_GRIDNAV
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_FRAGMENT
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
- LV_USE_IMGFONT
2023-12-27 03:10:16 +00:00
2024-01-14 11:36:42 +00:00
- LV_USE_LINUX_DRM
- LV_USE_TFT_ESPI
- LV_USE_ST7735
- LV_USE_ST7789
- LV_USE_ST7796
- LV_USE_ILI9341
2023-12-27 03:10:16 +00:00
2023-12-11 13:33:53 +00:00
5. Update `LV_LOG_PRINTF` to `1` and `LV_LOG_LEVEL` to `LV_LOG_LEVEL_USER`
2023-12-27 03:10:16 +00:00
6. Set `LV_FONT_MONTSERRAT_12` , `LV_FONT_MONTSERRAT_24` and `LV_FONT_MONTSERRAT_16` to `1` (So Widgets and Benchmark can be compiled correctly, this is for improving the out of box experience.)
2023-12-11 13:33:53 +00:00
7. Update macro `LV_ATTRIBUTE_MEM_ALIGN` and `LV_ATTRIBUTE_MEM_ALIGN_SIZE` to force a WORD alignment.
2022-01-19 21:31:02 +00:00
```c
2023-12-27 03:10:16 +00:00
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1
2023-12-11 13:33:53 +00:00
#define LV_DRAW_BUF_STRIDE_ALIGN 4
2022-04-27 13:29:01 +01:00
#define LV_ATTRIBUTE_MEM_ALIGN __attribute__((aligned(4)))
2022-01-19 21:31:02 +00:00
```
2023-12-11 13:33:53 +00:00
Make sure `LV_MEM_SIZE` is no less than `(256*1024U)` .
2022-08-02 07:01:12 +01:00
2023-12-11 13:33:53 +00:00
8. Remove following macro definitions in the `3rd party libraries` section:
2022-11-29 07:29:13 +00:00
- \#define LV_USE_FS_STDIO 0
- \#define LV_USE_FS_POSIX 0
- \#define LV_USE_FS_WIN32 0
- \#define LV_USE_FS_FATFS 0
2023-12-11 13:33:53 +00:00
- #define LV_USE_FS_MEMFS 0
2023-09-20 16:30:04 +08:00
- \#define LV_USE_LODEPNG 0
2023-12-11 13:33:53 +00:00
- #define LV_USE_LIBPNG 0
2022-11-29 07:29:13 +00:00
- \#define LV_USE_BMP 0
2023-11-13 15:38:27 +08:00
- \#define LV_USE_RLE 0
2023-12-11 13:33:53 +00:00
- #define LV_USE_TJPGD 0
- #define LV_USE_LIBJPEG_TURBO 0
2022-11-29 07:29:13 +00:00
- \#define LV_USE_GIF 0
2023-02-27 16:17:28 +00:00
- \#define LV_USE_BARCODE 0
2022-11-29 07:29:13 +00:00
- \#define LV_USE_QRCODE 0
- \#define LV_USE_FREETYPE 0
- \#define LV_USE_TINY_TTF 0
- \#define LV_USE_RLOTTIE 0
- \#define LV_USE_FFMPEG 0
2023-12-11 13:33:53 +00:00
9. update the definition of following macros: `LV_USE_VECTOR_GRAPHIC` , `LV_USE_THORVE_INTERNAL` and `LV_USE_THORVE_EXTERNAL` as
```c
/*Enable Vector Graphic APIs*/
#ifndef LV_USE_VECTOR_GRAPHIC
# define LV_USE_VECTOR_GRAPHIC 0
/* Enable ThorVG (vector graphics library) from the src/libs folder */
# define LV_USE_THORVG_INTERNAL 0
/* Enable ThorVG by assuming that its installed and linked to the project */
# define LV_USE_THORVG_EXTERNAL 0
#endif
```
10. update the definition of following macros: `LV_USE_LZ4` , `LV_USE_LZ4_INTERNAL` and `LV_USE_LZ4_EXTERNAL` as
```c
/*Enable LZ4 compress/decompress lib*/
#ifndef LV_USE_LZ4
# define LV_USE_LZ4 0
/*Use lvgl built-in LZ4 lib*/
# define LV_USE_LZ4_INTERNAL 0
/*Use external LZ4 library*/
# define LV_USE_LZ4_EXTERNAL 0
#endif
```
2023-12-27 03:10:16 +00:00
11. Add the following code to `HAL SETTINGS` :
```c
/*customize tick-get */
#if defined(__PERF_COUNTER__) && __PERF_COUNTER__
#define LV_GLOBAL_INIT(__GLOBAL_PTR) \
do { \
lv_global_init((lv_global_t *)(__GLOBAL_PTR)); \
extern uint32_t perfc_tick_get(void); \
(__GLOBAL_PTR)->tick_state.tick_get_cb = perfc_tick_get; \
} while(0)
#endif
```
12. Replace the macro definition:
```c
#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE
```
with:
```c
#if !defined(LV_USE_DRAW_SW_ASM) && defined(RTE_Acceleration_Arm_2D)
/*turn-on helium acceleration when Arm-2D and the Helium-powered device are detected */
#if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE
#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_HELIUM
#define LV_USE_DRAW_ARM2D 1
#endif
#endif
#ifndef LV_USE_DRAW_SW_ASM
#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE
#endif
```
13. rename '**lv_conf_template.h**' to '**lv_conf_cmsis.h**'.
2022-01-19 21:31:02 +00:00
## STEP 2 Check, Update and Run the 'gen_pack.sh'
```sh
if [ `uname -s` = "Linux" ]
then
CMSIS_PACK_PATH="/home/$USER/.arm/Packs/ARM/CMSIS/5.7.0/"
PATH_TO_ADD="$CMSIS_PACK_PATH/CMSIS/Utilities/Linux64/"
else
2023-01-17 15:09:27 +08:00
CMSIS_PACK_PATH="/C/Users/$USER/AppData/Local/Arm/Packs/ARM/CMSIS/5.7.0"
2022-01-19 21:31:02 +00:00
PATH_TO_ADD="/C/Program Files (x86)/7-Zip/:$CMSIS_PACK_PATH/CMSIS/Utilities/Win32/:/C/xmllint/"
fi
[[ ":$PATH:" != *":$PATH_TO_ADD}:"* ]] && PATH="${PATH}:${PATH_TO_ADD}"
echo $PATH_TO_ADD appended to PATH
echo " "
```
### A. For Windows users
Update the '**CMSIS_PACK_PATH**' accordingly (Usually just replace the name gabriel with your own windows account name is sufficient.).
2022-03-21 18:25:51 +08:00
Update the '**PATH_TO_ADD**' to point to the installation folders of **7Zip** and **xmllint** .
2022-01-19 21:31:02 +00:00
2022-03-21 18:25:51 +08:00
Launch the git-bash and go to the cmsis-pack folder.
2022-01-19 21:31:02 +00:00
enter the following command:
```sh
./gen_pack.sh
```
### B. For Linux Users
2022-03-21 18:25:51 +08:00
Update '**PATH_TO_ADD**' if necessary.
2022-01-19 21:31:02 +00:00
2022-03-21 18:25:51 +08:00
go to the **cmsis-pack** folder.
2022-01-19 21:31:02 +00:00
enter the following command:
```sh
./gen_pack.sh
```