mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-09 14:28:37 +00:00
[fix][lvgl][romfs] modfiy lvgl and romfs config
This commit is contained in:
parent
c8b80283d1
commit
b2aada479b
5 changed files with 763 additions and 756 deletions
|
@ -1,42 +1,43 @@
|
||||||
################# Add global include #################
|
################# Add global include #################
|
||||||
list(APPEND ADD_INCLUDE
|
list(APPEND ADD_INCLUDE
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
)
|
${CMAKE_SOURCE_DIR}/bsp/bsp_common/mcu_lcd/
|
||||||
#######################################################
|
)
|
||||||
|
#######################################################
|
||||||
################# Add private include #################
|
|
||||||
# list(APPEND ADD_PRIVATE_INCLUDE
|
################# Add private include #################
|
||||||
# )
|
# list(APPEND ADD_PRIVATE_INCLUDE
|
||||||
#######################################################
|
# )
|
||||||
|
#######################################################
|
||||||
############## Add current dir source files ###########
|
|
||||||
file(GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
|
############## Add current dir source files ###########
|
||||||
list(APPEND ADD_SRCS ${sources})
|
file(GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
|
||||||
# aux_source_directory(src ADD_SRCS)
|
list(APPEND ADD_SRCS ${sources})
|
||||||
# list(REMOVE_ITEM ADD_SRCS "${CMAKE_CURRENT_SOURCE_DIR}")
|
# 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 required/dependent components #########
|
||||||
#######################################################
|
list(APPEND ADD_REQUIREMENTS common)
|
||||||
|
#######################################################
|
||||||
############ Add static libs ##########################
|
|
||||||
#list(APPEND ADD_STATIC_LIB "libxxx.a")
|
############ Add static libs ##########################
|
||||||
#######################################################
|
#list(APPEND ADD_STATIC_LIB "libxxx.a")
|
||||||
|
#######################################################
|
||||||
############ Add dynamic libs #########################
|
|
||||||
# list(APPEND ADD_DYNAMIC_LIB "libxxx.so"
|
############ Add dynamic libs #########################
|
||||||
# )
|
# list(APPEND ADD_DYNAMIC_LIB "libxxx.so"
|
||||||
#######################################################
|
# )
|
||||||
|
#######################################################
|
||||||
############ Add global compile option ################
|
|
||||||
#add components denpend on this component
|
############ Add global compile option ################
|
||||||
# list(APPEND ADD_DEFINITIONS -Dxxx)
|
#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
|
############ Add private compile option ################
|
||||||
# list(APPEND ADD_PRIVATE_DEFINITIONS -Dxxx)
|
#add compile option for this component that won't affect other modules
|
||||||
#######################################################
|
# list(APPEND ADD_PRIVATE_DEFINITIONS -Dxxx)
|
||||||
|
#######################################################
|
||||||
|
|
||||||
generate_library()
|
generate_library()
|
File diff suppressed because it is too large
Load diff
|
@ -14,15 +14,6 @@ extern "C" {
|
||||||
#include LV_CONF_KCONFIG_EXTERNAL_INCLUDE
|
#include LV_CONF_KCONFIG_EXTERNAL_INCLUDE
|
||||||
#else
|
#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*/
|
#endif /*LV_CONF_KCONFIG_EXTERNAL_INCLUDE*/
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
|
|
|
@ -24,10 +24,6 @@
|
||||||
#include "drv_mmheap.h"
|
#include "drv_mmheap.h"
|
||||||
#include "bl_romfs.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 uint32_t romfs_endaddr(void);
|
||||||
static int dirent_type(void *addr);
|
static int dirent_type(void *addr);
|
||||||
|
@ -339,6 +335,15 @@ int romfs_close(romfs_file_t *fp)
|
||||||
return -1;
|
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)
|
size_t romfs_read(romfs_file_t *fp, char *buf, size_t length)
|
||||||
{
|
{
|
||||||
char *payload_buf;
|
char *payload_buf;
|
||||||
|
@ -466,9 +471,8 @@ int romfs_stat(const char *path, romfs_stat_t *st)
|
||||||
return 0;
|
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 *start_addr;
|
||||||
char *end_addr;
|
char *end_addr;
|
||||||
int res;
|
int res;
|
||||||
|
@ -478,14 +482,14 @@ romfs_dir_t *romfs_opendir(const char *path)
|
||||||
/* sure romfs_root is valid */
|
/* sure romfs_root is valid */
|
||||||
if (romfs_root == NULL) {
|
if (romfs_root == NULL) {
|
||||||
ROMFS_ERROR("ERROR: romfs_root is null.\r\n");
|
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) {
|
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);
|
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);
|
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);
|
dp->dir_start_addr = (char *)(romfs_root + ALIGNUP16(strlen(romfs_root + 16) + 1) + 16 + 64);
|
||||||
} else {
|
} else {
|
||||||
if (0 == dirent_childaddr(start_addr)) {
|
if (0 == dirent_childaddr(start_addr)) {
|
||||||
return NULL;
|
return -3;
|
||||||
} else {
|
} else {
|
||||||
dp->dir_start_addr = (char *)(romfs_root + dirent_childaddr(start_addr));
|
dp->dir_start_addr = (char *)(romfs_root + dirent_childaddr(start_addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dp->dir_end_addr = end_addr;
|
dp->dir_end_addr = end_addr;
|
||||||
dp->dir_cur_addr = NULL;
|
dp->dir_cur_addr = NULL;
|
||||||
return dp;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open err */
|
/* open err */
|
||||||
mmheap_free(dp);
|
return -4;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
romfs_dirent_t *romfs_readdir(romfs_dir_t *dir)
|
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);
|
return &(dir->cur_dirent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +587,6 @@ int romfs_closedir(romfs_dir_t *dir)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mmheap_free(dir);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,11 @@
|
||||||
#define ROMFS_MOUNTPOINT "/romfs" /* must '/' */
|
#define ROMFS_MOUNTPOINT "/romfs" /* must '/' */
|
||||||
#define ROMFS_MAX_NAME_LEN (64)
|
#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_IFDIR 0x0040000
|
||||||
#define ROMFS_S_IFREG 0x0100000
|
#define ROMFS_S_IFREG 0x0100000
|
||||||
|
|
||||||
|
@ -80,7 +85,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int d_ino; /* file number */
|
int d_ino; /* file number */
|
||||||
uint8_t d_type; /* type of file */
|
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;
|
} romfs_dirent_t;
|
||||||
|
|
||||||
/* opendir 得到的目录结构体 */
|
/* opendir 得到的目录结构体 */
|
||||||
|
@ -94,10 +99,11 @@ typedef struct {
|
||||||
int romfs_mount(void);
|
int romfs_mount(void);
|
||||||
int romfs_open(romfs_file_t *fp, const char *path, int flags);
|
int romfs_open(romfs_file_t *fp, const char *path, int flags);
|
||||||
int romfs_close(romfs_file_t *fp);
|
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_read(romfs_file_t *fp, char *buf, size_t length);
|
||||||
size_t romfs_lseek(romfs_file_t *fp, int off, romfs_whence_t whence);
|
size_t romfs_lseek(romfs_file_t *fp, int off, romfs_whence_t whence);
|
||||||
int romfs_stat(const char *path, romfs_stat_t *st);
|
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);
|
romfs_dirent_t *romfs_readdir(romfs_dir_t *dir);
|
||||||
int romfs_closedir(romfs_dir_t *dir);
|
int romfs_closedir(romfs_dir_t *dir);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue