Browse Source

Fixes for -Wundef

thanks Willy-JL
MX 1 year ago
parent
commit
2f2254edf6

+ 1 - 1
lib/esp-serial-flasher/examples/common/example_common.c

@@ -331,7 +331,7 @@ esp_loader_error_t flash_binary(const uint8_t *bin, size_t size, size_t address)
 
 
     printf("\nFinished programming\n");
     printf("\nFinished programming\n");
 
 
-#if MD5_ENABLED
+#if defined(MD5_ENABLED) && MD5_ENABLED
     err = esp_loader_flash_verify();
     err = esp_loader_flash_verify();
     if (err == ESP_LOADER_ERROR_UNSUPPORTED_FUNC) {
     if (err == ESP_LOADER_ERROR_UNSUPPORTED_FUNC) {
         printf("ESP8266 does not support flash verify command.");
         printf("ESP8266 does not support flash verify command.");

+ 1 - 1
lib/esp-serial-flasher/include/esp_loader.h

@@ -284,7 +284,7 @@ esp_loader_error_t esp_loader_change_transmission_rate(uint32_t transmission_rat
   *     - ESP_LOADER_ERROR_INVALID_RESPONSE Internal error
   *     - ESP_LOADER_ERROR_INVALID_RESPONSE Internal error
   *     - ESP_LOADER_ERROR_UNSUPPORTED_FUNC Unsupported on the target
   *     - ESP_LOADER_ERROR_UNSUPPORTED_FUNC Unsupported on the target
   */
   */
-#if MD5_ENABLED
+#if defined(MD5_ENABLED) && MD5_ENABLED
 esp_loader_error_t esp_loader_flash_verify(void);
 esp_loader_error_t esp_loader_flash_verify(void);
 #endif
 #endif
 /**
 /**

+ 2 - 2
lib/esp-serial-flasher/src/esp_loader.c

@@ -44,7 +44,7 @@ typedef enum {
 static const target_registers_t *s_reg = NULL;
 static const target_registers_t *s_reg = NULL;
 static target_chip_t s_target = ESP_UNKNOWN_CHIP;
 static target_chip_t s_target = ESP_UNKNOWN_CHIP;
 
 
-#if MD5_ENABLED
+#if defined(MD5_ENABLED) && MD5_ENABLED
 
 
 static const uint32_t MD5_TIMEOUT_PER_MB = 800;
 static const uint32_t MD5_TIMEOUT_PER_MB = 800;
 static struct MD5Context s_md5_context;
 static struct MD5Context s_md5_context;
@@ -372,7 +372,7 @@ esp_loader_error_t esp_loader_change_transmission_rate(uint32_t transmission_rat
     return loader_change_baudrate_cmd(transmission_rate);
     return loader_change_baudrate_cmd(transmission_rate);
 }
 }
 
 
-#if MD5_ENABLED
+#if defined(MD5_ENABLED) && MD5_ENABLED
 
 
 static void hexify(const uint8_t raw_md5[16], uint8_t hex_md5_out[32])
 static void hexify(const uint8_t raw_md5[16], uint8_t hex_md5_out[32])
 {
 {