From 2c84db95d23cdf06637d9b3fbfa4d5b51e3a8492 Mon Sep 17 00:00:00 2001 From: Harshit Malpani Date: Mon, 15 Nov 2021 11:10:16 +0530 Subject: [PATCH] freertos: fix build warnings with -Wsign-conversion CFLAG Closes https://github.com/espressif/esp-idf/issues/4946 --- .../portable/riscv/include/freertos/portmacro.h | 2 +- .../portable/riscv/include/freertos/portmacro_deprecated.h | 4 ++-- .../portable/xtensa/include/freertos/portmacro.h | 4 ++-- components/hal/esp32c3/include/hal/cpu_ll.h | 4 ++-- components/hal/esp32h2/include/hal/cpu_ll.h | 4 ++-- components/hal/esp8684/include/hal/cpu_ll.h | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h index e053e8219a..b6e8843101 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h @@ -314,7 +314,7 @@ void vPortSetStackWatchpoint(void *pxStackStart); */ static inline BaseType_t IRAM_ATTR xPortGetCoreID(void) { - return (uint32_t) cpu_hal_get_core_id(); + return (BaseType_t) cpu_hal_get_core_id(); } diff --git a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro_deprecated.h b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro_deprecated.h index 597d99c333..71ddb3f746 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro_deprecated.h +++ b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro_deprecated.h @@ -18,7 +18,7 @@ * @deprecated This function is deprecated. Call portSET_INTERRUPT_MASK_FROM_ISR() instead */ static inline __attribute__((deprecated)) UBaseType_t portENTER_CRITICAL_NESTED(void) { - return portSET_INTERRUPT_MASK_FROM_ISR(); + return (UBaseType_t) portSET_INTERRUPT_MASK_FROM_ISR(); } /** @@ -30,7 +30,7 @@ static inline __attribute__((deprecated)) UBaseType_t portENTER_CRITICAL_NESTED( */ static inline void __attribute__((deprecated)) portEXIT_CRITICAL_NESTED(UBaseType_t prev_level) { - portCLEAR_INTERRUPT_MASK_FROM_ISR(prev_level); + portCLEAR_INTERRUPT_MASK_FROM_ISR((int) prev_level); } /* ---------------------- Spinlocks --------------------- */ diff --git a/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h index 934f056816..5aad351ca0 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h @@ -568,7 +568,7 @@ static inline UBaseType_t xPortSetInterruptMaskFromISR(void) static inline void vPortClearInterruptMaskFromISR(UBaseType_t prev_level) { portbenchmarkINTERRUPT_RESTORE(prev_level); - XTOS_RESTORE_JUST_INTLEVEL(prev_level); + XTOS_RESTORE_JUST_INTLEVEL((int) prev_level); } // ------------------ Critical Sections -------------------- @@ -631,7 +631,7 @@ static inline bool IRAM_ATTR xPortCanYield(void) static inline BaseType_t IRAM_ATTR xPortGetCoreID(void) { - return (uint32_t) cpu_hal_get_core_id(); + return (BaseType_t) cpu_hal_get_core_id(); } static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) diff --git a/components/hal/esp32c3/include/hal/cpu_ll.h b/components/hal/esp32c3/include/hal/cpu_ll.h index bce6757911..2edb18bf12 100644 --- a/components/hal/esp32c3/include/hal/cpu_ll.h +++ b/components/hal/esp32c3/include/hal/cpu_ll.h @@ -108,7 +108,7 @@ static inline void cpu_ll_set_watchpoint(int id, RV_WRITE_CSR(tselect,id); RV_SET_CSR(CSR_TCONTROL, TCONTROL_MPTE | TCONTROL_MTE); RV_SET_CSR(CSR_TDATA1, TDATA1_USER|TDATA1_MACHINE); - RV_SET_CSR_FIELD(CSR_TDATA1, TDATA1_MATCH, 1); + RV_SET_CSR_FIELD(CSR_TDATA1, (long unsigned int) TDATA1_MATCH, 1); // add 0 in napot encoding addr_napot = ((uint32_t) addr) | ((size >> 1) - 1); if (on_read) { @@ -126,7 +126,7 @@ static inline void cpu_ll_clear_watchpoint(int id) RV_WRITE_CSR(tselect,id); RV_CLEAR_CSR(CSR_TCONTROL,TCONTROL_MTE); RV_CLEAR_CSR(CSR_TDATA1, TDATA1_USER|TDATA1_MACHINE); - RV_CLEAR_CSR_FIELD(CSR_TDATA1,TDATA1_MATCH); + RV_CLEAR_CSR_FIELD(CSR_TDATA1, (long unsigned int) TDATA1_MATCH); RV_CLEAR_CSR(CSR_TDATA1, TDATA1_MACHINE); RV_CLEAR_CSR(CSR_TDATA1, TDATA1_LOAD|TDATA1_STORE|TDATA1_EXECUTE); return; diff --git a/components/hal/esp32h2/include/hal/cpu_ll.h b/components/hal/esp32h2/include/hal/cpu_ll.h index b3e1d88721..94bf5d8847 100644 --- a/components/hal/esp32h2/include/hal/cpu_ll.h +++ b/components/hal/esp32h2/include/hal/cpu_ll.h @@ -106,7 +106,7 @@ static inline void cpu_ll_set_watchpoint(int id, RV_WRITE_CSR(tselect,id); RV_SET_CSR(CSR_TCONTROL, TCONTROL_MPTE | TCONTROL_MTE); RV_SET_CSR(CSR_TDATA1, TDATA1_USER|TDATA1_MACHINE); - RV_SET_CSR_FIELD(CSR_TDATA1, TDATA1_MATCH, 1); + RV_SET_CSR_FIELD(CSR_TDATA1, (long unsigned int) TDATA1_MATCH, 1); // add 0 in napot encoding addr_napot = ((uint32_t) addr) | ((size >> 1) - 1); if (on_read) { @@ -124,7 +124,7 @@ static inline void cpu_ll_clear_watchpoint(int id) RV_WRITE_CSR(tselect,id); RV_CLEAR_CSR(CSR_TCONTROL,TCONTROL_MTE); RV_CLEAR_CSR(CSR_TDATA1, TDATA1_USER|TDATA1_MACHINE); - RV_CLEAR_CSR_FIELD(CSR_TDATA1,TDATA1_MATCH); + RV_CLEAR_CSR_FIELD(CSR_TDATA1, (long unsigned int) TDATA1_MATCH); RV_CLEAR_CSR(CSR_TDATA1, TDATA1_MACHINE); RV_CLEAR_CSR(CSR_TDATA1, TDATA1_LOAD|TDATA1_STORE|TDATA1_EXECUTE); return; diff --git a/components/hal/esp8684/include/hal/cpu_ll.h b/components/hal/esp8684/include/hal/cpu_ll.h index 84e08b1195..4c41fd92fa 100644 --- a/components/hal/esp8684/include/hal/cpu_ll.h +++ b/components/hal/esp8684/include/hal/cpu_ll.h @@ -108,7 +108,7 @@ static inline void cpu_ll_set_watchpoint(int id, RV_WRITE_CSR(tselect,id); RV_SET_CSR(CSR_TCONTROL, TCONTROL_MPTE | TCONTROL_MTE); RV_SET_CSR(CSR_TDATA1, TDATA1_USER|TDATA1_MACHINE); - RV_SET_CSR_FIELD(CSR_TDATA1, TDATA1_MATCH, 1); + RV_SET_CSR_FIELD(CSR_TDATA1, (long unsigned int) TDATA1_MATCH, 1); // add 0 in napot encoding addr_napot = ((uint32_t) addr) | ((size >> 1) - 1); if (on_read) { @@ -126,7 +126,7 @@ static inline void cpu_ll_clear_watchpoint(int id) RV_WRITE_CSR(tselect,id); RV_CLEAR_CSR(CSR_TCONTROL,TCONTROL_MTE); RV_CLEAR_CSR(CSR_TDATA1, TDATA1_USER|TDATA1_MACHINE); - RV_CLEAR_CSR_FIELD(CSR_TDATA1,TDATA1_MATCH); + RV_CLEAR_CSR_FIELD(CSR_TDATA1, (long unsigned int) TDATA1_MATCH); RV_CLEAR_CSR(CSR_TDATA1, TDATA1_MACHINE); RV_CLEAR_CSR(CSR_TDATA1, TDATA1_LOAD|TDATA1_STORE|TDATA1_EXECUTE); return;