!248 同步master到beta2.2

Merge pull request !248 from lnlan/to_beta2.2
This commit is contained in:
openharmony_ci 2021-08-04 08:53:22 +00:00 committed by Gitee
commit d0e0bb5934
24 changed files with 63 additions and 70 deletions

View File

@ -331,7 +331,7 @@ ssize_t read(int fd, void *buf, size_t nbyte)
errno = EINVAL; errno = EINVAL;
return FS_FAILURE; return FS_FAILURE;
} }
if (nbyte > 1024) { if (nbyte > 1024) { /* 1024, max random_size */
nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */ nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */
} }
struct hks_blob key = {HKS_BLOB_TYPE_RAW, (uint8_t *)buf, nbyte}; struct hks_blob key = {HKS_BLOB_TYPE_RAW, (uint8_t *)buf, nbyte};

View File

@ -41,7 +41,7 @@ struct FileOpInfo g_fsOp[LOSCFG_LFS_MAX_MOUNT_SIZE] = {0};
static LittleFsHandleStruct g_handle[LITTLE_FS_MAX_OPEN_FILES] = {0}; static LittleFsHandleStruct g_handle[LITTLE_FS_MAX_OPEN_FILES] = {0};
struct dirent g_nameValue; struct dirent g_nameValue;
static pthread_mutex_t g_FslocalMutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t g_FslocalMutex = PTHREAD_MUTEX_INITIALIZER;
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a","/b","/c"}; static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a", "/b", "/c"};
LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd) LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd)
{ {

View File

@ -47,11 +47,9 @@
#include "lwip/icmp.h" #include "lwip/icmp.h"
#include "los_config.h" #include "los_config.h"
#include <string.h> #include <string.h>
#include "lwip/api_shell.h"
#include "shcmd.h" #include "shcmd.h"
#include "shell.h" #include "shell.h"
#include "los_timer_pri.h"
#include "los_debug.h" #include "los_debug.h"
#include "los_task.h" #include "los_task.h"
@ -104,10 +102,10 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
if (buf_len < 1) { if (buf_len < 1) {
goto out; goto out;
} }
if(netif->link_layer_type == LOOPBACK_IF){ if (netif->link_layer_type == LOOPBACK_IF) {
ret = snprintf_s(tmp, buf_len, (buf_len-1), "%s\t", netif->name); ret = snprintf_s(tmp, buf_len, (buf_len - 1), "%s\t", netif->name);
} else { } else {
ret = snprintf_s(tmp, buf_len, (buf_len-1), "%s%u\t", netif->name, netif->num); ret = snprintf_s(tmp, buf_len, (buf_len - 1), "%s%u\t", netif->name, netif->num);
} }
if ((ret <= 0) || ((unsigned int)ret >= buf_len)) if ((ret <= 0) || ((unsigned int)ret >= buf_len))
@ -317,8 +315,7 @@ static int ping_kill = 0;
static void lwip_ping_usage(void) static void lwip_ping_usage(void)
{ {
PRINTK("Usage:"\ PRINTK("Usage:\n ping [ip]\n");
"\n ping [ip]\n"
} }
LWIP_STATIC int OsPingFunc(u32_t *parg) LWIP_STATIC int OsPingFunc(u32_t *parg)
@ -332,11 +329,11 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
u32_t iecho_len; u32_t iecho_len;
s16_t ip_hlen; s16_t ip_hlen;
u32_t forever; u32_t forever;
u32_t i = 0; u32_t i;
u32_t succ_cnt = 0; u32_t succ_cnt = 0;
u32_t failed_cnt = 0; u32_t failed_cnt = 0;
struct timespec start, end; struct timespec start, end;
long timout_ms = 0; long timout_ms;
struct pollfd pfd; struct pollfd pfd;
long rtt; long rtt;
int ret = 0; int ret = 0;

View File

@ -190,7 +190,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsCmdAscendingInsert(CmdItemNode *cmd)
} }
for (cmdItem = LOS_DL_LIST_ENTRY((&cmdInfo.cmdList.list)->pstPrev, CmdItemNode, list); for (cmdItem = LOS_DL_LIST_ENTRY((&cmdInfo.cmdList.list)->pstPrev, CmdItemNode, list);
&cmdItem->list != &(cmdInfo.cmdList.list);) { &cmdItem->list != &(cmdInfo.cmdList.list); ) {
cmdNext = LOS_DL_LIST_ENTRY(cmdItem->list.pstPrev, CmdItemNode, list); cmdNext = LOS_DL_LIST_ENTRY(cmdItem->list.pstPrev, CmdItemNode, list);
if (&cmdNext->list != &(cmdInfo.cmdList.list)) { if (&cmdNext->list != &(cmdInfo.cmdList.list)) {
if ((strncmp(cmdItem->cmd->cmdKey, cmd->cmd->cmdKey, strlen(cmd->cmd->cmdKey)) >= 0) && if ((strncmp(cmdItem->cmd->cmdKey, cmd->cmd->cmdKey, strlen(cmd->cmd->cmdKey)) >= 0) &&

View File

@ -64,7 +64,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
{ {
unsigned int loop; unsigned int loop;
const char *tmpStr = NULL; const char *tmpStr = NULL;
bool quotes = FALSE; BOOL quotes = FALSE;
char *cmdName = NULL; char *cmdName = NULL;
if (cmdline == NULL) { if (cmdline == NULL) {
return NULL; return NULL;
@ -78,7 +78,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
/* Scan the 'cmdline' string for command */ /* Scan the 'cmdline' string for command */
/* Notice: Command string must not have any special name */ /* Notice: Command string must not have any special name */
for (tmpStr = cmdline, loop = 0; (*tmpStr != '\0') && (loop < len);) { for (tmpStr = cmdline, loop = 0; (*tmpStr != '\0') && (loop < len); ) {
/* If reach a double quotes, switch the quotes matching status */ /* If reach a double quotes, switch the quotes matching status */
if (*tmpStr == '\"') { if (*tmpStr == '\"') {
SWITCH_QUOTES_STATUS(quotes); SWITCH_QUOTES_STATUS(quotes);
@ -114,12 +114,10 @@ int ShellCmdExec(const char *msgName, const char *cmdString)
} }
uintRet = ShellMsgTypeGet(&cmdParsed, msgName); uintRet = ShellMsgTypeGet(&cmdParsed, msgName);
if (uintRet != LOS_OK) { if (uintRet != LOS_OK) {
PRINTK("%s:command not found\n", msgName); PRINTK("%s:command not found\n", msgName);
return -EFAULT; return -EFAULT;
} else { } else {
(void)OsCmdExec(&cmdParsed, (char *)cmdString); (void)OsCmdExec(&cmdParsed, (char *)cmdString);
} }
return 0; return 0;

View File

@ -88,11 +88,11 @@ static char *StrNormalizePath(char *fullpath)
while (*src != '\0') { while (*src != '\0') {
if (*src == '.') { if (*src == '.') {
if (*(src + 1) == '/') { if (*(src + 1) == '/') {
src += 2; src += 2; /* 2, sizeof "./" */
continue; continue;
} else if (*(src + 1) == '.') { } else if (*(src + 1) == '.') {
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) { if ((*(src + 2) == '/') || (*(src + 2) == '\0')) { /* 2, 2, offset to check */
src += 2; src += 2; /* 2, sizeof offset */
} else { } else {
while ((*src != '\0') && (*src != '/')) { while ((*src != '\0') && (*src != '/')) {
*dest++ = *src++; *dest++ = *src++;
@ -174,7 +174,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
/* 2: The position of the path character: / and the end character /0 */ /* 2: The position of the path character: / and the end character /0 */
if ((namelen > 1) && (filename[0] == '.') && (filename[1] == '/')) { if ((namelen > 1) && (filename[0] == '.') && (filename[1] == '/')) {
filename += 2; filename += 2; /* 2, sizeof "./" */
} }
fullpath = (char *)malloc(strlen(directory) + namelen + 2); fullpath = (char *)malloc(strlen(directory) + namelen + 2);
@ -184,8 +184,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
return (char *)NULL; return (char *)NULL;
} }
/* join path and file name */ /* 2, sizeof "./", join path and file name */
ret = snprintf_s(fullpath, strlen(directory) + namelen + 2, strlen(directory) + namelen + 1, ret = snprintf_s(fullpath, strlen(directory) + namelen + 2, strlen(directory) + namelen + 1,
"%s/%s", directory, filename); "%s/%s", directory, filename);
if (ret < 0) { if (ret < 0) {
@ -213,7 +212,6 @@ static char *VfsNormalizeFullpath(const char *directory, const char *filename, c
/* it's a absolute path, use it directly */ /* it's a absolute path, use it directly */
fullpath = strdup(filename); /* copy string */ fullpath = strdup(filename); /* copy string */
if (fullpath == NULL) { if (fullpath == NULL) {
*pathname = NULL; *pathname = NULL;
SetErrno(ENOMEM); SetErrno(ENOMEM);
@ -246,8 +244,7 @@ int VfsNormalizePath(const char *directory, const char *filename, char **pathnam
return -EINVAL; return -EINVAL;
} }
/* 2: The position of the path character: / and the end character /0 */ /* 2, The position of the path character: / and the end character /0 */
if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) { if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) {
return -ENAMETOOLONG; return -ENAMETOOLONG;
} }

2
config.gni Normal file → Executable file
View File

@ -33,7 +33,7 @@ declare_args() {
enable_ohos_kernel_liteos_m_exchook = true enable_ohos_kernel_liteos_m_exchook = true
enable_ohos_kernel_liteos_m_kal = true enable_ohos_kernel_liteos_m_kal = true
enable_ohos_kernel_liteos_m_fs = true enable_ohos_kernel_liteos_m_fs = true
enable_ohos_kernel_liteos_m_shell = false enable_ohos_kernel_liteos_m_shell = true
enable_ohos_kernel_liteos_m_backtrace = true enable_ohos_kernel_liteos_m_backtrace = true
enable_ohos_kernel_liteos_m_test = false enable_ohos_kernel_liteos_m_test = false
enable_ohos_kernel_liteos_m_pm = true enable_ohos_kernel_liteos_m_pm = true

View File

@ -231,3 +231,23 @@ int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stackSize)
return 0; return 0;
} }
int sched_get_priority_min(int policy)
{
if (policy != SCHED_RR) {
errno = EINVAL;
return -1;
}
return LOS_TASK_PRIORITY_LOWEST;
}
int sched_get_priority_max(int policy)
{
if (policy != SCHED_RR) {
errno = EINVAL;
return -1;
}
return LOS_TASK_PRIORITY_HIGHEST;
}

View File

@ -42,6 +42,7 @@
#include "los_swtmr.h" #include "los_swtmr.h"
#include "los_tick.h" #include "los_tick.h"
#include "los_context.h" #include "los_context.h"
#include "los_interrupt.h"
/* accumulative time delta from discontinuous modify */ /* accumulative time delta from discontinuous modify */
STATIC struct timespec g_accDeltaFromSet; STATIC struct timespec g_accDeltaFromSet;

View File

@ -61,7 +61,7 @@ static_library("kernel") {
} else if ("$board_cpu" == "cortex-m7") { } else if ("$board_cpu" == "cortex-m7") {
deps = [ "arch/arm/cortex-m7/gcc/:arch" ] deps = [ "arch/arm/cortex-m7/gcc/:arch" ]
} else if ("$board_cpu" == "cortex-m33") { } else if ("$board_cpu" == "cortex-m33") {
deps = [ "arch/arm/cortex-m33/gcc/:arch" ] deps = [ "arch/arm/cortex-m33/gcc/TZ:arch" ]
} else if ("$board_cpu" == "") { } else if ("$board_cpu" == "") {
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") { if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
deps = [ "arch/risc-v/riscv32/gcc:arch" ] deps = [ "arch/risc-v/riscv32/gcc:arch" ]

View File

@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID); VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID); VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID); VOID HalExcUsageFault(VOID);
VOID HalExcSvcCall(VOID); VOID HalSVCHandler(VOID);
VOID HalHwiInit(); VOID HalHwiInit();

View File

@ -41,7 +41,7 @@
.global HalExcMemFault .global HalExcMemFault
.global HalExcBusFault .global HalExcBusFault
.global HalExcUsageFault .global HalExcUsageFault
.global HalExcSvcCall .global HalSVCHandler
.extern HalExcHandleEntry .extern HalExcHandleEntry
.extern g_uwExcTbl .extern g_uwExcTbl
@ -148,9 +148,9 @@ osHFExcCommonBMU:
B osExcDispatch B osExcDispatch
.fnend .fnend
.type HalExcSvcCall, %function .type HalSVCHandler, %function
.global HalExcSvcCall .global HalSVCHandler
HalExcSvcCall: HalSVCHandler:
.fnstart .fnstart
.cantunwind .cantunwind
TST LR, #0x4 TST LR, #0x4

View File

@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault; g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault; g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault; g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall; g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV; g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler; g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;

View File

@ -41,6 +41,8 @@ static_library("arch") {
] ]
include_dirs = [ include_dirs = [
"./non_secure",
"./secure",
"../../../../../../kernel/arch/include", "../../../../../../kernel/arch/include",
"../../../../../../kernel/arch/include", "../../../../../../kernel/arch/include",
"../../../../../../kernel/include", "../../../../../../kernel/include",

View File

@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID); VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID); VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID); VOID HalExcUsageFault(VOID);
VOID HalExcSvcCall(VOID); VOID HalSVCHandler(VOID);
VOID HalHwiInit(); VOID HalHwiInit();

View File

@ -48,8 +48,6 @@
.type HalStartFirstTask, %function .type HalStartFirstTask, %function
.global HalStartFirstTask .global HalStartFirstTask
HalStartFirstTask: HalStartFirstTask:
.fnstart
.cantunwind
MOV R0, #2 MOV R0, #2
MSR CONTROL, R0 MSR CONTROL, R0
@ -77,7 +75,6 @@ __DisabledFPU1:
MSR PSP, R12 MSR PSP, R12
CPSIE I CPSIE I
BX R3 BX R3
.fnend
.type HalIntLock, %function .type HalIntLock, %function
.global HalIntLock .global HalIntLock

View File

@ -41,7 +41,6 @@
.global HalExcMemFault .global HalExcMemFault
.global HalExcBusFault .global HalExcBusFault
.global HalExcUsageFault .global HalExcUsageFault
.global HalExcSvcCall
.extern HalExcHandleEntry .extern HalExcHandleEntry
.extern g_uwExcTbl .extern g_uwExcTbl
@ -148,21 +147,6 @@ osHFExcCommonBMU:
B osExcDispatch B osExcDispatch
.fnend .fnend
.type HalExcSvcCall, %function
.global HalExcSvcCall
HalExcSvcCall:
.fnstart
.cantunwind
TST LR, #0x4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
LDR R1, [R0,#24]
LDRB R0, [R1,#-2]
MOV R1, #0
B osExcDispatch
.fnend
.type HalExcBusFault, %function .type HalExcBusFault, %function
.global HalExcBusFault .global HalExcBusFault
HalExcBusFault: HalExcBusFault:

View File

@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault; g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault; g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault; g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall; g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV; g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler; g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;

View File

@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif #endif

View File

@ -94,7 +94,7 @@ HalSecureContextSaveAsm:
MOV R0, #0 MOV R0, #0
MSR PSPLIM, R0 /* No PSPLIM for the current task. */ MSR PSPLIM, R0 /* No PSPLIM for the current task. */
MSR PSP, R0 /* No secure stack for the current task. */ MSR PSP, R0 /* No secure stack for the current task. */
.fnend
__ThreadMode: __ThreadMode:
BX LR BX LR
.fnend

View File

@ -29,7 +29,6 @@
extern VOID HalHwiInit(VOID); extern VOID HalHwiInit(VOID);
#define INITIAL_MSTATUS ( MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL) #define INITIAL_MSTATUS ( MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL)
#define ALIGN_DOWN(size, align) ((size) & ~((align) - 1)) #define ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -71,13 +71,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
HWI_PROC_FUNC handler, HWI_PROC_FUNC handler,
HWI_ARG_T arg) HWI_ARG_T arg)
{ {
if (hwiNum > SOC_INT_MAX){ if (hwiNum > SOC_INT_MAX) {
return OS_ERRNO_HWI_NUM_INVALID; return OS_ERRNO_HWI_NUM_INVALID;
} }
if (mode > ECLIC_VECTOR_INTERRUPT){ if (mode > ECLIC_VECTOR_INTERRUPT) {
return OS_ERRNO_HWI_MODE_INVALID; return OS_ERRNO_HWI_MODE_INVALID;
} }
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER){ if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER) {
return OS_ERRNO_HWI_ARG_INVALID; return OS_ERRNO_HWI_ARG_INVALID;
} }