From 194ac5898d1e2ffaa17f6dca405614b73da6f8bb Mon Sep 17 00:00:00 2001 From: yinjiaming Date: Tue, 18 Jan 2022 13:33:09 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BD=93=E5=89=8D=E4=BB=93=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BC=96=E8=AF=91=E5=91=8A=E8=AD=A6=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E3=80=90=E8=83=8C=E6=99=AF=E3=80=91=20=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E4=BB=93=E4=BB=A3=E7=A0=81=E5=AD=98=E5=9C=A8=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=91=8A=E8=AD=A6=E9=9C=80=E8=A6=81=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【修改方案】 在测试用例中屏蔽了-Werror选项 在对应的代码处添加了相应函数的声明头文件 【影响】 对现有的产品编译不会有影响。 re #I4N50W Signed-off-by: yinjiaming Change-Id: I7dc1e38105aa3d60f9f991f34f88875cccb48463 --- arch/arm/arm9/gcc/BUILD.gn | 1 + arch/arm/cortex-m33/gcc/NTZ/BUILD.gn | 1 + arch/arm/cortex-m33/gcc/TZ/BUILD.gn | 1 + arch/arm/cortex-m4/gcc/BUILD.gn | 1 + arch/arm/cortex-m7/gcc/BUILD.gn | 1 + arch/csky/v2/gcc/BUILD.gn | 1 + arch/csky/v2/gcc/los_timer.c | 2 - arch/include/los_mpu.h | 2 +- arch/risc-v/riscv32/gcc/BUILD.gn | 1 + arch/xtensa/lx6/gcc/BUILD.gn | 1 + components/backtrace/BUILD.gn | 1 + components/cppsupport/BUILD.gn | 1 + components/cpup/BUILD.gn | 1 + components/dynlink/BUILD.gn | 1 + components/exchook/BUILD.gn | 1 + components/fs/fatfs/BUILD.gn | 1 + components/fs/littlefs/BUILD.gn | 1 + components/fs/littlefs/lfs_api.c | 4 +- components/fs/littlefs/lfs_api.h | 2 +- components/lmk/BUILD.gn | 1 + components/lms/BUILD.gn | 3 +- .../net/lwip-2.1/porting/src/api_shell.c | 3 + .../lwip-2.1/porting/src/sockets_porting.c | 1 + components/power/BUILD.gn | 1 + components/power/los_pm.c | 4 +- components/shell/src/base/shcmd.c | 1 - components/trace/BUILD.gn | 1 + components/trace/trace_offline.c | 2 +- components/trace/trace_online.c | 2 +- kal/cmsis/BUILD.gn | 1 + kal/cmsis/cmsis_liteos2.c | 2 +- kal/libc/musl/BUILD.gn | 1 + kal/libc/newlib/BUILD.gn | 1 + kal/libsec/BUILD.gn | 1 + kal/posix/BUILD.gn | 1 + kal/posix/Kconfig | 2 +- kal/posix/src/mqueue_impl.h | 3 +- kal/posix/src/pthread.c | 2 + kal/posix/src/time.c | 6 +- kernel/BUILD.gn | 1 + kernel/include/los_config.h | 4 +- kernel/include/los_sched.h | 2 +- kernel/include/los_tick.h | 56 +++++++++---------- kernel/src/los_sched.c | 2 +- kernel/src/los_sortlink.c | 2 +- kernel/src/los_task.c | 6 +- 46 files changed, 84 insertions(+), 53 deletions(-) diff --git a/arch/arm/arm9/gcc/BUILD.gn b/arch/arm/arm9/gcc/BUILD.gn index 53f7ee35..9ac2ce9b 100644 --- a/arch/arm/arm9/gcc/BUILD.gn +++ b/arch/arm/arm9/gcc/BUILD.gn @@ -39,6 +39,7 @@ kernel_module(module_name) { "los_timer.c", "reset_vector.S", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/arch/arm/cortex-m33/gcc/NTZ/BUILD.gn b/arch/arm/cortex-m33/gcc/NTZ/BUILD.gn index 341a1838..a155665a 100644 --- a/arch/arm/cortex-m33/gcc/NTZ/BUILD.gn +++ b/arch/arm/cortex-m33/gcc/NTZ/BUILD.gn @@ -38,6 +38,7 @@ kernel_module(module_name) { "los_interrupt.c", "los_timer.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/arch/arm/cortex-m33/gcc/TZ/BUILD.gn b/arch/arm/cortex-m33/gcc/TZ/BUILD.gn index a3d9e829..743441f3 100644 --- a/arch/arm/cortex-m33/gcc/TZ/BUILD.gn +++ b/arch/arm/cortex-m33/gcc/TZ/BUILD.gn @@ -39,6 +39,7 @@ kernel_module(module_name) { "non_secure/los_timer.c", "non_secure/los_trustzone.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] include_dirs = [ "non_secure", diff --git a/arch/arm/cortex-m4/gcc/BUILD.gn b/arch/arm/cortex-m4/gcc/BUILD.gn index 88498e54..f7ba5104 100644 --- a/arch/arm/cortex-m4/gcc/BUILD.gn +++ b/arch/arm/cortex-m4/gcc/BUILD.gn @@ -39,6 +39,7 @@ kernel_module(module_name) { "los_mpu.c", "los_timer.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/arch/arm/cortex-m7/gcc/BUILD.gn b/arch/arm/cortex-m7/gcc/BUILD.gn index 88498e54..f7ba5104 100644 --- a/arch/arm/cortex-m7/gcc/BUILD.gn +++ b/arch/arm/cortex-m7/gcc/BUILD.gn @@ -39,6 +39,7 @@ kernel_module(module_name) { "los_mpu.c", "los_timer.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/arch/csky/v2/gcc/BUILD.gn b/arch/csky/v2/gcc/BUILD.gn index 341a1838..a155665a 100755 --- a/arch/csky/v2/gcc/BUILD.gn +++ b/arch/csky/v2/gcc/BUILD.gn @@ -38,6 +38,7 @@ kernel_module(module_name) { "los_interrupt.c", "los_timer.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/arch/csky/v2/gcc/los_timer.c b/arch/csky/v2/gcc/los_timer.c index e1333395..a57013c8 100644 --- a/arch/csky/v2/gcc/los_timer.c +++ b/arch/csky/v2/gcc/los_timer.c @@ -42,8 +42,6 @@ typedef struct { UINT32 CALIB; } CORE_TIM_TYPE; -#define OS_CYCLE_PER_TICK (OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND) - #define CORE_TIM_BASE (0xE000E010UL) #define SysTick ((CORE_TIM_TYPE *)CORE_TIM_BASE) diff --git a/arch/include/los_mpu.h b/arch/include/los_mpu.h index e71c4f49..1e37dbd4 100644 --- a/arch/include/los_mpu.h +++ b/arch/include/los_mpu.h @@ -80,7 +80,7 @@ typedef struct { } MPU_CFG_PARA; VOID ArchMpuEnable(UINT32 defaultRegionEnable); -VOID ArchMpuDisable(); +VOID ArchMpuDisable(VOID); UINT32 ArchMpuSetRegion(UINT32 regionId, MPU_CFG_PARA *para); UINT32 ArchMpuDisableRegion(UINT32 regionId); INT32 ArchMpuUnusedRegionGet(VOID); diff --git a/arch/risc-v/riscv32/gcc/BUILD.gn b/arch/risc-v/riscv32/gcc/BUILD.gn index 62306c91..a48f7f21 100644 --- a/arch/risc-v/riscv32/gcc/BUILD.gn +++ b/arch/risc-v/riscv32/gcc/BUILD.gn @@ -38,6 +38,7 @@ kernel_module(module_name) { "los_interrupt.c", "los_timer.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/arch/xtensa/lx6/gcc/BUILD.gn b/arch/xtensa/lx6/gcc/BUILD.gn index 6188099d..9e6ce11f 100644 --- a/arch/xtensa/lx6/gcc/BUILD.gn +++ b/arch/xtensa/lx6/gcc/BUILD.gn @@ -39,6 +39,7 @@ kernel_module(module_name) { "los_timer.c", "los_window.S", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/backtrace/BUILD.gn b/components/backtrace/BUILD.gn index c25c5913..f8a36e99 100644 --- a/components/backtrace/BUILD.gn +++ b/components/backtrace/BUILD.gn @@ -33,6 +33,7 @@ module_switch = defined(LOSCFG_KERNEL_BACKTRACE) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ "los_backtrace.c" ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/cppsupport/BUILD.gn b/components/cppsupport/BUILD.gn index 87e68716..f19587d8 100644 --- a/components/cppsupport/BUILD.gn +++ b/components/cppsupport/BUILD.gn @@ -33,6 +33,7 @@ module_switch = defined(LOSCFG_KERNEL_CPPSUPPORT) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ "los_cppsupport.c" ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/cpup/BUILD.gn b/components/cpup/BUILD.gn index 5464b6a0..b3042a8e 100644 --- a/components/cpup/BUILD.gn +++ b/components/cpup/BUILD.gn @@ -33,6 +33,7 @@ module_switch = defined(LOSCFG_BASE_CORE_CPUP) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ "los_cpup.c" ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/dynlink/BUILD.gn b/components/dynlink/BUILD.gn index 5c5ee1a8..6c7e18d8 100644 --- a/components/dynlink/BUILD.gn +++ b/components/dynlink/BUILD.gn @@ -32,6 +32,7 @@ module_switch = defined(LOSCFG_KERNEL_DYNLINK) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ "los_dynlink.c" ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/exchook/BUILD.gn b/components/exchook/BUILD.gn index 15ad3cbe..4d4cd889 100644 --- a/components/exchook/BUILD.gn +++ b/components/exchook/BUILD.gn @@ -36,6 +36,7 @@ kernel_module(module_name) { "los_exc_info.c", "los_exchook.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/fs/fatfs/BUILD.gn b/components/fs/fatfs/BUILD.gn index ec3682f8..7667cf0d 100644 --- a/components/fs/fatfs/BUILD.gn +++ b/components/fs/fatfs/BUILD.gn @@ -39,6 +39,7 @@ kernel_module(module_name) { "$LITEOSTHIRDPARTY/FatFs/source/ffunicode.c", "fatfs.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/fs/littlefs/BUILD.gn b/components/fs/littlefs/BUILD.gn index 21b4a91a..3407d2d4 100644 --- a/components/fs/littlefs/BUILD.gn +++ b/components/fs/littlefs/BUILD.gn @@ -38,6 +38,7 @@ kernel_module(module_name) { "$LITEOSTHIRDPARTY/littlefs/lfs_util.c", "lfs_api.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/fs/littlefs/lfs_api.c b/components/fs/littlefs/lfs_api.c index 747d0f08..30a1610a 100644 --- a/components/fs/littlefs/lfs_api.c +++ b/components/fs/littlefs/lfs_api.c @@ -41,7 +41,7 @@ struct FileOpInfo g_fsOp[LOSCFG_LFS_MAX_MOUNT_SIZE] = {0}; static LittleFsHandleStruct g_handle[LITTLE_FS_MAX_OPEN_FILES] = {0}; struct dirent g_nameValue; 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"}; LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd) { @@ -573,7 +573,7 @@ int LfsClosedir(DIR *dir) return ret; } -int LfsOpen(const char *pathName, int openFlag, int mode) +int LfsOpen(const char *pathName, int openFlag, ...) { int fd = INVALID_FD; int err = INVALID_FD; diff --git a/components/fs/littlefs/lfs_api.h b/components/fs/littlefs/lfs_api.h index fe334919..b1ff93be 100644 --- a/components/fs/littlefs/lfs_api.h +++ b/components/fs/littlefs/lfs_api.h @@ -100,7 +100,7 @@ int LfsRmdir(const char *dirName); DIR *LfsOpendir(const char *dirName); struct dirent *LfsReaddir(DIR *dir); int LfsClosedir(DIR *dir); -int LfsOpen(const char *pathName, int openFlag, int mode); +int LfsOpen(const char *pathName, int openFlag, ...); int LfsRead(int fd, void *buf, unsigned int len); int LfsWrite(int fd, const void *buf, unsigned int len); off_t LfsSeek(int fd, off_t offset, int whence); diff --git a/components/lmk/BUILD.gn b/components/lmk/BUILD.gn index ee3349ce..b81a5b4d 100644 --- a/components/lmk/BUILD.gn +++ b/components/lmk/BUILD.gn @@ -33,6 +33,7 @@ module_switch = defined(LOSCFG_KERNEL_LMK) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ "los_lmk.c" ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/lms/BUILD.gn b/components/lms/BUILD.gn index d25d8987..003135c8 100644 --- a/components/lms/BUILD.gn +++ b/components/lms/BUILD.gn @@ -25,7 +25,7 @@ # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_m/liteos.gni") @@ -36,6 +36,7 @@ kernel_module(module_name) { "lms_libc.c", "los_lms.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/net/lwip-2.1/porting/src/api_shell.c b/components/net/lwip-2.1/porting/src/api_shell.c index 1231e637..959db672 100644 --- a/components/net/lwip-2.1/porting/src/api_shell.c +++ b/components/net/lwip-2.1/porting/src/api_shell.c @@ -39,9 +39,12 @@ #include "lwip/err.h" #include "lwip/ip_addr.h" #include "lwip/icmp.h" +#include "lwip/tcpip.h" +#include "lwip/inet_chksum.h" #include "los_config.h" #include #include +#include #include "los_debug.h" #include "los_task.h" diff --git a/components/net/lwip-2.1/porting/src/sockets_porting.c b/components/net/lwip-2.1/porting/src/sockets_porting.c index 05c717e7..7348e09b 100644 --- a/components/net/lwip-2.1/porting/src/sockets_porting.c +++ b/components/net/lwip-2.1/porting/src/sockets_porting.c @@ -34,6 +34,7 @@ #include "lwip/priv/sockets_priv.h" #include "lwip/prot/dhcp.h" #include "lwip/dhcp.h" +#include "lwip/if_api.h" #if !LWIP_COMPAT_SOCKETS #if LWIP_SOCKET diff --git a/components/power/BUILD.gn b/components/power/BUILD.gn index 4e11f10c..5fb48ca7 100644 --- a/components/power/BUILD.gn +++ b/components/power/BUILD.gn @@ -33,6 +33,7 @@ module_switch = defined(LOSCFG_KERNEL_PM) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ "los_pm.c" ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/power/los_pm.c b/components/power/los_pm.c index 0ed5e9fc..86a6d9e3 100644 --- a/components/power/los_pm.c +++ b/components/power/los_pm.c @@ -105,7 +105,7 @@ STATIC VOID OsPmTickTimerStart(LosPmCB *pm) tickTimer->timerStop(); realSleepTime = OS_SYS_CYCLE_TO_NS(sleepTime, tickTimer->freq); - realSleepTime = OS_SYS_NS_TO_CYCLE(realSleepTime, OS_SYS_CLOCK); + realSleepTime = OS_SYS_NS_TO_CYCLE(realSleepTime, g_sysClock); currTime = pm->enterSleepTime + realSleepTime; pm->enterSleepTime = 0; @@ -136,7 +136,7 @@ STATIC BOOL OsPmTickTimerStop(LosPmCB *pm) return FALSE; } - sleepCycle = OS_SYS_CYCLE_TO_NS(realSleepTime, OS_SYS_CLOCK); + sleepCycle = OS_SYS_CYCLE_TO_NS(realSleepTime, g_sysClock); sleepCycle = OS_SYS_NS_TO_CYCLE(sleepCycle, tickTimer->freq); /* The main CPU reduces the frequency */ diff --git a/components/shell/src/base/shcmd.c b/components/shell/src/base/shcmd.c index 9d2720f3..703065e1 100755 --- a/components/shell/src/base/shcmd.c +++ b/components/shell/src/base/shcmd.c @@ -309,7 +309,6 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsCmdExec(CmdParsed *cmdParsed) ret = (cmdHook)(cmdParsed->paramCnt, (const CHAR **)cmdParsed->paramArray); } -OUT: for (i = 0; i < cmdParsed->paramCnt; i++) { if (cmdParsed->paramArray[i] != NULL) { (VOID)LOS_MemFree(m_aucSysMem0, cmdParsed->paramArray[i]); diff --git a/components/trace/BUILD.gn b/components/trace/BUILD.gn index 664729be..e101935f 100644 --- a/components/trace/BUILD.gn +++ b/components/trace/BUILD.gn @@ -36,6 +36,7 @@ kernel_module(module_name) { "cnv/trace_cnv.c", "los_trace.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] include_dirs = [ ".", diff --git a/components/trace/trace_offline.c b/components/trace/trace_offline.c index 37d361e6..d9ee1cfb 100644 --- a/components/trace/trace_offline.c +++ b/components/trace/trace_offline.c @@ -68,7 +68,7 @@ UINT32 OsTraceBufInit(UINT32 size) g_traceRecoder.head = (OfflineHead *)buf; g_traceRecoder.head->baseInfo.bigLittleEndian = TRACE_BIGLITTLE_WORD; g_traceRecoder.head->baseInfo.version = TRACE_VERSION(TRACE_MODE_OFFLINE); - g_traceRecoder.head->baseInfo.clockFreq = OS_SYS_CLOCK; + g_traceRecoder.head->baseInfo.clockFreq = g_sysClock; g_traceRecoder.head->objSize = sizeof(ObjData); g_traceRecoder.head->frameSize = sizeof(TraceEventFrame); g_traceRecoder.head->objOffset = sizeof(OfflineHead); diff --git a/components/trace/trace_online.c b/components/trace/trace_online.c index a8d23edd..8bc2090a 100644 --- a/components/trace/trace_online.c +++ b/components/trace/trace_online.c @@ -49,7 +49,7 @@ VOID OsTraceSendHead(VOID) TraceBaseHeaderInfo head = { .bigLittleEndian = TRACE_BIGLITTLE_WORD, .version = TRACE_VERSION(TRACE_MODE_ONLINE), - .clockFreq = OS_SYS_CLOCK, + .clockFreq = g_sysClock, }; OsTraceDataSend(HEAD, sizeof(TraceBaseHeaderInfo), (UINT8 *)&head); diff --git a/kal/cmsis/BUILD.gn b/kal/cmsis/BUILD.gn index 2e5ccea9..619ec86c 100644 --- a/kal/cmsis/BUILD.gn +++ b/kal/cmsis/BUILD.gn @@ -33,6 +33,7 @@ module_switch = defined(LOSCFG_KAL_CMSIS) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ "cmsis_liteos2.c" ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/kal/cmsis/cmsis_liteos2.c b/kal/cmsis/cmsis_liteos2.c index 7ffa04df..539c53a2 100644 --- a/kal/cmsis/cmsis_liteos2.c +++ b/kal/cmsis/cmsis_liteos2.c @@ -270,7 +270,7 @@ uint32_t osKernelGetSysTimerCount(void) uint32_t osKernelGetSysTimerFreq(void) { - return OS_SYS_CLOCK; + return g_sysClock; } diff --git a/kal/libc/musl/BUILD.gn b/kal/libc/musl/BUILD.gn index 711aa42a..97e6038e 100644 --- a/kal/libc/musl/BUILD.gn +++ b/kal/libc/musl/BUILD.gn @@ -33,6 +33,7 @@ module_switch = defined(LOSCFG_LIBC_MUSL) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ "malloc.c" ] + configs += [ "$LITEOSTOPDIR:warn_config" ] if (defined(LOSCFG_LIBC_MUSL_FS)) { sources += [ "fs.c" ] diff --git a/kal/libc/newlib/BUILD.gn b/kal/libc/newlib/BUILD.gn index 7fa682d0..e97c8d46 100644 --- a/kal/libc/newlib/BUILD.gn +++ b/kal/libc/newlib/BUILD.gn @@ -39,6 +39,7 @@ kernel_module(module_name) { "porting/src/pthread.c", "porting/src/time.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] if (defined(LOSCFG_LIBC_NEWLIB_FS)) { sources += diff --git a/kal/libsec/BUILD.gn b/kal/libsec/BUILD.gn index a8127318..53b70b1f 100644 --- a/kal/libsec/BUILD.gn +++ b/kal/libsec/BUILD.gn @@ -33,6 +33,7 @@ import("//third_party/bounds_checking_function/libsec_src.gni") module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = libsec_sources + configs += [ "$LITEOSTOPDIR:warn_config" ] if (defined(LOSCFG_KERNEL_LMS)) { if ("$ohos_build_compiler" == "gcc") { cflags_c = [ "-fsanitize=kernel-address" ] diff --git a/kal/posix/BUILD.gn b/kal/posix/BUILD.gn index 69f7950c..1f766e06 100644 --- a/kal/posix/BUILD.gn +++ b/kal/posix/BUILD.gn @@ -36,6 +36,7 @@ kernel_module(module_name) { "src/errno.c", "src/libc.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] if (defined(LOSCFG_POSIX_THREAD_API)) { sources += [ diff --git a/kal/posix/Kconfig b/kal/posix/Kconfig index a57e6169..5c4877ce 100644 --- a/kal/posix/Kconfig +++ b/kal/posix/Kconfig @@ -62,7 +62,7 @@ config POSIX_MQUEUE_API config POSIX_PIPE_API bool "Enable POSIX Pipe API" - default y + default n help Answer Y to enable LiteOS support POSIX Pipe API. diff --git a/kal/posix/src/mqueue_impl.h b/kal/posix/src/mqueue_impl.h index daedc0ab..004a5c09 100644 --- a/kal/posix/src/mqueue_impl.h +++ b/kal/posix/src/mqueue_impl.h @@ -79,8 +79,9 @@ #define MQ_USE_MAGIC 0x89abcdef #define MQ_PRIO_MAX 1 - +#ifndef FNONBLOCK #define FNONBLOCK O_NONBLOCK +#endif #define QUEUE_SPLIT_BIT 16 diff --git a/kal/posix/src/pthread.c b/kal/posix/src/pthread.c index b583be5f..837c8dec 100644 --- a/kal/posix/src/pthread.c +++ b/kal/posix/src/pthread.c @@ -267,6 +267,8 @@ void pthread_exit(void *retVal) LOS_IntRestore(intSave); free(pthreadData); (void)LOS_TaskDelete(tcb->taskID); + while (1) { + } } int pthread_setname_np(pthread_t thread, const char *name) diff --git a/kal/posix/src/time.c b/kal/posix/src/time.c index c3153fe4..7d2d7294 100644 --- a/kal/posix/src/time.c +++ b/kal/posix/src/time.c @@ -246,8 +246,8 @@ int timer_getoverrun(timer_t timerID) STATIC VOID OsGetHwTime(struct timespec *hwTime) { UINT64 cycle = LOS_SysCycleGet(); - UINT64 nowNsec = (cycle / OS_SYS_CLOCK) * OS_SYS_NS_PER_SECOND + - (cycle % OS_SYS_CLOCK) * OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK; + UINT64 nowNsec = (cycle / g_sysClock) * OS_SYS_NS_PER_SECOND + + (cycle % g_sysClock) * OS_SYS_NS_PER_SECOND / g_sysClock; hwTime->tv_sec = nowNsec / OS_SYS_NS_PER_SECOND; hwTime->tv_nsec = nowNsec % OS_SYS_NS_PER_SECOND; @@ -369,7 +369,7 @@ int clock_getres(clockid_t clockID, struct timespec *tp) case CLOCK_REALTIME: case CLOCK_MONOTONIC_COARSE: case CLOCK_REALTIME_COARSE: - tp->tv_nsec = OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK; + tp->tv_nsec = OS_SYS_NS_PER_SECOND / g_sysClock; tp->tv_sec = 0; return 0; case CLOCK_THREAD_CPUTIME_ID: diff --git a/kernel/BUILD.gn b/kernel/BUILD.gn index 7851eb26..0cd77d50 100644 --- a/kernel/BUILD.gn +++ b/kernel/BUILD.gn @@ -45,6 +45,7 @@ kernel_module(module_name) { "src/mm/los_membox.c", "src/mm/los_memory.c", ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/kernel/include/los_config.h b/kernel/include/los_config.h index 5298c719..ed337b15 100644 --- a/kernel/include/los_config.h +++ b/kernel/include/los_config.h @@ -54,7 +54,7 @@ extern "C" { * System clock (unit: HZ) */ #ifndef OS_SYS_CLOCK - #error "OS_SYS_CLOCK is system clock rate which should be defined in target_config.h" +#define OS_SYS_CLOCK 1000000 #endif /** @@ -653,9 +653,11 @@ extern UINT8 *m_aucSysMem0; * @ingroup los_config * Configuration item to enable pipe device. */ +#ifndef LOSCFG_POSIX_PIPE_API #ifndef LOSCFG_PIPE_DEV #define LOSCFG_POSIX_PIPE_API 0 #endif +#endif #ifdef __cplusplus #if __cplusplus diff --git a/kernel/include/los_sched.h b/kernel/include/los_sched.h index bfadd544..1706ef7d 100644 --- a/kernel/include/los_sched.h +++ b/kernel/include/los_sched.h @@ -42,7 +42,7 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -#define OS_SCHED_MINI_PERIOD (OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND_MINI) +#define OS_SCHED_MINI_PERIOD (g_sysClock / LOSCFG_BASE_CORE_TICK_PER_SECOND_MINI) #define OS_TICK_RESPONSE_PRECISION (UINT32)((OS_SCHED_MINI_PERIOD * 75) / 100) #define OS_SCHED_MAX_RESPONSE_TIME (UINT64)(((UINT64)-1) - 1U) diff --git a/kernel/include/los_tick.h b/kernel/include/los_tick.h index 026c8756..ba71ffbd 100644 --- a/kernel/include/los_tick.h +++ b/kernel/include/los_tick.h @@ -105,6 +105,30 @@ extern UINT64 LOS_SysCycleGet(VOID); */ #define OS_SYS_MS_PER_SECOND 1000 +/** + * @ingroup los_tick + * Ticks per second + */ +extern UINT32 g_ticksPerSec; + +/** + * @ingroup los_tick + * Cycles per Second + */ +extern UINT32 g_uwCyclePerSec; + +/** + * @ingroup los_tick + * Cycles per Tick + */ +extern UINT32 g_cyclesPerTick; + +/** + * @ingroup los_tick + * System Clock + */ +extern UINT32 g_sysClock; + /** * @ingroup los_tick * Number of microseconds in one second. @@ -115,9 +139,9 @@ extern UINT64 LOS_SysCycleGet(VOID); #define OS_SYS_NS_PER_US 1000 -#define OS_CYCLE_PER_TICK (OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND) +#define OS_CYCLE_PER_TICK (g_sysClock / LOSCFG_BASE_CORE_TICK_PER_SECOND) -#define OS_NS_PER_CYCLE (OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK) +#define OS_NS_PER_CYCLE (OS_SYS_NS_PER_SECOND / g_sysClock) #define OS_MS_PER_TICK (OS_SYS_MS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND) @@ -125,8 +149,8 @@ extern UINT64 LOS_SysCycleGet(VOID); #define OS_NS_PER_TICK (OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND) -#define OS_SYS_CYCLE_TO_NS(cycle, freq) (((cycle) / (freq)) * OS_SYS_NS_PER_SECOND + \ - ((cycle) % OS_SYS_CLOCK) * OS_SYS_NS_PER_SECOND / (freq)) +#define OS_SYS_CYCLE_TO_NS(cycle, freq) ((cycle) / (freq)) * OS_SYS_NS_PER_SECOND + \ + ((cycle) % (freq) * OS_SYS_NS_PER_SECOND / (freq)) #define OS_SYS_NS_TO_CYCLE(time, freq) (((time) / OS_SYS_NS_PER_SECOND) * (freq) + \ ((time) % OS_SYS_NS_PER_SECOND) * (freq) / OS_SYS_NS_PER_SECOND) @@ -333,30 +357,6 @@ extern UINT32 LOS_MS2Tick(UINT32 millisec); */ extern UINT32 LOS_TickTimerRegister(const ArchTickTimer *timer, const HWI_PROC_FUNC tickHandler); -/** - * @ingroup los_tick - * Ticks per second - */ -extern UINT32 g_ticksPerSec; - -/** - * @ingroup los_tick - * Cycles per Second - */ -extern UINT32 g_uwCyclePerSec; - -/** - * @ingroup los_tick - * Cycles per Tick - */ -extern UINT32 g_cyclesPerTick; - -/** - * @ingroup los_tick - * System Clock - */ -extern UINT32 g_sysClock; - /** * @ingroup los_tick * @brief Handle the system tick timeout. diff --git a/kernel/src/los_sched.c b/kernel/src/los_sched.c index b2c936fe..8f71edf9 100644 --- a/kernel/src/los_sched.c +++ b/kernel/src/los_sched.c @@ -585,7 +585,7 @@ UINT64 LOS_SchedTickTimeoutNsGet(VOID) responseTime = 0; /* Tick interrupt already timeout */ } - return OS_SYS_CYCLE_TO_NS(responseTime, OS_SYS_CLOCK); + return OS_SYS_CYCLE_TO_NS(responseTime, g_sysClock); } VOID LOS_SchedTickHandler(VOID) diff --git a/kernel/src/los_sortlink.c b/kernel/src/los_sortlink.c index da47d839..e3adcee1 100644 --- a/kernel/src/los_sortlink.c +++ b/kernel/src/los_sortlink.c @@ -164,7 +164,7 @@ UINT32 OsSortLinkGetTargetExpireTime(UINT64 currTime, const SortLinkList *target return 0; } - return (UINT32)(((targetSortList->responseTime - currTime) * LOSCFG_BASE_CORE_TICK_PER_SECOND) / OS_SYS_CLOCK); + return (UINT32)(((targetSortList->responseTime - currTime) * LOSCFG_BASE_CORE_TICK_PER_SECOND) / g_sysClock); } UINT32 OsSortLinkGetNextExpireTime(const SortLinkAttribute *sortLinkHeader) diff --git a/kernel/src/los_task.c b/kernel/src/los_task.c index 1f6ea315..4fe63c1f 100644 --- a/kernel/src/los_task.c +++ b/kernel/src/los_task.c @@ -289,7 +289,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskCpupInfo(CPUP_INFO_S **cpuLessOneSec, } #endif -LITE_OS_SEC_TEXT_MINOR VOID OsPrintAllTskInfoHeader() +LITE_OS_SEC_TEXT_MINOR VOID OsPrintAllTskInfoHeader(VOID) { PRINTK("\r\n TID Priority Status StackSize WaterLine StackPoint TopOfStack EventMask SemID"); #if (LOSCFG_BASE_CORE_CPUP == 1) @@ -1472,8 +1472,8 @@ VOID LOS_UDelay(UINT64 microseconds) return; } - endTime = (microseconds / OS_SYS_US_PER_SECOND) * OS_SYS_CLOCK + - (microseconds % OS_SYS_US_PER_SECOND) * OS_SYS_CLOCK / OS_SYS_US_PER_SECOND; + endTime = (microseconds / OS_SYS_US_PER_SECOND) * g_sysClock + + (microseconds % OS_SYS_US_PER_SECOND) * g_sysClock / OS_SYS_US_PER_SECOND; endTime = LOS_SysCycleGet() + endTime; while (LOS_SysCycleGet() < endTime) { }