!296 支持最小化特性编译,添加了一个针对qemu arm virt的样例config配置

Merge pull request !296 from Caoruihong/master
This commit is contained in:
openharmony_ci 2021-06-07 22:51:46 +08:00 committed by Gitee
commit 647f3defcd
16 changed files with 97 additions and 49 deletions

View File

@ -145,10 +145,9 @@ genconfig:$(MENUCONFIG_CONF)
$< --silentoldconfig $(KCONFIG_FILE_PATH) $< --silentoldconfig $(KCONFIG_FILE_PATH)
##### menuconfig end ####### ##### menuconfig end #######
$(LITEOS_MENUCONFIG_H): $(LITEOS_MENUCONFIG_H): .config
ifneq ($(LITEOS_MENUCONFIG_H), $(wildcard $(LITEOS_MENUCONFIG_H)))
$(HIDE)$(MAKE) genconfig $(HIDE)$(MAKE) genconfig
endif
$(LITEOS_TARGET): $(__LIBS) $(LITEOS_TARGET): $(__LIBS)
$(HIDE)touch $(LOSCFG_ENTRY_SRC) $(HIDE)touch $(LOSCFG_ENTRY_SRC)

View File

@ -692,7 +692,9 @@ VOID BackTraceSub(UINTPTR regFP)
UINTPTR backFP = regFP; UINTPTR backFP = regFP;
UINT32 count = 0; UINT32 count = 0;
VADDR_T kvaddr; VADDR_T kvaddr;
#ifdef LOSCFG_KERNEL_VM
LosProcessCB *runProcess = OsCurrProcessGet(); LosProcessCB *runProcess = OsCurrProcessGet();
#endif
if (FindSuitableStack(regFP, &stackStart, &stackEnd, &kvaddr) == FALSE) { if (FindSuitableStack(regFP, &stackStart, &stackEnd, &kvaddr) == FALSE) {
PrintExcInfo("traceback error fp = 0x%x\n", regFP); PrintExcInfo("traceback error fp = 0x%x\n", regFP);

View File

@ -30,6 +30,7 @@
*/ */
#include "mqueue.h" #include "mqueue.h"
#ifdef LOSCFG_FS_VFS
#include "fcntl.h" #include "fcntl.h"
#include "pthread.h" #include "pthread.h"
#include "map_error.h" #include "map_error.h"
@ -831,3 +832,4 @@ ssize_t mq_receive(mqd_t personal, char *msg_ptr, size_t msg_len, unsigned int *
return mq_timedreceive(personal, msg_ptr, msg_len, msg_prio, NULL); return mq_timedreceive(personal, msg_ptr, msg_len, msg_prio, NULL);
} }
#endif

View File

@ -451,6 +451,7 @@ int clock_settime(clockid_t clockID, const struct timespec *tp)
return settimeofday(&tv, NULL); return settimeofday(&tv, NULL);
} }
#ifdef LOSCFG_KERNEL_CPUP
static int PthreadGetCputime(clockid_t clockID, struct timespec *ats) static int PthreadGetCputime(clockid_t clockID, struct timespec *ats)
{ {
uint64_t runtime; uint64_t runtime;
@ -519,12 +520,47 @@ static int GetCputime(clockid_t clockID, struct timespec *tp)
return ret; return ret;
} }
static int CheckClock(const clockid_t clockID)
{
int error = 0;
const pid_t pid = ((pid_t) ~((clockID) >> CPUCLOCK_ID_OFFSET));
if (!((UINT32)clockID & CPUCLOCK_PERTHREAD_MASK)) {
LosProcessCB *spcb = NULL;
if (OsProcessIDUserCheckInvalid(pid) || pid < 0) {
return -EINVAL;
}
spcb = OS_PCB_FROM_PID(pid);
if (OsProcessIsUnused(spcb)) {
error = -EINVAL;
}
} else {
error = -EINVAL;
}
return error;
}
static int CpuClockGetres(const clockid_t clockID, struct timespec *tp)
{
if (clockID > 0) {
return -EINVAL;
}
int error = CheckClock(clockID);
if (!error) {
error = ProcessGetCputime(clockID, tp);
}
return error;
}
#endif
int clock_gettime(clockid_t clockID, struct timespec *tp) int clock_gettime(clockid_t clockID, struct timespec *tp)
{ {
UINT32 intSave; UINT32 intSave;
struct timespec64 tmp = {0}; struct timespec64 tmp = {0};
struct timespec64 hwTime = {0}; struct timespec64 hwTime = {0};
int ret;
if (clockID > MAX_CLOCKS) { if (clockID > MAX_CLOCKS) {
goto ERROUT; goto ERROUT;
@ -566,61 +602,24 @@ int clock_gettime(clockid_t clockID, struct timespec *tp)
case CLOCK_TAI: case CLOCK_TAI:
TIME_RETURN(ENOTSUP); TIME_RETURN(ENOTSUP);
default: default:
{ {
#ifdef LOSCFG_KERNEL_CPUP #ifdef LOSCFG_KERNEL_CPUP
ret = GetCputime(clockID, tp); int ret = GetCputime(clockID, tp);
TIME_RETURN(-ret); TIME_RETURN(-ret);
#else #else
TIME_RETURN(EINVAL); TIME_RETURN(EINVAL);
#endif #endif
} }
} }
return 0; return 0;
ERROUT: ERROUT:
TIME_RETURN(EINVAL); TIME_RETURN(EINVAL);
} }
static int CheckClock(const clockid_t clockID)
{
int error = 0;
const pid_t pid = ((pid_t) ~((clockID) >> CPUCLOCK_ID_OFFSET));
if (!((UINT32)clockID & CPUCLOCK_PERTHREAD_MASK)) {
LosProcessCB *spcb = NULL;
if (OsProcessIDUserCheckInvalid(pid) || pid < 0) {
return -EINVAL;
}
spcb = OS_PCB_FROM_PID(pid);
if (OsProcessIsUnused(spcb)) {
error = -EINVAL;
}
} else {
error = -EINVAL;
}
return error;
}
static int CpuClockGetres(const clockid_t clockID, struct timespec *tp)
{
if (clockID > 0) {
return -EINVAL;
}
int error = CheckClock(clockID);
if (!error) {
error = ProcessGetCputime(clockID, tp);
}
return error;
}
int clock_getres(clockid_t clockID, struct timespec *tp) int clock_getres(clockid_t clockID, struct timespec *tp)
{ {
int ret;
if (tp == NULL) { if (tp == NULL) {
TIME_RETURN(EINVAL); TIME_RETURN(EINVAL);
} }
@ -650,7 +649,7 @@ int clock_getres(clockid_t clockID, struct timespec *tp)
default: default:
#ifdef LOSCFG_KERNEL_CPUP #ifdef LOSCFG_KERNEL_CPUP
{ {
ret = CpuClockGetres(clockID, tp); int ret = CpuClockGetres(clockID, tp);
TIME_RETURN(-ret); TIME_RETURN(-ret);
} }
#else #else

View File

@ -751,8 +751,12 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsSystemProcessCreate(VOID)
LOS_ListTailInsert(&kerInitProcess->childrenList, &idleProcess->siblingList); LOS_ListTailInsert(&kerInitProcess->childrenList, &idleProcess->siblingList);
idleProcess->group = kerInitProcess->group; idleProcess->group = kerInitProcess->group;
LOS_ListTailInsert(&kerInitProcess->group->processList, &idleProcess->subordinateGroupList); LOS_ListTailInsert(&kerInitProcess->group->processList, &idleProcess->subordinateGroupList);
#ifdef LOSCFG_SECURITY_CAPABILITY
idleProcess->user = kerInitProcess->user; idleProcess->user = kerInitProcess->user;
#endif
#ifdef LOSCFG_FS_VFS
idleProcess->files = kerInitProcess->files; idleProcess->files = kerInitProcess->files;
#endif
ret = OsIdleTaskCreate(); ret = OsIdleTaskCreate();
if (ret != LOS_OK) { if (ret != LOS_OK) {

View File

@ -37,7 +37,9 @@
#ifndef __LOS_VM_FILEMAP_H__ #ifndef __LOS_VM_FILEMAP_H__
#define __LOS_VM_FILEMAP_H__ #define __LOS_VM_FILEMAP_H__
#ifdef LOSCFG_FS_VFS
#include "fs/file.h" #include "fs/file.h"
#endif
#include "los_vm_map.h" #include "los_vm_map.h"
#include "los_vm_page.h" #include "los_vm_page.h"
#include "los_vm_common.h" #include "los_vm_common.h"

View File

@ -34,6 +34,7 @@
#include "los_sem_pri.h" #include "los_sem_pri.h"
#include "los_queue_pri.h" #include "los_queue_pri.h"
#include "los_swtmr_pri.h" #include "los_swtmr_pri.h"
#include "los_task_pri.h"
#ifdef LOSCFG_SHELL #ifdef LOSCFG_SHELL
#include "shcmd.h" #include "shcmd.h"

View File

@ -42,8 +42,9 @@
#include "los_oom.h" #include "los_oom.h"
#include "los_vm_dump.h" #include "los_vm_dump.h"
#include "los_process_pri.h" #include "los_process_pri.h"
#ifdef LOSCFG_FS_VFS
#include "fs/path_cache.h" #include "fs/path_cache.h"
#endif
#ifdef LOSCFG_KERNEL_VM #ifdef LOSCFG_KERNEL_VM

View File

@ -36,7 +36,9 @@
#include "los_vm_dump.h" #include "los_vm_dump.h"
#include "los_mmu_descriptor_v6.h" #include "los_mmu_descriptor_v6.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h" #include "fs/fs.h"
#endif
#include "los_printf.h" #include "los_printf.h"
#include "los_vm_page.h" #include "los_vm_page.h"
#include "los_vm_phys.h" #include "los_vm_phys.h"

View File

@ -42,6 +42,9 @@
#include "los_process_pri.h" #include "los_process_pri.h"
#include "los_vm_lock.h" #include "los_vm_lock.h"
#ifndef UNUSED
#define UNUSED(x) (VOID)x
#endif
#ifdef LOSCFG_KERNEL_VM #ifdef LOSCFG_KERNEL_VM

View File

@ -40,7 +40,9 @@
#include "los_vm_shm_pri.h" #include "los_vm_shm_pri.h"
#include "los_arch_mmu.h" #include "los_arch_mmu.h"
#include "los_process_pri.h" #include "los_process_pri.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h" #include "fs/fs.h"
#endif
#include "los_task.h" #include "los_task.h"
#include "los_memory_pri.h" #include "los_memory_pri.h"
#include "los_vm_boot.h" #include "los_vm_boot.h"

View File

@ -626,7 +626,7 @@ size_t LOS_PhysPagesFree(LOS_DL_LIST *list)
#else #else
VADDR_T *LOS_PaddrToKVaddr(PADDR_T paddr) VADDR_T *LOS_PaddrToKVaddr(PADDR_T paddr)
{ {
if ((paddr < DDR_MEM_ADDR) || (paddr >= (DDR_MEM_ADDR + DDR_MEM_SIZE))) { if ((paddr < DDR_MEM_ADDR) || (paddr >= ((PADDR_T)DDR_MEM_ADDR + DDR_MEM_SIZE))) {
return NULL; return NULL;
} }

View File

@ -280,6 +280,13 @@ LITE_OS_SEC_TEXT_INIT INT32 OsMain(VOID)
return LOS_OK; return LOS_OK;
} }
#ifndef LOSCFG_PLATFORM_ADAPT
STATIC VOID SystemInit(VOID)
{
PRINTK("dummy: *** %s ***\n", __FUNCTION__);
}
#endif
STATIC UINT32 OsSystemInitTaskCreate(VOID) STATIC UINT32 OsSystemInitTaskCreate(VOID)
{ {
UINT32 taskID; UINT32 taskID;

View File

@ -85,6 +85,7 @@ STATIC VOID UartOutput(const CHAR *str, UINT32 len, BOOL isLock)
#endif #endif
} }
#ifdef LOSCFG_PLATFORM_CONSOLE
STATIC VOID ConsoleOutput(const CHAR *str, UINT32 len) STATIC VOID ConsoleOutput(const CHAR *str, UINT32 len)
{ {
ssize_t writen = 0; ssize_t writen = 0;
@ -100,6 +101,7 @@ STATIC VOID ConsoleOutput(const CHAR *str, UINT32 len)
toWrite -= cnt; toWrite -= cnt;
} }
} }
#endif
VOID OutputControl(const CHAR *str, UINT32 len, OutputType type) VOID OutputControl(const CHAR *str, UINT32 len, OutputType type)
{ {

View File

@ -36,7 +36,9 @@
#include "los_task.h" #include "los_task.h"
#include "los_mux.h" #include "los_mux.h"
#include "los_signal.h" #include "los_signal.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h" #include "fs/fs.h"
#endif
#include "syscall.h" #include "syscall.h"
#include "sysinfo.h" #include "sysinfo.h"
#include "time_posix.h" #include "time_posix.h"
@ -49,7 +51,9 @@
#include "sys/shm.h" #include "sys/shm.h"
#include "poll.h" #include "poll.h"
#include "utime.h" #include "utime.h"
#ifdef LOSCFG_COMPAT_POSIX
#include "mqueue.h" #include "mqueue.h"
#endif
#include "time.h" #include "time.h"
#include "sys/time.h" #include "sys/time.h"
#include "sys/stat.h" #include "sys/stat.h"
@ -108,6 +112,8 @@ extern int SysFutex(const unsigned int *uAddr, unsigned int flags, int val,
unsigned int absTime, const unsigned int *newUserAddr); unsigned int absTime, const unsigned int *newUserAddr);
extern int SysSchedGetAffinity(int id, unsigned int *cpuset, int flag); extern int SysSchedGetAffinity(int id, unsigned int *cpuset, int flag);
extern int SysSchedSetAffinity(int id, const unsigned short cpuset, int flag); extern int SysSchedSetAffinity(int id, const unsigned short cpuset, int flag);
#ifdef LOSCFG_COMPAT_POSIX
extern mqd_t SysMqOpen(const char *mqName, int openFlag, mode_t mode, struct mq_attr *attr); extern mqd_t SysMqOpen(const char *mqName, int openFlag, mode_t mode, struct mq_attr *attr);
extern int SysMqClose(mqd_t personal); extern int SysMqClose(mqd_t personal);
extern int SysMqGetSetAttr(mqd_t mqd, const struct mq_attr *new, struct mq_attr *old); extern int SysMqGetSetAttr(mqd_t mqd, const struct mq_attr *new, struct mq_attr *old);
@ -117,6 +123,8 @@ extern int SysMqTimedSend(mqd_t personal, const char *msg, size_t msgLen, unsign
const struct timespec *absTimeout); const struct timespec *absTimeout);
extern ssize_t SysMqTimedReceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *msgPrio, extern ssize_t SysMqTimedReceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *msgPrio,
const struct timespec *absTimeout); const struct timespec *absTimeout);
#endif
extern int SysSigAction(int sig, const sigaction_t *restrict sa, sigaction_t *restrict old, size_t sigsetsize); extern int SysSigAction(int sig, const sigaction_t *restrict sa, sigaction_t *restrict old, size_t sigsetsize);
extern int SysSigprocMask(int how, const sigset_t_l *restrict set, sigset_t *restrict old, size_t sigsetsize); extern int SysSigprocMask(int how, const sigset_t_l *restrict set, sigset_t *restrict old, size_t sigsetsize);
extern int SysKill(pid_t pid, int sig); extern int SysKill(pid_t pid, int sig);

View File

@ -0,0 +1,14 @@
LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7=y
LOSCFG_BOARD_CONFIG_PATH="device/qemu/arm_virt/liteos_a/config/board"
# LOSCFG_HRTIMER_ENABLE is not set
# LOSCFG_IRQ_USE_STANDALONE_STACK is not set
# LOSCFG_KERNEL_MMU is not set
# LOSCFG_KERNEL_EXTKERNEL is not set
# LOSCFG_BASE_CORE_HILOG is not set
# LOSCFG_LIB_ZLIB is not set
# LOSCFG_FS_VFS is not set
# LOSCFG_NET_LWIP_SACK is not set
# LOSCFG_PLATFORM_ADAPT is not set
# LOSCFG_ENABLE_MAGICKEY is not set
# LOSCFG_DRIVERS is not set
# LOSCFG_SECURITY is not set