apps/lvgl/libs_lvgl/build.sh | ●●●●● patch | view | raw | blame | history | |
apps/lvgl/libs_lvgl/patches/gen_patch.sh | ●●●●● patch | view | raw | blame | history | |
apps/lvgl/libs_lvgl/patches/lv_demos-8.0.1-imx6ull.patch | ●●●●● patch | view | raw | blame | history | |
apps/lvgl/libs_lvgl/patches/lv_drivers-8.0.1-imx6ull.patch | ●●●●● patch | view | raw | blame | history | |
apps/lvgl/libs_lvgl/patches/lvgl-8.0.2-imx6ull.patch | ●●●●● patch | view | raw | blame | history | |
apps/lvgl/lvgl_demo.c | ●●●●● patch | view | raw | blame | history | |
apps/lvgl/makefile | ●●●●● patch | view | raw | blame | history |
apps/lvgl/libs_lvgl/build.sh
New file @@ -0,0 +1,72 @@ #!/bin/bash PRJ_PATH=`pwd` BOARD=imx6ull LYFTP_SRC=http://master.weike-iot.com:2211/src/ LIB_LVGL=lvgl-8.0.2 LIB_LVGL_DRV=lv_drivers-8.0.1 LIB_LVGL_DEMO=lv_demos-8.0.1 LIBS_DIR="lvgl lv_drivers lv_demos" CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf- if [ $# == 1 ] ; then CROSS_COMPILE=$1 fi set -e function prepare_lib() { PACK_SUFIX=tar.gz PACK_NAME=$1 DIR_NAME=$2 if [ ! -d ${DIR_NAME} ] ; then if [ ! -s ${PACK_NAME}.${PACK_SUFIX} ] ; then wget ${LYFTP_SRC}/${PACK_NAME}.${PACK_SUFIX} fi tar -xzf ${PACK_NAME}.${PACK_SUFIX} patch -p0 < patches/${PACK_NAME}-${BOARD}.patch mv ${PACK_NAME} ${DIR_NAME} cd ${DIR_NAME} sed -i -e "s|.*CMAKE_C_COMPILER.*|set(CMAKE_C_COMPILER \"${CROSS_COMPILE}gcc\")|g" CMakeLists.txt temp_file=`ls *_template.h` conf_file=`echo ${temp_file/_template/}` cp ${temp_file} ../${conf_file} cd ${PRJ_PATH} fi } if [[ $# == 1 && $1 == clean ]] ; then rm -rf lv* rm -rf libs exit; fi prepare_lib ${LIB_LVGL} lvgl prepare_lib ${LIB_LVGL_DRV} lv_drivers prepare_lib ${LIB_LVGL_DEMO} lv_demos mkdir -p ${PRJ_PATH}/libs for lib in ${LIBS_DIR} do if [ -f ${PRJ_PATH}/libs/lib${lib}.a ] ; then continue; fi mkdir -p ${lib}/build cd ${lib}/build/ rm -rf * && cmake .. && make cp lib*.a ${PRJ_PATH}/libs/lib${lib}.a cd ${PRJ_PATH} done apps/lvgl/libs_lvgl/patches/gen_patch.sh
New file @@ -0,0 +1,55 @@ #!/bin/bash # Description: This shell script used to generate patch file # Author: guowenxue <guowenxue@gmail.com> # Version: 1.0.0 PROJ_PATH=`pwd` PATCH_PATH=${PROJ_PATH}/patches BOARD=imx6ull PATCH_SUFFIX=${BOARD}.patch set -e if [ $# != 1 ] ; then echo "Usage: $0 [src_path]" printf "\nExample: \n" echo "$0 lvgl-8.0.2" exit ; fi SRC=`basename $1` if [ ! -d ${SRC} ] ; then printf "\nERROR: ${SRC} source code not exist, exit now\n\n" exit fi if [ ! -f ${SRC}.tar.gz ] ; then printf "\nERROR: ${SRC}.tar.gz packet not exist, exit now\n\n" exit fi rm -rf ${SRC}/build # rename new source code mv ${SRC} ${SRC}-${BOARD} # decompress orignal soruce code packet tar -xzf ${SRC}.tar.gz set +e # generate patch file diff -Nuar ${SRC} ${SRC}-${BOARD} > ${SRC}-${PATCH_SUFFIX} # remove orignal soruce code rm -rf ${SRC} # recover new source code mv ${SRC}-${BOARD} ${SRC} apps/lvgl/libs_lvgl/patches/lv_demos-8.0.1-imx6ull.patch
New file @@ -0,0 +1,49 @@ diff -Nuar lv_demos-8.0.1/CMakeLists.txt lv_demos-8.0.1-imx6ull/CMakeLists.txt --- lv_demos-8.0.1/CMakeLists.txt 2021-06-14 20:00:00.000000000 +0800 +++ lv_demos-8.0.1-imx6ull/CMakeLists.txt 2021-09-27 21:26:45.823935469 +0800 @@ -1,2 +1,5 @@ +set(CMAKE_C_COMPILER "/opt/buildroot/cortex-a7/bin/arm-linux-gcc") +include_directories(..) + file(GLOB_RECURSE SOURCES src/*.c) add_library(lv_examples STATIC ${SOURCES}) diff -Nuar lv_demos-8.0.1/lv_demo_conf_template.h lv_demos-8.0.1-imx6ull/lv_demo_conf_template.h --- lv_demos-8.0.1/lv_demo_conf_template.h 2021-06-14 20:00:00.000000000 +0800 +++ lv_demos-8.0.1-imx6ull/lv_demo_conf_template.h 2021-09-27 20:57:35.667901897 +0800 @@ -7,7 +7,7 @@ * COPY THIS FILE AS lv_demo_conf.h */ -#if 0 /*Set it to "1" to enable the content*/ +#if 1 /*Set it to "1" to enable the content*/ #ifndef LV_EX_CONF_H #define LV_EX_CONF_H @@ -25,22 +25,22 @@ *********************/ /*Show some widget*/ -#define LV_USE_DEMO_WIDGETS 0 +#define LV_USE_DEMO_WIDGETS 1 #if LV_USE_DEMO_WIDGETS #define LV_DEMO_WIDGETS_SLIDESHOW 0 #endif /*Printer demo, optimized for 800x480*/ -#define LV_USE_DEMO_PRINTER 0 +#define LV_USE_DEMO_PRINTER 1 /*Demonstrate the usage of encoder and keyboard*/ -#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 +#define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 /*Benchmark your system*/ -#define LV_USE_DEMO_BENCHMARK 0 +#define LV_USE_DEMO_BENCHMARK 1 /*Stress test for LVGL*/ -#define LV_USE_DEMO_STRESS 0 +#define LV_USE_DEMO_STRESS 1 /*Music player demo*/ #define LV_USE_DEMO_MUSIC 1 apps/lvgl/libs_lvgl/patches/lv_drivers-8.0.1-imx6ull.patch
New file @@ -0,0 +1,103 @@ diff -Nuar lv_drivers-8.0.1/CMakeLists.txt lv_drivers-8.0.1-imx6ull/CMakeLists.txt --- lv_drivers-8.0.1/CMakeLists.txt 2021-06-14 19:54:20.000000000 +0800 +++ lv_drivers-8.0.1-imx6ull/CMakeLists.txt 2021-09-27 22:20:38.179997474 +0800 @@ -1,2 +1,5 @@ +set(CMAKE_C_COMPILER "/opt/buildroot/cortex-a7/bin/arm-linux-gcc") +include_directories(..) + file(GLOB_RECURSE SOURCES ./*.c) add_library(lv_drivers STATIC ${SOURCES}) diff -Nuar lv_drivers-8.0.1/indev/evdev.c lv_drivers-8.0.1-imx6ull/indev/evdev.c --- lv_drivers-8.0.1/indev/evdev.c 2021-06-14 19:54:20.000000000 +0800 +++ lv_drivers-8.0.1-imx6ull/indev/evdev.c 2021-09-27 22:25:04.172002576 +0800 @@ -115,7 +115,7 @@ * @param data store the evdev data here * @return false: because the points are not buffered, so no more data to be read */ -bool evdev_read(lv_indev_drv_t * drv, lv_indev_data_t * data) +void evdev_read(lv_indev_drv_t * drv, lv_indev_data_t * data) { struct input_event in; @@ -196,7 +196,7 @@ } evdev_key_val = data->key; evdev_button = data->state; - return false; + return; } } } @@ -205,10 +205,10 @@ /* No data retrieved */ data->key = evdev_key_val; data->state = evdev_button; - return false; + return; } if(drv->type != LV_INDEV_TYPE_POINTER) - return false; + return; /*Store the collected data*/ #if EVDEV_CALIBRATE @@ -225,12 +225,12 @@ data->point.x = 0; if(data->point.y < 0) data->point.y = 0; - if(data->point.x >= drv->disp->driver.hor_res) - data->point.x = drv->disp->driver.hor_res - 1; - if(data->point.y >= drv->disp->driver.ver_res) - data->point.y = drv->disp->driver.ver_res - 1; + if(data->point.x >= drv->disp->driver->hor_res) + data->point.x = drv->disp->driver->hor_res - 1; + if(data->point.y >= drv->disp->driver->ver_res) + data->point.y = drv->disp->driver->ver_res - 1; - return false; + return; } /********************** diff -Nuar lv_drivers-8.0.1/indev/evdev.h lv_drivers-8.0.1-imx6ull/indev/evdev.h --- lv_drivers-8.0.1/indev/evdev.h 2021-06-14 19:54:20.000000000 +0800 +++ lv_drivers-8.0.1-imx6ull/indev/evdev.h 2021-09-27 22:25:33.424003137 +0800 @@ -57,7 +57,7 @@ * @param data store the evdev data here * @return false: because the points are not buffered, so no more data to be read */ -bool evdev_read(lv_indev_drv_t * drv, lv_indev_data_t * data); +void evdev_read(lv_indev_drv_t * drv, lv_indev_data_t * data); /********************** diff -Nuar lv_drivers-8.0.1/lv_drv_conf_template.h lv_drivers-8.0.1-imx6ull/lv_drv_conf_template.h --- lv_drivers-8.0.1/lv_drv_conf_template.h 2021-06-14 19:54:20.000000000 +0800 +++ lv_drivers-8.0.1-imx6ull/lv_drv_conf_template.h 2021-09-27 22:20:38.183997474 +0800 @@ -7,7 +7,7 @@ * COPY THIS FILE AS lv_drv_conf.h */ -#if 0 /*Set it to "1" to enable the content*/ +#if 1 /*Set it to "1" to enable the content*/ #ifndef LV_DRV_CONF_H #define LV_DRV_CONF_H @@ -272,7 +272,7 @@ * Linux frame buffer device (/dev/fbx) *-----------------------------------------*/ #ifndef USE_FBDEV -# define USE_FBDEV 0 +# define USE_FBDEV 1 #endif #if USE_FBDEV @@ -386,7 +386,7 @@ * Mouse or touchpad as evdev interface (for Linux based systems) *------------------------------------------------*/ #ifndef USE_EVDEV -# define USE_EVDEV 0 +# define USE_EVDEV 1 #endif #ifndef USE_BSD_EVDEV apps/lvgl/libs_lvgl/patches/lvgl-8.0.2-imx6ull.patch
New file @@ -0,0 +1,92 @@ diff -Nuar lvgl-8.0.2/CMakeLists.txt lvgl-8.0.2-imx6ull/CMakeLists.txt --- lvgl-8.0.2/CMakeLists.txt 2021-07-16 23:40:51.000000000 +0800 +++ lvgl-8.0.2-imx6ull/CMakeLists.txt 2021-09-27 22:30:20.360008641 +0800 @@ -1,3 +1,7 @@ + +set(CMAKE_C_COMPILER "/opt/buildroot/cortex-a7/bin/arm-linux-gcc") +include_directories(..) + if(ESP_PLATFORM) file(GLOB_RECURSE SOURCES src/*.c) diff -Nuar lvgl-8.0.2/lv_conf_template.h lvgl-8.0.2-imx6ull/lv_conf_template.h --- lvgl-8.0.2/lv_conf_template.h 2021-07-16 23:40:51.000000000 +0800 +++ lvgl-8.0.2-imx6ull/lv_conf_template.h 2021-09-27 22:33:47.448012614 +0800 @@ -7,7 +7,7 @@ * COPY THIS FILE AS `lv_conf.h` NEXT TO the `lvgl` FOLDER */ -#if 0 /*Set it to "1" to enable content*/ +#if 1 /*Set it to "1" to enable content*/ #ifndef LV_CONF_H #define LV_CONF_H @@ -21,7 +21,7 @@ *====================*/ /*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ -#define LV_COLOR_DEPTH 32 +#define LV_COLOR_DEPTH 16 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/ #define LV_COLOR_16_SWAP 0 @@ -42,7 +42,7 @@ #define LV_MEM_CUSTOM 0 #if LV_MEM_CUSTOM == 0 /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ -# define LV_MEM_SIZE (32U * 1024U) /*[bytes]*/ +# define LV_MEM_SIZE (128U * 1024U) /*[bytes]*/ /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ # define LV_MEM_ADR 0 /*0: unused*/ @@ -68,9 +68,10 @@ /*Use a custom tick source that tells the elapsed time in milliseconds. *It removes the need to manually update the tick with `lv_tick_inc()`)*/ -#define LV_TICK_CUSTOM 0 +#define LV_TICK_CUSTOM 1 #if LV_TICK_CUSTOM -#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ +extern uint32_t millis(void); +#define LV_TICK_CUSTOM_INCLUDE <stdint.h> /*Header for the system time function*/ #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ #endif /*LV_TICK_CUSTOM*/ @@ -137,7 +138,7 @@ *-----------*/ /*Enable the log module*/ -#define LV_USE_LOG 0 +#define LV_USE_LOG 1 #if LV_USE_LOG /*How important log should be added: @@ -151,7 +152,7 @@ /*1: Print the log with 'printf'; *0: User need to register a callback with `lv_log_register_print_cb()`*/ -# define LV_LOG_PRINTF 0 +# define LV_LOG_PRINTF 1 /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ # define LV_LOG_TRACE_MEM 1 @@ -262,13 +263,13 @@ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 *https://fonts.google.com/specimen/Montserrat*/ -#define LV_FONT_MONTSERRAT_8 0 -#define LV_FONT_MONTSERRAT_10 0 -#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_8 1 +#define LV_FONT_MONTSERRAT_10 1 +#define LV_FONT_MONTSERRAT_12 1 #define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 0 -#define LV_FONT_MONTSERRAT_18 0 -#define LV_FONT_MONTSERRAT_20 0 +#define LV_FONT_MONTSERRAT_16 1 +#define LV_FONT_MONTSERRAT_18 1 +#define LV_FONT_MONTSERRAT_20 1 #define LV_FONT_MONTSERRAT_22 0 #define LV_FONT_MONTSERRAT_24 0 #define LV_FONT_MONTSERRAT_26 0 apps/lvgl/lvgl_demo.c
New file @@ -0,0 +1,91 @@ /********************************************************************************* * Copyright: (C) 2021 LingYun IoT System Studio * All rights reserved. * * Filename: lvgl_demo.c * Description: This file is LVGL demo program. * * Version: 1.0.0(2021年09月27日) * Author: Guo Wenxue <guowenxue@gmail.com> * ChangeLog: 1, Release initial version on "2021年09月27日 22时16分52秒" * ********************************************************************************/ #include <stdio.h> #include <unistd.h> #include <pthread.h> #include <time.h> #include <sys/time.h> #include "lvgl/lvgl.h" #include "lv_drivers/display/fbdev.h" #include "lv_drivers/indev/evdev.h" #include "lv_demos/lv_demo.h" #define DISP_BUF_SIZE (128 * 1024) int main(void) { lv_disp_drv_t disp_drv; lv_indev_drv_t indev_drv; static lv_color_t buf[DISP_BUF_SIZE]; /* buffer for LVGL to draw the screen's content */ static lv_disp_draw_buf_t disp_buf; /* Initialize a descriptor for the buffer */ /* LVGL context init */ lv_init(); /* Linux frame buffer device init */ fbdev_init(); /* linux touchscreen device init */ lv_indev_drv_init(&indev_drv); indev_drv.type =LV_INDEV_TYPE_POINTER; indev_drv.read_cb =evdev_read; lv_indev_drv_register(&indev_drv); /* Initialize and register a display driver */ lv_disp_draw_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE); lv_disp_drv_init(&disp_drv); disp_drv.draw_buf = &disp_buf; disp_drv.flush_cb = fbdev_flush; disp_drv.hor_res = 800; disp_drv.ver_res = 480; lv_disp_drv_register(&disp_drv); /* Create a Demo */ //lv_demo_widgets(); lv_demo_music(); //lv_demo_keypad_encoder(); //lv_demo_stress(); /* Handle LitlevGL tasks (tickless mode) */ while(1) { lv_task_handler(); usleep(5000); } return 0; } /* Set in lv_conf.h as LV_TICK_CUSTOM_SYS_TIME_EXPR */ uint32_t millis(void) { static uint64_t start_ms = 0; struct timeval tv_start; struct timeval tv_now; uint64_t now_ms; uint32_t time_ms; if(start_ms == 0) { gettimeofday(&tv_start, NULL); start_ms = (tv_start.tv_sec * 1000000 + tv_start.tv_usec) / 1000; } gettimeofday(&tv_now, NULL); now_ms = (tv_now.tv_sec * 1000000 + tv_now.tv_usec) / 1000; time_ms = now_ms - start_ms; return time_ms; } apps/lvgl/makefile
New file @@ -0,0 +1,46 @@ CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf- CC = ${CROSS_COMPILE}gcc CFLAGS = -Wall -Wshadow -Wundef -Wmaybe-uninitialized CFLAGS += -O3 -g3 -I./ -I ./libs_lvgl/ LDFLAGS+=-L ./libs_lvgl/libs/ -llv_demos -llv_drivers -llvgl BIN = lvgl_demo MAINSRC = lvgl_demo.c VPATH = OBJEXT ?= .o AOBJS = $(ASRCS:.S=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT)) MAINOBJ = $(MAINSRC:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(MAINSRC) OBJS = $(AOBJS) $(COBJS) ## MAINOBJ -> OBJFILES all: libs clean default cp ${BIN} /tftp libs: cd libs_lvgl && ./build.sh ${CROSS_COMPILE} %.o: %.c @$(CC) $(CFLAGS) -c $< -o $@ @echo "CC $<" default: $(AOBJS) $(COBJS) $(MAINOBJ) $(CC) -o $(BIN) $(MAINOBJ) $(AOBJS) $(COBJS) $(LDFLAGS) clean: rm -f $(BIN) $(AOBJS) $(COBJS) $(MAINOBJ) distclean: clean rm -rf cscope* tags cd libs_lvgl && ./build.sh clean