From e424932163e9bb7744d46f4b844ee165ac25dd4e Mon Sep 17 00:00:00 2001 From: Wang_Weigen Date: Thu, 29 Apr 2021 16:15:11 +0800 Subject: [PATCH] remove all comile warning of kernel --- applications/user_api/switch_api/user_api.h | 2 +- applications/user_api/switch_api/user_fs.c | 4 +++- arch/arm/cortex-m4/interrupt.c | 2 ++ arch/arm/shared/prepare_ahwstack.c | 8 ++++---- kernel/include/user_api.h | 2 +- kernel/kernel_test/user_api.h | 2 +- kernel/memory/byte_manage.c | 10 +++++----- kernel/thread/console.c | 2 ++ tool/shell/letter-shell/file_ext/bunzip2.c | 4 ++-- 9 files changed, 21 insertions(+), 15 deletions(-) diff --git a/applications/user_api/switch_api/user_api.h b/applications/user_api/switch_api/user_api.h index cbda332a..48e9f837 100644 --- a/applications/user_api/switch_api/user_api.h +++ b/applications/user_api/switch_api/user_api.h @@ -160,7 +160,7 @@ struct statfs { int statfs(const char *path, struct statfs *buf); #endif -void Userprintf(const char *fmt, ...); +int Userprintf(const char *fmt, ...); #define printf Userprintf diff --git a/applications/user_api/switch_api/user_fs.c b/applications/user_api/switch_api/user_fs.c index 30586514..c07325e3 100644 --- a/applications/user_api/switch_api/user_fs.c +++ b/applications/user_api/switch_api/user_fs.c @@ -21,6 +21,7 @@ #include "user_api.h" #include +#include #define stdio 1 #define CONSOLEBUF_SIZE 128 @@ -123,7 +124,7 @@ int statfs(const char *path, struct statfs *buf){ return (int)(KSwitch2(KS_USER_STAT_FS,(uintptr_t)path,(uintptr_t)buf)); } -void Userprintf(const char *fmt, ...) +int Userprintf(const char *fmt, ...) { if(stdio != NONE) { @@ -140,5 +141,6 @@ void Userprintf(const char *fmt, ...) write(stdio, logbuf, length); va_end(args); } + return 0; } diff --git a/arch/arm/cortex-m4/interrupt.c b/arch/arm/cortex-m4/interrupt.c index 3809dad4..7dfbb8fe 100644 --- a/arch/arm/cortex-m4/interrupt.c +++ b/arch/arm/cortex-m4/interrupt.c @@ -23,6 +23,8 @@ #include #include +extern void _svcall(uintptr_t* contex); + x_base __attribute__((naked)) DisableLocalInterrupt() { asm volatile ("MRS r0, PRIMASK"); diff --git a/arch/arm/shared/prepare_ahwstack.c b/arch/arm/shared/prepare_ahwstack.c index caf9af9a..b12d5b01 100644 --- a/arch/arm/shared/prepare_ahwstack.c +++ b/arch/arm/shared/prepare_ahwstack.c @@ -290,8 +290,8 @@ struct ExceptionInfo void HwHardFaultException(struct ExceptionInfo *ExceptionInfo) { extern long ShowTask(void); - struct ExErrorStackContex* ExceptionStack = &ExceptionInfo->stackframe.ExErrorStackContex; - struct StackRegisterContent* context = &ExceptionInfo->stackframe; + struct ExErrorStackContex* ExceptionStack = (struct ExErrorStackContex*)&ExceptionInfo->stackframe.ExErrorStackContex; + struct StackRegisterContent* context = (struct StackRegisterContent*)&ExceptionInfo->stackframe; if (ExceptionHook != NONE) { x_err_t result = ExceptionHook(ExceptionStack); @@ -344,8 +344,8 @@ void UpdateRunningTask(void) void MemFaultExceptionPrint(struct ExceptionInfo *ExceptionInfo) { extern long ShowTask(void); - struct ExErrorStackContex* ExceptionStack = &ExceptionInfo->stackframe.ExErrorStackContex; - struct StackRegisterContent* context = &ExceptionInfo->stackframe; + struct ExErrorStackContex* ExceptionStack = (struct ExErrorStackContex*)&ExceptionInfo->stackframe.ExErrorStackContex; + struct StackRegisterContent* context = (struct StackRegisterContent*)&ExceptionInfo->stackframe; if (ExceptionHook != NONE) { x_err_t result = ExceptionHook(ExceptionStack); diff --git a/kernel/include/user_api.h b/kernel/include/user_api.h index cbda332a..48e9f837 100644 --- a/kernel/include/user_api.h +++ b/kernel/include/user_api.h @@ -160,7 +160,7 @@ struct statfs { int statfs(const char *path, struct statfs *buf); #endif -void Userprintf(const char *fmt, ...); +int Userprintf(const char *fmt, ...); #define printf Userprintf diff --git a/kernel/kernel_test/user_api.h b/kernel/kernel_test/user_api.h index eb001377..79291d1d 100644 --- a/kernel/kernel_test/user_api.h +++ b/kernel/kernel_test/user_api.h @@ -159,7 +159,7 @@ struct statfs { int statfs(const char *path, struct statfs *buf); #endif -void UserPrintf(const char *fmt, ...); +int UserPrintf(const char *fmt, ...); #else struct utask diff --git a/kernel/memory/byte_manage.c b/kernel/memory/byte_manage.c index 637daec5..6b7b8bb5 100644 --- a/kernel/memory/byte_manage.c +++ b/kernel/memory/byte_manage.c @@ -57,7 +57,7 @@ */ struct DynamicAllocNode { - uint32 size; /* the size of dynamicAllocNode */ + x_size_t size; /* the size of dynamicAllocNode */ uint32 prev_adj_size; /* the size of the previous adjacent node, (dynamic alloc node or dynamic free node */ }; @@ -480,7 +480,7 @@ static void SmallMemInit(struct ByteMemory *byte_memory) for(offset = 0; offset < item->block_total_count; offset++) { node = PTR2ALLOCNODE((char*)item->freelist + offset * (SIZEOF_32B + SIZEOF_DYNAMICALLOCNODE_MEM)); - node->size =(uint64) ((char*)item->freelist + (offset + 1) * (SIZEOF_32B + SIZEOF_DYNAMICALLOCNODE_MEM)); + node->size =(x_size_t) ((char*)item->freelist + (offset + 1) * (SIZEOF_32B + SIZEOF_DYNAMICALLOCNODE_MEM)); node->prev_adj_size = STATIC_BLOCK_MASK; } node->size = NONE; @@ -501,7 +501,7 @@ static void SmallMemInit(struct ByteMemory *byte_memory) for(offset = 0; offset < item->block_total_count; offset++) { node = PTR2ALLOCNODE((char*)item->freelist + offset * (SIZEOF_64B + SIZEOF_DYNAMICALLOCNODE_MEM)); - node->size =(uint64) ((char*)item->freelist + (offset + 1) * (SIZEOF_64B + SIZEOF_DYNAMICALLOCNODE_MEM)); + node->size =(x_size_t) ((char*)item->freelist + (offset + 1) * (SIZEOF_64B + SIZEOF_DYNAMICALLOCNODE_MEM)); node->prev_adj_size = STATIC_BLOCK_MASK; } node->size = NONE; @@ -527,10 +527,10 @@ static void SmallMemFree(void *pointer) /* get the allocNode */ node = PTR2ALLOCNODE((char*)pointer-SIZEOF_DYNAMICALLOCNODE_MEM); - StaticSegment = (struct segment*)(uint64)node->size; + StaticSegment = (struct segment*)(x_size_t)node->size; /* update the statistic information of StaticSegment */ - node->size = (uint64)StaticSegment->freelist; + node->size = (x_size_t)StaticSegment->freelist; StaticSegment->freelist = (uint8 *)node; StaticSegment->block_free_count++; diff --git a/kernel/thread/console.c b/kernel/thread/console.c index 06084f0c..f26afabf 100644 --- a/kernel/thread/console.c +++ b/kernel/thread/console.c @@ -500,9 +500,11 @@ int VsnPrintf(char *buf, int32 size, const char *fmt, va_list args) width = sizeof(void *) * 2; flags |= ZEROPAD | CAPITAL; /* Determine the machine word length */ +#ifdef ARCH_CPU_64BIT if(sizeof(long) == sizeof(long long)) pointer = LonglongToChar(buf, (unsigned long long)va_arg(args, void*), flags, precision, 16, width, 0, pointer, size); else +#endif pointer = LongToChar(buf, (unsigned long)va_arg(args, void*), flags, precision, 16, width, 0, pointer, size); if(pointer >= size) { diff --git a/tool/shell/letter-shell/file_ext/bunzip2.c b/tool/shell/letter-shell/file_ext/bunzip2.c index 091b5460..3ba5ec39 100644 --- a/tool/shell/letter-shell/file_ext/bunzip2.c +++ b/tool/shell/letter-shell/file_ext/bunzip2.c @@ -274,8 +274,8 @@ static int GetNextBlock(BunZipData_t *bd) if (ngrp >= groupCount) return RET_ERROR; hufGroup = bd->groups + ngrp; - base = hufGroup->base - 1; - limit = hufGroup->limit - 1; + base = (int *)hufGroup->base - 1; + limit = (int *)hufGroup->limit - 1; continue_this_group: