From da90775d98ef5a8fffeec776cd93f176a0b7f783 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 1 Dec 2020 23:29:35 +0100 Subject: [PATCH] hal: mpu: fix signed overflow error --- components/hal/esp32/include/hal/mpu_ll.h | 4 ++-- components/hal/esp32c3/include/hal/mpu_ll.h | 2 +- components/hal/esp32s2/include/hal/mpu_ll.h | 2 +- components/hal/esp32s3/include/hal/mpu_ll.h | 2 +- components/soc/esp32/include/soc/soc_caps.h | 2 +- components/soc/esp32c3/include/soc/mpu_caps.h | 2 +- components/soc/esp32s2/include/soc/soc_caps.h | 2 +- components/soc/esp32s3/include/soc/mpu_caps.h | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/hal/esp32/include/hal/mpu_ll.h b/components/hal/esp32/include/hal/mpu_ll.h index c2d20ee69e..2ec955b48f 100644 --- a/components/hal/esp32/include/hal/mpu_ll.h +++ b/components/hal/esp32/include/hal/mpu_ll.h @@ -22,7 +22,7 @@ extern "C" { #endif -static inline uint32_t mpu_ll_id_to_addr(int id) +static inline uint32_t mpu_ll_id_to_addr(unsigned id) { // vpn - id // 0x00000000 = 0 @@ -33,7 +33,7 @@ static inline uint32_t mpu_ll_id_to_addr(int id) // 0xa0000000 = 5 // 0xc0000000 = 6 // 0xe0000000 = 7 - return (unsigned)id * SOC_MPU_MIN_REGION_SIZE; + return id * SOC_MPU_MIN_REGION_SIZE; } static inline void mpu_ll_set_region_rw(uint32_t addr) diff --git a/components/hal/esp32c3/include/hal/mpu_ll.h b/components/hal/esp32c3/include/hal/mpu_ll.h index cfeec1d6a6..9e07ee3e4b 100644 --- a/components/hal/esp32c3/include/hal/mpu_ll.h +++ b/components/hal/esp32c3/include/hal/mpu_ll.h @@ -22,7 +22,7 @@ extern "C" { /* This LL is currently unused for ESP32-C3 - cleanup is TODO ESP32-C3 IDF-2375 */ -static inline uint32_t mpu_ll_id_to_addr(int id) +static inline uint32_t mpu_ll_id_to_addr(unsigned id) { abort(); } diff --git a/components/hal/esp32s2/include/hal/mpu_ll.h b/components/hal/esp32s2/include/hal/mpu_ll.h index fc491e2b8f..2ec955b48f 100644 --- a/components/hal/esp32s2/include/hal/mpu_ll.h +++ b/components/hal/esp32s2/include/hal/mpu_ll.h @@ -22,7 +22,7 @@ extern "C" { #endif -static inline uint32_t mpu_ll_id_to_addr(int id) +static inline uint32_t mpu_ll_id_to_addr(unsigned id) { // vpn - id // 0x00000000 = 0 diff --git a/components/hal/esp32s3/include/hal/mpu_ll.h b/components/hal/esp32s3/include/hal/mpu_ll.h index fc491e2b8f..2ec955b48f 100644 --- a/components/hal/esp32s3/include/hal/mpu_ll.h +++ b/components/hal/esp32s3/include/hal/mpu_ll.h @@ -22,7 +22,7 @@ extern "C" { #endif -static inline uint32_t mpu_ll_id_to_addr(int id) +static inline uint32_t mpu_ll_id_to_addr(unsigned id) { // vpn - id // 0x00000000 = 0 diff --git a/components/soc/esp32/include/soc/soc_caps.h b/components/soc/esp32/include/soc/soc_caps.h index 488acd8382..2dff500760 100644 --- a/components/soc/esp32/include/soc/soc_caps.h +++ b/components/soc/esp32/include/soc/soc_caps.h @@ -165,7 +165,7 @@ /*-------------------------- MPU CAPS ----------------------------------------*/ //TODO: correct the caller and remove unsupported lines #define SOC_MPU_CONFIGURABLE_REGIONS_SUPPORTED 0 -#define SOC_MPU_MIN_REGION_SIZE 0x20000000 +#define SOC_MPU_MIN_REGION_SIZE 0x20000000U #define SOC_MPU_REGIONS_MAX_NUM 8 #define SOC_MPU_REGION_RO_SUPPORTED 0 #define SOC_MPU_REGION_WO_SUPPORTED 0 diff --git a/components/soc/esp32c3/include/soc/mpu_caps.h b/components/soc/esp32c3/include/soc/mpu_caps.h index b267547590..1d23e37507 100644 --- a/components/soc/esp32c3/include/soc/mpu_caps.h +++ b/components/soc/esp32c3/include/soc/mpu_caps.h @@ -15,7 +15,7 @@ #pragma once #define SOC_MPU_CONFIGURABLE_REGIONS_SUPPORTED 0 -#define SOC_MPU_MIN_REGION_SIZE 0x20000000 +#define SOC_MPU_MIN_REGION_SIZE 0x20000000U #define SOC_MPU_REGIONS_MAX_NUM 8 #define SOC_MPU_REGION_RO_SUPPORTED 0 #define SOC_MPU_REGION_WO_SUPPORTED 0 diff --git a/components/soc/esp32s2/include/soc/soc_caps.h b/components/soc/esp32s2/include/soc/soc_caps.h index 5d16add7a8..f5ad97eed8 100644 --- a/components/soc/esp32s2/include/soc/soc_caps.h +++ b/components/soc/esp32s2/include/soc/soc_caps.h @@ -149,7 +149,7 @@ /*-------------------------- MPU CAPS ----------------------------------------*/ //TODO: correct the caller and remove unsupported lines #define SOC_MPU_CONFIGURABLE_REGIONS_SUPPORTED 0 -#define SOC_MPU_MIN_REGION_SIZE 0x20000000 +#define SOC_MPU_MIN_REGION_SIZE 0x20000000U #define SOC_MPU_REGIONS_MAX_NUM 8 #define SOC_MPU_REGION_RO_SUPPORTED 0 #define SOC_MPU_REGION_WO_SUPPORTED 0 diff --git a/components/soc/esp32s3/include/soc/mpu_caps.h b/components/soc/esp32s3/include/soc/mpu_caps.h index b267547590..1d23e37507 100644 --- a/components/soc/esp32s3/include/soc/mpu_caps.h +++ b/components/soc/esp32s3/include/soc/mpu_caps.h @@ -15,7 +15,7 @@ #pragma once #define SOC_MPU_CONFIGURABLE_REGIONS_SUPPORTED 0 -#define SOC_MPU_MIN_REGION_SIZE 0x20000000 +#define SOC_MPU_MIN_REGION_SIZE 0x20000000U #define SOC_MPU_REGIONS_MAX_NUM 8 #define SOC_MPU_REGION_RO_SUPPORTED 0 #define SOC_MPU_REGION_WO_SUPPORTED 0