From c6bdee3c503a287a0967fd0e3cb6b7a1eb6d0b5e Mon Sep 17 00:00:00 2001 From: Yuqiang Wang <2053731441@qq.com> Date: Wed, 21 Feb 2024 11:45:04 +0800 Subject: [PATCH] [ci] open ci check with function declaration warning (#8546) --- bsp/allwinner/d1/board/board.c | 2 -- bsp/allwinner/d1s/board/board.c | 2 -- bsp/bouffalo_lab/bl808/d0/board/board.c | 2 -- bsp/cvitek/cv1800b/board/board.c | 2 -- bsp/k210/board/board.c | 2 -- bsp/qemu-virt64-riscv/driver/board.c | 2 -- components/lwp/lwp_arch_comm.h | 4 ++-- include/rthw.h | 8 ++++---- include/rtthread.h | 16 ++++++++++++++++ libcpu/aarch64/common/mmu.c | 7 +++++++ libcpu/aarch64/common/mmu.h | 8 +------- libcpu/arm/cortex-a/mmu.h | 2 +- libcpu/risc-v/t-head/c906/cpuport.h | 6 +++--- libcpu/risc-v/t-head/c906/mmu.h | 2 +- libcpu/risc-v/t-head/c906/riscv_mmu.c | 4 ++-- libcpu/risc-v/t-head/c906/riscv_mmu.h | 4 ++-- libcpu/risc-v/virt64/cpuport.h | 6 +++--- libcpu/risc-v/virt64/mmu.h | 2 +- libcpu/risc-v/virt64/riscv_mmu.c | 4 ++-- libcpu/risc-v/virt64/riscv_mmu.h | 4 ++-- src/SConscript | 2 +- src/cpu.c | 2 +- 22 files changed, 49 insertions(+), 44 deletions(-) diff --git a/bsp/allwinner/d1/board/board.c b/bsp/allwinner/d1/board/board.c index 416348f3cf..0035a3f752 100644 --- a/bsp/allwinner/d1/board/board.c +++ b/bsp/allwinner/d1/board/board.c @@ -67,8 +67,6 @@ static void __rt_assert_handler(const char *ex_string, const char *func, rt_size //BSP的C入口 void primary_cpu_entry(void) { - extern void entry(void); - //初始化BSS init_bss(); //关中断 diff --git a/bsp/allwinner/d1s/board/board.c b/bsp/allwinner/d1s/board/board.c index 49bed66e90..33470e5cb7 100644 --- a/bsp/allwinner/d1s/board/board.c +++ b/bsp/allwinner/d1s/board/board.c @@ -74,8 +74,6 @@ static void __rt_assert_handler(const char *ex_string, const char *func, rt_size // BSP的C入口 void primary_cpu_entry(void) { - extern void entry(void); - // 关中断 rt_hw_interrupt_disable(); rt_assert_set_hook(__rt_assert_handler); diff --git a/bsp/bouffalo_lab/bl808/d0/board/board.c b/bsp/bouffalo_lab/bl808/d0/board/board.c index 11da0d12d6..19dcfb3bc5 100644 --- a/bsp/bouffalo_lab/bl808/d0/board/board.c +++ b/bsp/bouffalo_lab/bl808/d0/board/board.c @@ -53,8 +53,6 @@ static void __rt_assert_handler(const char *ex_string, const char *func, rt_size void primary_cpu_entry(void) { - extern void entry(void); - /* disable global interrupt */ rt_hw_interrupt_disable(); rt_assert_set_hook(__rt_assert_handler); diff --git a/bsp/cvitek/cv1800b/board/board.c b/bsp/cvitek/cv1800b/board/board.c index 2bed67d381..ad1ee75b07 100755 --- a/bsp/cvitek/cv1800b/board/board.c +++ b/bsp/cvitek/cv1800b/board/board.c @@ -53,8 +53,6 @@ static void __rt_assert_handler(const char *ex_string, const char *func, rt_size void primary_cpu_entry(void) { - extern void entry(void); - /* disable global interrupt */ rt_hw_interrupt_disable(); rt_assert_set_hook(__rt_assert_handler); diff --git a/bsp/k210/board/board.c b/bsp/k210/board/board.c index 861bde3488..074f609851 100755 --- a/bsp/k210/board/board.c +++ b/bsp/k210/board/board.c @@ -34,8 +34,6 @@ void init_bss(void) void primary_cpu_entry(void) { - extern void entry(void); - /* disable global interrupt */ init_bss(); rt_hw_interrupt_disable(); diff --git a/bsp/qemu-virt64-riscv/driver/board.c b/bsp/qemu-virt64-riscv/driver/board.c index cbbe80ee03..e6edded9f1 100644 --- a/bsp/qemu-virt64-riscv/driver/board.c +++ b/bsp/qemu-virt64-riscv/driver/board.c @@ -44,8 +44,6 @@ struct mem_desc platform_mem_desc[] = { void primary_cpu_entry(void) { - extern void entry(void); - /* disable global interrupt */ rt_hw_interrupt_disable(); diff --git a/components/lwp/lwp_arch_comm.h b/components/lwp/lwp_arch_comm.h index b7cb5c2347..885cd63ca9 100644 --- a/components/lwp/lwp_arch_comm.h +++ b/components/lwp/lwp_arch_comm.h @@ -23,8 +23,8 @@ /* syscall handlers */ void arch_clone_exit(void); void arch_fork_exit(void); -void arch_syscall_exit(); -void arch_ret_to_user(); +void arch_syscall_exit(void); +void arch_ret_to_user(void); /* ELF relocation */ #ifdef ARCH_MM_MMU diff --git a/include/rthw.h b/include/rthw.h index ba3bb14cbd..1c663ced67 100644 --- a/include/rthw.h +++ b/include/rthw.h @@ -134,7 +134,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, const char *name); #ifdef RT_USING_SMP -rt_base_t rt_hw_local_irq_disable(); +rt_base_t rt_hw_local_irq_disable(void); void rt_hw_local_irq_enable(rt_base_t level); rt_base_t rt_cpus_lock(void); @@ -235,9 +235,9 @@ void rt_hw_secondary_cpu_idle_exec(void); #endif #ifndef RT_USING_CACHE -#define rt_hw_isb() -#define rt_hw_dmb() -#define rt_hw_dsb() +#define rt_hw_isb(void) +#define rt_hw_dmb(void) +#define rt_hw_dsb(void) #endif #ifdef __cplusplus diff --git a/include/rtthread.h b/include/rtthread.h index 883a96fb5b..07fcb64e08 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -42,6 +42,10 @@ extern "C" { #endif +#ifdef __GNUC__ +int entry(void); +#endif + /** * @addtogroup KernelObject * @{ @@ -207,6 +211,7 @@ void rt_system_scheduler_init(void); void rt_system_scheduler_start(void); void rt_schedule(void); +void rt_scheduler_do_irq_switch(void *context); void rt_schedule_insert_thread(struct rt_thread *thread); void rt_schedule_remove_thread(struct rt_thread *thread); @@ -334,6 +339,15 @@ void rt_memheap_info(struct rt_memheap *heap, rt_size_t *max_used); #endif /* RT_USING_MEMHEAP */ +#ifdef RT_USING_MEMHEAP_AS_HEAP +/** + * memory heap as heap + */ +void *_memheap_alloc(struct rt_memheap *heap, rt_size_t size); +void _memheap_free(void *rmem); +void *_memheap_realloc(struct rt_memheap *heap, void *rmem, rt_size_t newsize); +#endif + #ifdef RT_USING_SLAB /** * slab object interface @@ -664,6 +678,8 @@ void rt_cpus_unlock(rt_base_t level); struct rt_cpu *rt_cpu_self(void); struct rt_cpu *rt_cpu_index(int index); +void rt_cpus_lock_status_restore(struct rt_thread *thread); + #endif /* RT_USING_SMP */ /* diff --git a/libcpu/aarch64/common/mmu.c b/libcpu/aarch64/common/mmu.c index 68270df4ef..d870a73b0f 100644 --- a/libcpu/aarch64/common/mmu.c +++ b/libcpu/aarch64/common/mmu.c @@ -602,6 +602,13 @@ static int _map_single_page_2M(unsigned long *lv0_tbl, unsigned long va, return 0; } +void *rt_hw_mmu_tbl_get() +{ + uintptr_t tbl; + __asm__ volatile("MRS %0, TTBR0_EL1" : "=r"(tbl)); + return rt_kmem_p2v((void *)(tbl & ((1ul << 48) - 2))); +} + void *rt_ioremap_early(void *paddr, size_t size) { volatile size_t count; diff --git a/libcpu/aarch64/common/mmu.h b/libcpu/aarch64/common/mmu.h index a441a526e3..f780c5eb97 100644 --- a/libcpu/aarch64/common/mmu.h +++ b/libcpu/aarch64/common/mmu.h @@ -109,13 +109,7 @@ void rt_hw_mmu_kernel_map_init(struct rt_aspace *aspace, rt_size_t vaddr_start, rt_size_t size); void *rt_hw_mmu_pgtbl_create(void); void rt_hw_mmu_pgtbl_delete(void *pgtbl); - -rt_inline void *rt_hw_mmu_tbl_get() -{ - uintptr_t tbl; - __asm__ volatile("MRS %0, TTBR0_EL1" : "=r"(tbl)); - return rt_kmem_p2v((void *)(tbl & ((1ul << 48) - 2))); -} +void *rt_hw_mmu_tbl_get(void); static inline void *rt_hw_mmu_kernel_v2p(void *v_addr) { diff --git a/libcpu/arm/cortex-a/mmu.h b/libcpu/arm/cortex-a/mmu.h index 8712a0f489..a79e3a6e9b 100644 --- a/libcpu/arm/cortex-a/mmu.h +++ b/libcpu/arm/cortex-a/mmu.h @@ -122,7 +122,7 @@ void rt_hw_mmu_switch(void *tbl); void *rt_hw_mmu_v2p(struct rt_aspace *aspace, void *vaddr); void rt_hw_mmu_kernel_map_init(struct rt_aspace *aspace, size_t vaddr_start, size_t size); -void *rt_hw_mmu_tbl_get(); +void *rt_hw_mmu_tbl_get(void); int rt_hw_mmu_control(struct rt_aspace *aspace, void *vaddr, size_t size, enum rt_mmu_cntl cmd); diff --git a/libcpu/risc-v/t-head/c906/cpuport.h b/libcpu/risc-v/t-head/c906/cpuport.h index 68780bfe6d..349cba3089 100644 --- a/libcpu/risc-v/t-head/c906/cpuport.h +++ b/libcpu/risc-v/t-head/c906/cpuport.h @@ -39,17 +39,17 @@ #ifndef __ASSEMBLY__ #include -rt_inline void rt_hw_dsb() +rt_inline void rt_hw_dsb(void) { __asm__ volatile("fence":::"memory"); } -rt_inline void rt_hw_dmb() +rt_inline void rt_hw_dmb(void) { __asm__ volatile("fence":::"memory"); } -rt_inline void rt_hw_isb() +rt_inline void rt_hw_isb(void) { __asm__ volatile(OPC_FENCE_I:::"memory"); } diff --git a/libcpu/risc-v/t-head/c906/mmu.h b/libcpu/risc-v/t-head/c906/mmu.h index 58229464cd..dee72c8624 100644 --- a/libcpu/risc-v/t-head/c906/mmu.h +++ b/libcpu/risc-v/t-head/c906/mmu.h @@ -56,7 +56,7 @@ struct mem_desc #define MMU_MAP_ERROR_NOPAGE -3 #define MMU_MAP_ERROR_CONFLICT -4 -void *rt_hw_mmu_tbl_get(); +void *rt_hw_mmu_tbl_get(void); int rt_hw_mmu_map_init(rt_aspace_t aspace, void *v_address, rt_size_t size, rt_size_t *vtable, rt_size_t pv_off); void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr); diff --git a/libcpu/risc-v/t-head/c906/riscv_mmu.c b/libcpu/risc-v/t-head/c906/riscv_mmu.c index e648c52269..0139364774 100644 --- a/libcpu/risc-v/t-head/c906/riscv_mmu.c +++ b/libcpu/risc-v/t-head/c906/riscv_mmu.c @@ -18,12 +18,12 @@ #include "riscv_mmu.h" -void mmu_enable_user_page_access() +void mmu_enable_user_page_access(void) { set_csr(sstatus,SSTATUS_SUM); } -void mmu_disable_user_page_access() +void mmu_disable_user_page_access(void) { clear_csr(sstatus,SSTATUS_SUM); } diff --git a/libcpu/risc-v/t-head/c906/riscv_mmu.h b/libcpu/risc-v/t-head/c906/riscv_mmu.h index 406ed9a562..983a86956c 100644 --- a/libcpu/risc-v/t-head/c906/riscv_mmu.h +++ b/libcpu/risc-v/t-head/c906/riscv_mmu.h @@ -108,8 +108,8 @@ #define ARCH_MAP_FAILED ((void *)0x8000000000000000) void mmu_set_pagetable(rt_ubase_t addr); -void mmu_enable_user_page_access(); -void mmu_disable_user_page_access(); +void mmu_enable_user_page_access(void); +void mmu_disable_user_page_access(void); #define RT_HW_MMU_PROT_READ 1 #define RT_HW_MMU_PROT_WRITE 2 diff --git a/libcpu/risc-v/virt64/cpuport.h b/libcpu/risc-v/virt64/cpuport.h index 35a47d987c..92a3af32d7 100644 --- a/libcpu/risc-v/virt64/cpuport.h +++ b/libcpu/risc-v/virt64/cpuport.h @@ -61,17 +61,17 @@ typedef union { #ifndef __ASSEMBLY__ #include -rt_inline void rt_hw_dsb() +rt_inline void rt_hw_dsb(void) { asm volatile("fence":::"memory"); } -rt_inline void rt_hw_dmb() +rt_inline void rt_hw_dmb(void) { asm volatile("fence":::"memory"); } -rt_inline void rt_hw_isb() +rt_inline void rt_hw_isb(void) { asm volatile(".long 0x0000100F":::"memory"); } diff --git a/libcpu/risc-v/virt64/mmu.h b/libcpu/risc-v/virt64/mmu.h index 58229464cd..dee72c8624 100644 --- a/libcpu/risc-v/virt64/mmu.h +++ b/libcpu/risc-v/virt64/mmu.h @@ -56,7 +56,7 @@ struct mem_desc #define MMU_MAP_ERROR_NOPAGE -3 #define MMU_MAP_ERROR_CONFLICT -4 -void *rt_hw_mmu_tbl_get(); +void *rt_hw_mmu_tbl_get(void); int rt_hw_mmu_map_init(rt_aspace_t aspace, void *v_address, rt_size_t size, rt_size_t *vtable, rt_size_t pv_off); void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr); diff --git a/libcpu/risc-v/virt64/riscv_mmu.c b/libcpu/risc-v/virt64/riscv_mmu.c index 7c4f886345..0438641ad7 100644 --- a/libcpu/risc-v/virt64/riscv_mmu.c +++ b/libcpu/risc-v/virt64/riscv_mmu.c @@ -18,12 +18,12 @@ #include "riscv_mmu.h" -void mmu_enable_user_page_access() +void mmu_enable_user_page_access(void) { set_csr(sstatus, SSTATUS_SUM); } -void mmu_disable_user_page_access() +void mmu_disable_user_page_access(void) { clear_csr(sstatus, SSTATUS_SUM); } diff --git a/libcpu/risc-v/virt64/riscv_mmu.h b/libcpu/risc-v/virt64/riscv_mmu.h index 2d32ec0e48..3c998beadf 100644 --- a/libcpu/risc-v/virt64/riscv_mmu.h +++ b/libcpu/risc-v/virt64/riscv_mmu.h @@ -91,8 +91,8 @@ #define ARCH_MAP_FAILED ((void *)0x8000000000000000) void mmu_set_pagetable(rt_ubase_t addr); -void mmu_enable_user_page_access(); -void mmu_disable_user_page_access(); +void mmu_enable_user_page_access(void); +void mmu_disable_user_page_access(void); #define RT_HW_MMU_PROT_READ 1 #define RT_HW_MMU_PROT_WRITE 2 diff --git a/src/SConscript b/src/SConscript index 5ab18ef52a..3f3ef4455d 100644 --- a/src/SConscript +++ b/src/SConscript @@ -38,7 +38,7 @@ if rtconfig.PLATFORM in GetGCCLikePLATFORM(): LOCAL_CFLAGS += ' -Warray-bounds -Wuninitialized' # memory access warning LOCAL_CFLAGS += ' -Wreturn-type -Wcomment -Wswitch' # code style warning LOCAL_CFLAGS += ' -Wparentheses -Wlogical-op ' # operation warning - # LOCAL_CFLAGS += ' -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes' # function declaration warning + LOCAL_CFLAGS += ' -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes' # function declaration warning if 'mips' not in rtconfig.PREFIX: # mips toolchain does not support LOCAL_CFLAGS += ' -Wimplicit-fallthrough' # implicit fallthrough warning LOCAL_CFLAGS += ' -Wduplicated-cond -Wduplicated-branches' # duplicated condition warning diff --git a/src/cpu.c b/src/cpu.c index 686b67a4ea..bb058d6d67 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -94,7 +94,7 @@ RTM_EXPORT(rt_spin_unlock) */ rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock) { - unsigned long level; + rt_base_t level; level = rt_hw_local_irq_disable(); rt_enter_critical();