]> granicus.if.org Git - esp-idf/commitdiff
examples: aws_iot: fine tune stack size for aws_iot task
authorMahavir Jain <mahavir@espressif.com>
Tue, 20 Feb 2018 11:34:07 +0000 (17:04 +0530)
committerMahavir Jain <mahavir@espressif.com>
Tue, 20 Feb 2018 11:34:07 +0000 (17:04 +0530)
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
examples/protocols/aws_iot/subscribe_publish/main/subscribe_publish_sample.c
examples/protocols/aws_iot/thing_shadow/main/thing_shadow_sample.c

index 2163c38055f586619eff1320e14b93685903009b..398fb3c188c902ff444a0f3b8bbf441af634007a 100644 (file)
@@ -277,7 +277,7 @@ void aws_iot_task(void *param) {
             continue;
         }
 
-        ESP_LOGI(TAG, "-->sleep");
+        ESP_LOGI(TAG, "Stack remaining for task '%s' is %d bytes", pcTaskGetTaskName(NULL), uxTaskGetStackHighWaterMark(NULL));
         vTaskDelay(1000 / portTICK_RATE_MS);
         sprintf(cPayload, "%s : %d ", "hello from ESP32 (QOS0)", i++);
         paramsQOS0.payloadLen = strlen(cPayload);
@@ -328,10 +328,5 @@ void app_main()
     ESP_ERROR_CHECK( err );
 
     initialise_wifi();
-#ifdef CONFIG_MBEDTLS_DEBUG
-    const size_t stack_size = 36*1024;
-#else
-    const size_t stack_size = 36*1024;
-#endif
-    xTaskCreatePinnedToCore(&aws_iot_task, "aws_iot_task", stack_size, NULL, 5, NULL, 1);
+    xTaskCreatePinnedToCore(&aws_iot_task, "aws_iot_task", 9216, NULL, 5, NULL, 1);
 }
index 13ba14e5d04d227c6fefe09f9d5dc430897c42f6..36feb14e14369c00530a907bc18c621accd9d71e 100644 (file)
@@ -125,18 +125,6 @@ static const char * ROOT_CA_PATH = CONFIG_EXAMPLE_ROOT_CA_PATH;
 #error "Invalid method for loading certs"
 #endif
 
-/**
- * @brief Default MQTT HOST URL is pulled from the aws_iot_config.h which
- * uses menuconfig to find a default.
- */
-char HostAddress[255] = AWS_IOT_MQTT_HOST;
-
-/**
- * @brief Default MQTT port is pulled from the aws_iot_config.h which
- * uses menuconfig to find a default.
- */
-uint32_t port = AWS_IOT_MQTT_PORT;
-
 static esp_err_t event_handler(void *ctx, system_event_t *event)
 {
     switch(event->event_id) {
@@ -325,6 +313,8 @@ void aws_iot_task(void *param) {
             }
         }
         ESP_LOGI(TAG, "*****************************************************************************************");
+        ESP_LOGI(TAG, "Stack remaining for task '%s' is %d bytes", pcTaskGetTaskName(NULL), uxTaskGetStackHighWaterMark(NULL));
+
         vTaskDelay(1000 / portTICK_RATE_MS);
     }
 
@@ -374,5 +364,5 @@ void app_main()
 
     initialise_wifi();
     /* Temporarily pin task to core, due to FPU uncertainty */
-    xTaskCreatePinnedToCore(&aws_iot_task, "aws_iot_task", 16384+1024, NULL, 5, NULL, 1);
+    xTaskCreatePinnedToCore(&aws_iot_task, "aws_iot_task", 9216, NULL, 5, NULL, 1);
 }