Skip to content

Commit eb935c2

Browse files
committed
Merge branch 'bugfix/aws_iot_examples_stack_tune' into 'master'
examples: aws_iot: fine tune stack size for aws_iot task See merge request idf/esp-idf!1962
2 parents a9ae4e2 + 886b5df commit eb935c2

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

examples/protocols/aws_iot/subscribe_publish/main/subscribe_publish_sample.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ void aws_iot_task(void *param) {
277277
continue;
278278
}
279279

280-
ESP_LOGI(TAG, "-->sleep");
280+
ESP_LOGI(TAG, "Stack remaining for task '%s' is %d bytes", pcTaskGetTaskName(NULL), uxTaskGetStackHighWaterMark(NULL));
281281
vTaskDelay(1000 / portTICK_RATE_MS);
282282
sprintf(cPayload, "%s : %d ", "hello from ESP32 (QOS0)", i++);
283283
paramsQOS0.payloadLen = strlen(cPayload);
@@ -328,10 +328,5 @@ void app_main()
328328
ESP_ERROR_CHECK( err );
329329

330330
initialise_wifi();
331-
#ifdef CONFIG_MBEDTLS_DEBUG
332-
const size_t stack_size = 36*1024;
333-
#else
334-
const size_t stack_size = 36*1024;
335-
#endif
336-
xTaskCreatePinnedToCore(&aws_iot_task, "aws_iot_task", stack_size, NULL, 5, NULL, 1);
331+
xTaskCreatePinnedToCore(&aws_iot_task, "aws_iot_task", 9216, NULL, 5, NULL, 1);
337332
}

examples/protocols/aws_iot/thing_shadow/main/thing_shadow_sample.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,6 @@ static const char * ROOT_CA_PATH = CONFIG_EXAMPLE_ROOT_CA_PATH;
125125
#error "Invalid method for loading certs"
126126
#endif
127127

128-
/**
129-
* @brief Default MQTT HOST URL is pulled from the aws_iot_config.h which
130-
* uses menuconfig to find a default.
131-
*/
132-
char HostAddress[255] = AWS_IOT_MQTT_HOST;
133-
134-
/**
135-
* @brief Default MQTT port is pulled from the aws_iot_config.h which
136-
* uses menuconfig to find a default.
137-
*/
138-
uint32_t port = AWS_IOT_MQTT_PORT;
139-
140128
static esp_err_t event_handler(void *ctx, system_event_t *event)
141129
{
142130
switch(event->event_id) {
@@ -325,6 +313,8 @@ void aws_iot_task(void *param) {
325313
}
326314
}
327315
ESP_LOGI(TAG, "*****************************************************************************************");
316+
ESP_LOGI(TAG, "Stack remaining for task '%s' is %d bytes", pcTaskGetTaskName(NULL), uxTaskGetStackHighWaterMark(NULL));
317+
328318
vTaskDelay(1000 / portTICK_RATE_MS);
329319
}
330320

@@ -374,5 +364,5 @@ void app_main()
374364

375365
initialise_wifi();
376366
/* Temporarily pin task to core, due to FPU uncertainty */
377-
xTaskCreatePinnedToCore(&aws_iot_task, "aws_iot_task", 16384+1024, NULL, 5, NULL, 1);
367+
xTaskCreatePinnedToCore(&aws_iot_task, "aws_iot_task", 9216, NULL, 5, NULL, 1);
378368
}

0 commit comments

Comments
 (0)