[fix][lvgl][romfs] modfiy lvgl and romfs config

This commit is contained in:
jzlv 2021-09-26 13:37:12 +08:00
parent c8b80283d1
commit b2aada479b
5 changed files with 763 additions and 756 deletions

View File

@ -1,42 +1,43 @@
################# Add global include #################
list(APPEND ADD_INCLUDE
"${CMAKE_CURRENT_SOURCE_DIR}"
)
#######################################################
################# Add private include #################
# list(APPEND ADD_PRIVATE_INCLUDE
# )
#######################################################
############## Add current dir source files ###########
file(GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
list(APPEND ADD_SRCS ${sources})
# aux_source_directory(src ADD_SRCS)
# list(REMOVE_ITEM ADD_SRCS "${CMAKE_CURRENT_SOURCE_DIR}")
#######################################################
########### Add required/dependent components #########
list(APPEND ADD_REQUIREMENTS common)
#######################################################
############ Add static libs ##########################
#list(APPEND ADD_STATIC_LIB "libxxx.a")
#######################################################
############ Add dynamic libs #########################
# list(APPEND ADD_DYNAMIC_LIB "libxxx.so"
# )
#######################################################
############ Add global compile option ################
#add components denpend on this component
# list(APPEND ADD_DEFINITIONS -Dxxx)
#######################################################
############ Add private compile option ################
#add compile option for this component that won't affect other modules
# list(APPEND ADD_PRIVATE_DEFINITIONS -Dxxx)
#######################################################
################# Add global include #################
list(APPEND ADD_INCLUDE
"${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_SOURCE_DIR}/bsp/bsp_common/mcu_lcd/
)
#######################################################
################# Add private include #################
# list(APPEND ADD_PRIVATE_INCLUDE
# )
#######################################################
############## Add current dir source files ###########
file(GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
list(APPEND ADD_SRCS ${sources})
# aux_source_directory(src ADD_SRCS)
# list(REMOVE_ITEM ADD_SRCS "${CMAKE_CURRENT_SOURCE_DIR}")
#######################################################
########### Add required/dependent components #########
list(APPEND ADD_REQUIREMENTS common)
#######################################################
############ Add static libs ##########################
#list(APPEND ADD_STATIC_LIB "libxxx.a")
#######################################################
############ Add dynamic libs #########################
# list(APPEND ADD_DYNAMIC_LIB "libxxx.so"
# )
#######################################################
############ Add global compile option ################
#add components denpend on this component
# list(APPEND ADD_DEFINITIONS -Dxxx)
#######################################################
############ Add private compile option ################
#add compile option for this component that won't affect other modules
# list(APPEND ADD_PRIVATE_DEFINITIONS -Dxxx)
#######################################################
generate_library()

File diff suppressed because it is too large Load Diff

View File

@ -14,15 +14,6 @@ extern "C" {
#include LV_CONF_KCONFIG_EXTERNAL_INCLUDE
#else
#if defined ESP_PLATFORM
#include "sdkconfig.h"
#include "esp_attr.h"
#endif
#ifdef __NuttX__
#include <nuttx/config.h>
#endif
#endif /*LV_CONF_KCONFIG_EXTERNAL_INCLUDE*/
/*******************

View File

@ -24,10 +24,6 @@
#include "drv_mmheap.h"
#include "bl_romfs.h"
#define ROMFH_HRD 0
#define ROMFH_DIR 1
#define ROMFH_REG 2
#define ROMFH_UNKNOW 3.
static uint32_t romfs_endaddr(void);
static int dirent_type(void *addr);
@ -339,6 +335,15 @@ int romfs_close(romfs_file_t *fp)
return -1;
}
int romfs_size(romfs_file_t *fp)
{
if(fp == NULL){
return -1;
}
return dirent_size(fp->f_arg);
}
size_t romfs_read(romfs_file_t *fp, char *buf, size_t length)
{
char *payload_buf;
@ -466,9 +471,8 @@ int romfs_stat(const char *path, romfs_stat_t *st)
return 0;
}
romfs_dir_t *romfs_opendir(const char *path)
int romfs_opendir(romfs_dir_t *dp,const char *path)
{
romfs_dir_t *dp = NULL;
char *start_addr;
char *end_addr;
int res;
@ -478,14 +482,14 @@ romfs_dir_t *romfs_opendir(const char *path)
/* sure romfs_root is valid */
if (romfs_root == NULL) {
ROMFS_ERROR("ERROR: romfs_root is null.\r\n");
return NULL;
return -1;
}
dp = (romfs_dir_t *)mmheap_alloc(sizeof(romfs_dir_t) + ROMFS_MAX_NAME_LEN + 1);
// dp = (romfs_dir_t *)malloc(sizeof(romfs_dir_t) + ROMFS_MAX_NAME_LEN + 1);
if (NULL == dp) {
return NULL;
return -2;
}
memset(dp, 0, sizeof(romfs_dir_t) + ROMFS_MAX_NAME_LEN + 1);
memset(dp, 0, sizeof(romfs_dir_t));
res = dirent_file((char *)path, (void **)&start_addr, (void **)&end_addr);
ROMFS_DEBUG("romfs: open dir path = %s, start = %p, end = %p\r\n", path, start_addr, end_addr);
@ -495,19 +499,18 @@ romfs_dir_t *romfs_opendir(const char *path)
dp->dir_start_addr = (char *)(romfs_root + ALIGNUP16(strlen(romfs_root + 16) + 1) + 16 + 64);
} else {
if (0 == dirent_childaddr(start_addr)) {
return NULL;
return -3;
} else {
dp->dir_start_addr = (char *)(romfs_root + dirent_childaddr(start_addr));
}
}
dp->dir_end_addr = end_addr;
dp->dir_cur_addr = NULL;
return dp;
return 0;
}
/* open err */
mmheap_free(dp);
return NULL;
return -4;
}
romfs_dirent_t *romfs_readdir(romfs_dir_t *dir)
@ -569,6 +572,12 @@ romfs_dirent_t *romfs_readdir(romfs_dir_t *dir)
}
}
if(ROMFH_DIR == dirent_type(dir->dir_cur_addr)){
dir->cur_dirent.d_type = ROMFH_DIR;
}else if(ROMFH_REG == dirent_type(dir->dir_cur_addr)){
dir->cur_dirent.d_type = ROMFH_REG;
}
return &(dir->cur_dirent);
}
@ -578,7 +587,6 @@ int romfs_closedir(romfs_dir_t *dir)
return -1;
}
mmheap_free(dir);
return 0;
}

View File

@ -45,6 +45,11 @@
#define ROMFS_MOUNTPOINT "/romfs" /* must '/' */
#define ROMFS_MAX_NAME_LEN (64)
#define ROMFH_HRD 0
#define ROMFH_DIR 1
#define ROMFH_REG 2
#define ROMFH_UNKNOW 3
#define ROMFS_S_IFDIR 0x0040000
#define ROMFS_S_IFREG 0x0100000
@ -80,7 +85,7 @@ typedef struct {
typedef struct {
int d_ino; /* file number */
uint8_t d_type; /* type of file */
char d_name[]; /* file name */
char d_name[ROMFS_MAX_NAME_LEN + 1]; /* file name */
} romfs_dirent_t;
/* opendir 得到的目录结构体 */
@ -94,10 +99,11 @@ typedef struct {
int romfs_mount(void);
int romfs_open(romfs_file_t *fp, const char *path, int flags);
int romfs_close(romfs_file_t *fp);
int romfs_size(romfs_file_t *fp);
size_t romfs_read(romfs_file_t *fp, char *buf, size_t length);
size_t romfs_lseek(romfs_file_t *fp, int off, romfs_whence_t whence);
int romfs_stat(const char *path, romfs_stat_t *st);
romfs_dir_t *romfs_opendir(const char *path);
int romfs_opendir(romfs_dir_t *dp,const char *path);
romfs_dirent_t *romfs_readdir(romfs_dir_t *dir);
int romfs_closedir(romfs_dir_t *dir);