如何移植至Linux开发板并修改Makefile及自定义构建文件。修复头文件错误:#include "lvgl.h"找不到,需更改为#include "./lvgl/lvgl.h"。

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

如何移植至Linux开发板并修改Makefile及自定义构建文件。修复头文件错误:#include "lvgl.h"找不到,需更改为#include "./lvgl/lvgl.h"。

726 次查看
LIMINNAN
Contributor I
  • I have to say, I've had more misreports。
  • As you can see, I'm porting GUI_GUIDER to my Linux board. Here's a demo example。
  • I can't find GUI_GUIDER auto-generated script, unable to batch modify the header file problem.
└── lvgl_Demo
    ├── build                   // 可执行文件二进制
    ├── custom                  // GUI_GUIDER生成文件
    │   ├── custom.c            // #include "lvgl.h" 无法找到,需要更改为 #include "../lvgl/lvgl.h"
    │   ├── custom.h
    │   ├── custom.mk
    │   ├── custom.py
    │   ├── lv_conf_ext.h
    │   ├── mp1544294806.png
    │   ├── mp-1789058473.png
    │   ├── spectrum_1.h
    │   ├── spectrum_2.h
    │   └── spectrum_3.h
    ├── generated
    │   ├── events_init.c       // #include "lvgl.h" 无法找到,需要更改为 #include "../lvgl/lvgl.h"
    │   ├── events_init.h
    │   ├── generated.mk
    │   ├── guider_customer_fonts
    │   │   ├── guider_customer_fonts.h
    │   │   └── guider_customer_fonts.mk
    │   ├── guider_fonts
    │   │   ├── guider_fonts.h
    │   │   ├── guider_fonts.mk
    │   │   ├── lv_font_arial_16.c  // #include "lvgl.h" 无法找到,需要更改为 #include "../lvgl/lvgl.h"
    │   │   ├── lv_font_arial_20.c  // ...
    │   │   ├── lv_font_arial_23.c
    │   │   ├── lv_font_arial_26.c
    │   │   ├── lv_font_simsun_18.c
    │   │   └── lv_font_simsun_20.c
    │   ├── gui_guider.c
    │   ├── gui_guider.h
    │   ├── images
    │   │   ├── _btn_list_pause_alpha_70x70.c // ...
    │   │   ├── _btn_list_play_alpha_70x70.c
    │   │   ├── _btn_loop_alpha_25x25.c
    │   │   ├── _btn_next_alpha_61x61.c
    │   │   ├── _btn_pause_alpha_80x80.c
    │   │   ├── _btn_play_alpha_80x80.c
    │   │   ├── _btn_prev_alpha_61x61.c
    │   │   ├── _btn_rnd_alpha_25x25.c
    │   │   ├── _cover_1_alpha_175x175.c
    │   │   ├── _cover_2_alpha_175x175.c
    │   │   ├── _cover_3_alpha_175x175.c
    │   │   ├── _icn_chart_alpha_25x25.c
    │   │   ├── _icn_chat_alpha_25x25.c
    │   │   ├── _icn_download_alpha_25x25.c
    │   │   ├── _icn_heart_alpha_25x25.c
    │   │   ├── _icn_slider_alpha_25x25.c
    │   │   ├── images.mk
    │   │   ├── _wave_bottom_alpha_800x51.c
    │   │   └── _wave_top_alpha_800x51.c
    │   └── setup_scr_screen.c
    ├── lv_drivers
    │   ├── CMakeLists.txt
    │
    ├── lvgl
    │   ├── CMakeLists.txt
    │   ├── component.mk
    │   ├── demos
    │   ├── ...
    ├── main.c
    ├── main.o
    ├── Makefile
    └── tree.txt
 
  • 9.0 version of cmakelist does not support GUI_GUIDER I replaced 8.3.10 lvgl, this is my MakeFile
# Makefile

# Directory settings

makefile_name := $(abspath $(lastword $(MAKEFILE_LIST)))
makefile_path := $(strip $(patsubst %/,% , $(dir $(makefile_name))))
libfile_path := $(makefile_path)/../lib/x86
LVGL_DIR ?= ${shell pwd}
PRJ_DIR := $(LVGL_DIR)
LVGL_DIR_NAME ?= lvgl

BUILD_DIR := build/
OBJ_DIR := $(BUILD_DIR)object/
GEN_OBJ_DIR := $(OBJ_DIR)generated/
BIN_DIR := $(BUILD_DIR)bin/

NORMAL_OUT := 1

RM := rm -f
RMDIR := rm -rf

ifeq ($(OS),Windows_NT)
LDFLAGS += -LSDL2\i686-w64-mingw32\lib
SIMULATOR_EXE = simulator.exe
BUILD_ENV := build\object build\bin
NULL_OUT := nul
MKDIR_P = mkdir
else
SIMULATOR_EXE = simulator
NULL_OUT := /dev/null
MKDIR_P = mkdir -p
endif

# Compiler settings
CC ?= gcc
CFLAGS ?= -O3 -g0 -I$(LVGL_DIR)/ -Wall -Wshadow -Wundef -Wmissing-prototypes \
          -Wno-discarded-qualifiers -Wall -Wextra -Wno-unused-function \
          -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing \
          -Wno-error=cpp -Wuninitialized -Wmaybe-uninitialized \
          -Wno-unused-parameter -Wno-missing-field-initializers \
          -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral \
          -Wno-cast-qual -Wunreachable-code -Wno-switch-default \
          -Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers \
          -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes \
          -Wdouble-promotion -Wclobbered -Wdeprecated -Wempty-body \
          -Wtype-limits -Wshift-negative-value -Wstack-usage=2048 \
          -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers \
          -Wuninitialized -Wmaybe-uninitialized -Wall -Wextra \
          -Wno-unused-parameter -Wno-missing-field-initializers \
          -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral \
          -Wpointer-arith -Wno-cast-qual -Wmissing-prototypes \
          -Wunreachable-code -Wno-switch-default -Wreturn-type \
          -Wmultichar -Wno-discarded-qualifiers -Wformat-security \
          -Wno-ignored-qualifiers -Wno-sign-compare
          
CFLAGS += -DLV_CONF_INCLUDE_SIMPLE=1

ifeq ($(OS),Windows_NT)
LDFLAGS := -lSDL2 -L$(libfile_path) -ldecoder -lopenh264 -lrlottie -lstdc++ -lm
else
LDFLAGS := -lSDL2 -L$(libfile_path) -ldecoder -lopenh264 -lrlottie -lpthread -lstdc++ -lm -ldl
endif

ifeq ($(OS),Windows_NT)
#SDL2
CFLAGS += "-ISDL2\i686-w64-mingw32\include" -MMD -MP
endif

# Binary name
BIN := $(BIN_DIR)demo

# Collect the files to compile
MAINSRC := ./main.c

DEPPATH += --dep-path $(makefile_path)/
VPATH += :$(makefile_path)/
CFLAGS += "-I$(makefile_path)/"

include $(LVGL_DIR)/lvgl/lvgl.mk
include $(LVGL_DIR)/lv_drivers/lv_drivers.mk
include $(PRJ_DIR)/custom/custom.mk
include $(PRJ_DIR)/generated/generated.mk


CSRCS += main.c
DEPPATH += --dep-path $(makefile_path)/
VPATH += :$(makefile_path)/
CFLAGS += "-I$(makefile_path)/"

ifeq ($(OS),Windows_NT)
#SDL2
CFLAGS += "-ISDL2\i686-w64-mingw32\include" -MMD -MP
endif

OBJEXT := .o

AOBJS = $(addprefix $(OBJ_DIR),$(ASRCS:.S=$(OBJEXT)))
COBJS = $(addprefix $(OBJ_DIR),$(CSRCS:.c=$(OBJEXT)))
DEPS = $(addprefix $(OBJ_DIR),$(CSRCS:.c=.d))
GEN_AOBJS = $(addprefix $(GEN_OBJ_DIR),$(GEN_ASRCS:.S=$(OBJEXT)))
GEN_COBJS = $(addprefix $(GEN_OBJ_DIR),$(GEN_CSRCS:.c=$(OBJEXT)))

DEPS += $(addprefix $(GEN_OBJ_DIR),$(GEN_CSRCS:.c=.d))


SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
GEN_SRCS = $(GEN_ASRCS) $(GEN_CSRCS)
GEN_OBJS = $(GEN_AOBJS) $(GEN_COBJS)

.PHONY: all env clean default cp_lib clean_gen run
ifeq ($(OS),Windows_NT)
all: env default cp_lib
else
all: env default
endif
# monitor header files
-include $(DEPS)

ifeq ($(OS),Windows_NT)
env:
	@if not exist "build/bin" $(MKDIR_P) "build/bin"
	@if not exist "build/object/generated" $(MKDIR_P) "build/object/generated"
else
env:
	@if [ ! -d "build/bin" ]; then $(MKDIR_P) build/bin; fi
	@if [ ! -d "build/object/generated" ]; then $(MKDIR_P) build/object/generated; fi
endif
$(OBJ_DIR)main.o: main.c
	@echo "Compiling $(makefile_path)/$<"
	@$(CC)  $(CFLAGS) -c $< -o $@

$(OBJ_DIR)%.o: %.c
	@echo "Compiling $<"
	@$(CC)  $(CFLAGS) -c $< -o $@

$(GEN_OBJ_DIR)%.o: %.c
	@echo "Compiling $<"
	@$(CC)  $(CFLAGS) -c $< -o $@

default: $(OBJS) $(GEN_OBJS)
	@echo "Linking $(SIMULATOR_EXE)"
	@$(CC) -o $(BIN_DIR)$(SIMULATOR_EXE) $(OBJS) $(GEN_OBJS) $(LDFLAGS)

cp_lib:
	-@cp SDL2/lib/SDL2.dll build/bin/SDL2.dll $(NORMAL_OUT)>$(NULL_OUT)
	-@cp SDL2/lib/libopenh264.dll build/bin/libopenh264.dll $(NORMAL_OUT)>$(NULL_OUT)

clean:
	-@$(RMDIR) build

gen_images := $(wildcard $(PRJ_DIR)/generated/images/*.c)
gen_srcs := $(gen_images) $(wildcard $(PRJ_DIR)/generated/*.c) $(wildcard $(PRJ_DIR)/generated/*.h)

ifeq ($(OS),Windows_NT)
clean_gen_img:
	-@rm $(gen_images)

clean_gen: clean_gen_img
	-@rm $(gen_srcs)
run:
	build\bin\simulator.exe
else

clean_gen_img:
	$(RM) $(LVGL_DIR)/generated/images/*.c

clean_gen: clean_gen_img
	$(RM) $(LVGL_DIR)/generated/*.c
	$(RM) $(LVGL_DIR)/generated/*.h
endif
0 项奖励
回复
1 回复

696 次查看
HangZhang
NXP Employee
NXP Employee

Hi @LIMINNAN 

您好,请问您用的什么芯片?

谢谢

0 项奖励
回复