Просмотр исходного кода

hal: mpu: fix signed overflow error

Ivan Grokhotkov 5 лет назад
Родитель
Сommit
da90775d98

+ 2 - 2
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)

+ 1 - 1
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();
 }

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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