From c53d9da22e5f85e220e7176b0e30a4ca239c52da Mon Sep 17 00:00:00 2001 From: bernard Date: Sat, 3 Dec 2022 15:39:08 +0800 Subject: [PATCH] [lwIP] fix lwip sem/mutex valid issue. --- bsp/qemu-virt64-aarch64/rtconfig.py | 2 +- components/net/lwip/port/sys_arch.c | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bsp/qemu-virt64-aarch64/rtconfig.py b/bsp/qemu-virt64-aarch64/rtconfig.py index c9e4424358..2616998a01 100644 --- a/bsp/qemu-virt64-aarch64/rtconfig.py +++ b/bsp/qemu-virt64-aarch64/rtconfig.py @@ -39,7 +39,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -g -march=armv8-a -mtune=cortex-a53' - CFLAGS = DEVICE + ' -Wall ' + CFLAGS = DEVICE + ' -Wall -fdiagnostics-color=always' AFLAGS = ' -c' + ' -x assembler-with-cpp -D__ASSEMBLY__' LFLAGS = DEVICE + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,system_vectors -T link.lds' CPATH = '' diff --git a/components/net/lwip/port/sys_arch.c b/components/net/lwip/port/sys_arch.c index cba1752b6f..709028ee25 100644 --- a/components/net/lwip/port/sys_arch.c +++ b/components/net/lwip/port/sys_arch.c @@ -208,7 +208,11 @@ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) */ int sys_sem_valid(sys_sem_t *sem) { - return (int)(*sem); + int ret = 0; + + if (*sem) ret = 1; + + return ret; } #endif @@ -283,7 +287,11 @@ void sys_mutex_free(sys_mutex_t *mutex) */ int sys_mutex_valid(sys_mutex_t *mutex) { - return (int)(*mutex); + int ret = 0; + + if (*mutex) ret = 1; + + return ret; } #endif @@ -458,7 +466,11 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg) */ int sys_mbox_valid(sys_mbox_t *mbox) { - return (int)(*mbox); + int ret = 0; + + if (*mbox) ret = 1; + + return ret; } #endif