Hi.
Please delete the other topic that I created: https://forums.mbed.com/t/mbedtls-on-esp8266-rtos-sdk-multithreading-processor-reseting/7805
I 'm testing the ESP8266 RTOS SDK (which uses freeRTOS), latest version, which includes mbedTLS. I am working with Firebase database. I am able to do these things correctly using mbedTLS:
(1) connect to the host with a persistent sock and keep listening for changes inside a given resource.
(2) write data to a given resource of the same database.
Both these things are only working separately. I did one task for each purpose and I can only create only one of the tasks at the main(), if I create both tasks the processor keeps reseting.
My plan is to be able to keep a socket open to keep monitoring (1), when needed, be able to write (2), I want both thing can wok in parallel.
On config.h MBEDTLS_THREADING_C and MBEDTLS_THREADING_PTHREAD are defined.
I have made mbedtls_ssl_config conf; global, and I only call mbedtls_ssl_config_init(&conf); one time in setup of main. That is, I am using an unique conf for both tasks.
Here is my current code: esp8266_freeRTOS_firebase/https_mbedtls_firebase_v2.c at master Ā· jefersonpehls/esp8266_freeRTOS_firebase Ā· GitHub
I want to use mutiple instances of mbedTLS as HTTPS client. As I was reading on web about this, I will need to use mutexes, in which places of my code I will need to add these mutexes?
Regards.
EDIT
Based on the code above, I edited it in order the following structs be shared between the tasks, to not declare one on each task:
mbedtls_ssl_config conf;
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_x509_crt cacert;
But anyway, the code only works if I create just one of the tasks (or just monitor task or just write task). Creating both makes the processor stay resetting.
If you want you can check it here: esp8266_freeRTOS_firebase/https_mbedtls_firebase_v3.c at master Ā· jefersonpehls/esp8266_freeRTOS_firebase Ā· GitHub
Which resources of mbedTLS are making my program crash?