Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mbedtls using external memory failing #4770

Closed
shaun-mzj opened this issue Feb 4, 2021 · 31 comments · Fixed by #4850
Closed

Mbedtls using external memory failing #4770

shaun-mzj opened this issue Feb 4, 2021 · 31 comments · Fixed by #4850

Comments

@shaun-mzj
Copy link

Hardware:

Board: esp32
Core Installation version: 1.0.5-rc6
IDE name: Arduino IDE
Flash Frequency: 40Mhz
PSRAM enabled: yes
Upload Speed: 921600
Computer OS: Mac OSX

Description:

I've built the latest release candidate of the code manually and have enabled the following flag: CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC which causes the following error when accessing a web server:

[E][ssl_client.cpp:36] _handle_error(): [start_ssl_client():210]: (-30592) SSL - A fatal alert message was received from our peer
[E][WiFiClientSecure.cpp:132] connect(): start_ssl_client: -30592

However if I switch mbedtls to use internal memory it can connect fine. Is there something else which needs to be done for the mbedtls library to use external memory?

@shaun-mzj
Copy link
Author

I've got a simple example which tries to load an ini file from a server via HTTPS which works if using internal memory but fails when switched to use external. The sdkconfig we used to build with is also below as well

This used to work until the lets encrypt cert was updated and at the same time it was switched from x3 to r3, maybe this causes the issue?

#include <WiFi.h>
#include <HTTPClient.h>
#include <HTTPUpdate.h>

const char* ssid = "ssid";
const char* password = "pass";

const char* rootCACertificate = \
                                "-----BEGIN CERTIFICATE-----\n" \
                                "MIIFjTCCA3WgAwIBAgIRANOxciY0IzLc9AUoUSrsnGowDQYJKoZIhvcNAQELBQAw\n" \
                                "TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh\n" \
                                "cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTYxMDA2MTU0MzU1\n" \
                                "WhcNMjExMDA2MTU0MzU1WjBKMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg\n" \
                                "RW5jcnlwdDEjMCEGA1UEAxMaTGV0J3MgRW5jcnlwdCBBdXRob3JpdHkgWDMwggEi\n" \
                                "MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCc0wzwWuUuR7dyXTeDs2hjMOrX\n" \
                                "NSYZJeG9vjXxcJIvt7hLQQWrqZ41CFjssSrEaIcLo+N15Obzp2JxunmBYB/XkZqf\n" \
                                "89B4Z3HIaQ6Vkc/+5pnpYDxIzH7KTXcSJJ1HG1rrueweNwAcnKx7pwXqzkrrvUHl\n" \
                                "Npi5y/1tPJZo3yMqQpAMhnRnyH+lmrhSYRQTP2XpgofL2/oOVvaGifOFP5eGr7Dc\n" \
                                "Gu9rDZUWfcQroGWymQQ2dYBrrErzG5BJeC+ilk8qICUpBMZ0wNAxzY8xOJUWuqgz\n" \
                                "uEPxsR/DMH+ieTETPS02+OP88jNquTkxxa/EjQ0dZBYzqvqEKbbUC8DYfcOTAgMB\n" \
                                "AAGjggFnMIIBYzAOBgNVHQ8BAf8EBAMCAYYwEgYDVR0TAQH/BAgwBgEB/wIBADBU\n" \
                                "BgNVHSAETTBLMAgGBmeBDAECATA/BgsrBgEEAYLfEwEBATAwMC4GCCsGAQUFBwIB\n" \
                                "FiJodHRwOi8vY3BzLnJvb3QteDEubGV0c2VuY3J5cHQub3JnMB0GA1UdDgQWBBSo\n" \
                                "SmpjBH3duubRObemRWXv86jsoTAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3Js\n" \
                                "LnJvb3QteDEubGV0c2VuY3J5cHQub3JnMHIGCCsGAQUFBwEBBGYwZDAwBggrBgEF\n" \
                                "BQcwAYYkaHR0cDovL29jc3Aucm9vdC14MS5sZXRzZW5jcnlwdC5vcmcvMDAGCCsG\n" \
                                "AQUFBzAChiRodHRwOi8vY2VydC5yb290LXgxLmxldHNlbmNyeXB0Lm9yZy8wHwYD\n" \
                                "VR0jBBgwFoAUebRZ5nu25eQBc4AIiMgaWPbpm24wDQYJKoZIhvcNAQELBQADggIB\n" \
                                "ABnPdSA0LTqmRf/Q1eaM2jLonG4bQdEnqOJQ8nCqxOeTRrToEKtwT++36gTSlBGx\n" \
                                "A/5dut82jJQ2jxN8RI8L9QFXrWi4xXnA2EqA10yjHiR6H9cj6MFiOnb5In1eWsRM\n" \
                                "UM2v3e9tNsCAgBukPHAg1lQh07rvFKm/Bz9BCjaxorALINUfZ9DD64j2igLIxle2\n" \
                                "DPxW8dI/F2loHMjXZjqG8RkqZUdoxtID5+90FgsGIfkMpqgRS05f4zPbCEHqCXl1\n" \
                                "eO5HyELTgcVlLXXQDgAWnRzut1hFJeczY1tjQQno6f6s+nMydLN26WuU4s3UYvOu\n" \
                                "OsUxRlJu7TSRHqDC3lSE5XggVkzdaPkuKGQbGpny+01/47hfXXNB7HntWNZ6N2Vw\n" \
                                "p7G6OfY+YQrZwIaQmhrIqJZuigsrbe3W+gdn5ykE9+Ky0VgVUsfxo52mwFYs1JKY\n" \
                                "2PGDuWx8M6DlS6qQkvHaRUo0FMd8TsSlbF0/v965qGFKhSDeQoMpYnwcmQilRh/0\n" \
                                "ayLThlHLN81gSkJjVrPI0Y8xCVPB4twb1PFUd2fPM3sA1tJ83sZ5v8vgFv2yofKR\n" \
                                "PB0t6JzUA81mSqM3kxl5e+IZwhYAyO0OTg3/fs8HqGTNKd9BqoUwSRBzp06JMg5b\n" \
                                "rUCGwbCUDI0mxadJ3Bz4WxR6fyNpBK2yAinWEsikxqEt\n" \
                                "-----END CERTIFICATE-----\n"\
                                "-----BEGIN CERTIFICATE-----\n"\
                                "MIICxjCCAk2gAwIBAgIRALO93/inhFu86QOgQTWzSkUwCgYIKoZIzj0EAwMwTzEL\n"\
                                "MAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNo\n"\
                                "IEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDIwHhcNMjAwOTA0MDAwMDAwWhcN\n"\
                                "MjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3MgRW5j\n"\
                                "cnlwdDELMAkGA1UEAxMCRTEwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQkXC2iKv0c\n"\
                                "S6Zdl3MnMayyoGli72XoprDwrEuf/xwLcA/TmC9N/A8AmzfwdAVXMpcuBe8qQyWj\n"\
                                "+240JxP2T35p0wKZXuskR5LBJJvmsSGPwSSB/GjMH2m6WPUZIvd0xhajggEIMIIB\n"\
                                "BDAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMB\n"\
                                "MBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFFrz7Sv8NsI3eblSMOpUb89V\n"\
                                "yy6sMB8GA1UdIwQYMBaAFHxClq7eS0g7+pL4nozPbYupcjeVMDIGCCsGAQUFBwEB\n"\
                                "BCYwJDAiBggrBgEFBQcwAoYWaHR0cDovL3gyLmkubGVuY3Iub3JnLzAnBgNVHR8E\n"\
                                "IDAeMBygGqAYhhZodHRwOi8veDIuYy5sZW5jci5vcmcvMCIGA1UdIAQbMBkwCAYG\n"\
                                "Z4EMAQIBMA0GCysGAQQBgt8TAQEBMAoGCCqGSM49BAMDA2cAMGQCMHt01VITjWH+\n"\
                                "Dbo/AwCd89eYhNlXLr3pD5xcSAQh8suzYHKOl9YST8pE9kLJ03uGqQIwWrGxtO3q\n"\
                                "YJkgsTgDyj2gJrjubi1K9sZmHzOa25JK1fUpE8ZwYii6I4zPPS/Lgul/\n"\
                                "-----END CERTIFICATE-----\n"\
                                "-----BEGIN CERTIFICATE-----\n"\
                                "MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3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+ILlaS/V9lZLubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=\n"\
                                "-----END CERTIFICATE-----\n"\
                                "-----BEGIN CERTIFICATE-----\n"\
                                "MIIFKjCCBBKgAwIBAgISBBe7/VBighjcsshbqXuCmn3NMA0GCSqGSIb3DQEBCwUAMDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQDEwJSMzAeFw0yMTAxMTgxMDU3MzJaFw0yMTA0MTgxMDU3MzJaMBUxEzARBgNVBAMTCndpcGhvbmUuaW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDYx7lCvY5y9Km+3AlmA0Pb+jrja4NXFNWR3D2r6iMqgAutqGm9LnCl9I+295HcPTH1SWpIuXfvgdy24WhNWXU7q59Rnp6VuopvqFdfgCgMvhk10pB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XOsR0Kj5ST6xjvZld540fJRnmIu2QiixL9bubd4KrT8IVFI6ksFs9AOOsfNksXIXYgEvR71TTKx4IezsLcKqo1SLkmtalebu/fWyLrv/dShr4IKRB+xHUywdayj8IkEpjRHjOiZH/f47y//ftPRKVd3xjnUs9PBzWeZw7+eZs/NlEJsiAWSltNNKiVof8CAci+rSaifbNHOd8qi4UVSnbAlfoyM/RMUI85XKspwnKvXqHPp19192nwpe8kIWQ28aA16JAmq0o8/eohK4/S4WewQHfdSn0A3zJdFOKhWX11skbuYpV1uxm4JGXT6mPeXdOgu9WTqgkEHCe\n"\
                                "-----END CERTIFICATE-----\n"\
                                "-----BEGIN CERTIFICATE-----\n"\
                                "MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAwTzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAwWhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3MgRW5jcnlwdDELMAkGA1UEAxMCUjMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7AhUozPaglNMPEuyNVZLD+ILxmaZ6QoinXSaqtSu5xUyxr45r+XXIo9cPR5QUVTVXjJ6oojkZ9YI8QqlObvU7wy7bjcCwXPNZOOftz2nwWgsbvsCUJCWH+jdxsxPnHKzhm+/b5DtFUkWWqcFTzjTIUu61ru2P3mBw4qVUq7ZtDpelQDRrK9O8ZutmNHz6a4uPVymZ+DAXXbpyb/uBxa3Shlg9F8fnCbvxK/eG3MHacV3URuPMrSXBiLxgZ3Vms/EY96Jc5lP/Ooi2R6X/ExjqmAl3P51T+c8B5fWmcBcUr2Ok/5mzk53cU6cG/kiFHaFpriV1uxPMUgP17VGhi9sVAgMBAAGjggEIMIIBBDAO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IFICATE-----\n";

void setup() {
  // put your setup code here, to run once:
  Serial.begin(500000);
  log_i("Connecting to Wifi");
  WiFi.begin(ssid, password);
}

void loop() {
  // put your main code here, to run repeatedly:
  /*log_i("Free memory: %d %d", ESP.getFreeHeap(), heap_caps_get_free_size(MALLOC_CAP_32BIT));
  for (int i = 0; i < 20; ++i) {
    uint8_t *buffer = (uint8_t*)malloc(10*1024);
    if (buffer != NULL) {
      memset(buffer, 0x00, 10*1024);
    } 
    else {
      log_d("Couldn't create buffer: %d", i);
    }
  }

  for (int i = 0; i < 50; ++i) {
    uint8_t *buffer = (uint8_t*)heap_caps_malloc(10*1024, MALLOC_CAP_32BIT | MALLOC_CAP_SPIRAM);

    if (buffer != NULL) {
      memset(buffer, 0x00, 10*1024);
    }
    else {
      log_d("Couldn't allocate caps: %d", i);
    }
  }*/

  log_i("Free memory: %d %d", ESP.getFreeHeap(), heap_caps_get_free_size(MALLOC_CAP_32BIT));

  bool done_test = false;
  
  if (!WiFi.isConnected()) {
    log_i("WiFi disconnected. retrying WiFi connection...");
    log_i("Free memory: %d %d", ESP.getFreeHeap(), heap_caps_get_free_size(MALLOC_CAP_32BIT));
    int wait = 0;
    while (1) {
      sleep(1);
      wait++;
      if (WiFi.isConnected()) {
        log_i("Connected!");
        break;
      }
      if (wait > 10) {
        log_i("retrying WiFi connection...");
        WiFi.disconnect();
        WiFi.begin(ssid, password);
        wait = 0;
      }
    }
  }
  if (WiFi.isConnected() && !done_test) {
    log_i("running test...");
    WiFiClientSecure client;
    client.setCACert(rootCACertificate);
    log_i("cert set...");

    if (!client.connect("wiphone.io", 443)) {
      log_i("Unable to connect to server");
    } else {
      log_i("After connected to server");

/*
      client.print((std::string("GET ") + "/static/releases/firmware/WiPhone-phone.ini" + " HTTP/1.1\r\n" +
                    "Host: " + "wiphone.io" + "\r\n" +
                    "Connection: close\r\n\r\n").c_str());
      unsigned long timeout = millis();
      while (client.available() == 0) {
        if (millis() - timeout > 15000) {
          log_i("Client Timeout !");
          client.stop();
          break;
        }
      }

      while (client.available()) {
        String l = client.readStringUntil('\r');
        log_i("Read: %s", l.c_str());
      }
      */

      done_test = true;
    }
  }
  sleep(1);
}```

Automatically generated file; DO NOT EDIT.

Espressif IoT Development Framework Configuration

CONFIG_IDF_TARGET="esp32"
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000

SDK tool configuration

CONFIG_TOOLPREFIX="xtensa-esp32-elf-"
CONFIG_PYTHON="python"
CONFIG_MAKE_WARN_UNDEFINED_VARIABLES=y

Application manager

CONFIG_APP_COMPILE_TIME_DATE=y
CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=
CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=
CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16

Arduino Configuration

CONFIG_ENABLE_ARDUINO_DEPENDS=y
CONFIG_AUTOSTART_ARDUINO=y
CONFIG_ARDUINO_RUN_CORE0=
CONFIG_ARDUINO_RUN_CORE1=y
CONFIG_ARDUINO_RUN_NO_AFFINITY=
CONFIG_ARDUINO_RUNNING_CORE=1
CONFIG_ARDUINO_LOOP_STACK_SIZE=8192
CONFIG_ARDUINO_EVENT_RUN_CORE0=
CONFIG_ARDUINO_EVENT_RUN_CORE1=y
CONFIG_ARDUINO_EVENT_RUN_NO_AFFINITY=
CONFIG_ARDUINO_EVENT_RUNNING_CORE=1
CONFIG_ARDUINO_UDP_RUN_CORE0=
CONFIG_ARDUINO_UDP_RUN_CORE1=y
CONFIG_ARDUINO_UDP_RUN_NO_AFFINITY=
CONFIG_ARDUINO_UDP_TASK_PRIORITY=3
CONFIG_ARDUINO_UDP_RUNNING_CORE=1
CONFIG_DISABLE_HAL_LOCKS=

Debug Log Configuration

CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR=
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_WARN=
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO=y
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_DEBUG=
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_VERBOSE=
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL=3
CONFIG_ARDUHAL_LOG_COLORS=
CONFIG_ARDUHAL_ESP_LOG=
CONFIG_ARDUHAL_PARTITION_SCHEME_DEFAULT=y
CONFIG_ARDUHAL_PARTITION_SCHEME_MINIMAL=
CONFIG_ARDUHAL_PARTITION_SCHEME_NO_OTA=
CONFIG_ARDUHAL_PARTITION_SCHEME_HUGE_APP=
CONFIG_ARDUHAL_PARTITION_SCHEME_MIN_SPIFFS=
CONFIG_ARDUHAL_PARTITION_SCHEME="default"
CONFIG_AUTOCONNECT_WIFI=
CONFIG_ARDUINO_SELECTIVE_COMPILATION=

Bootloader config

CONFIG_LOG_BOOTLOADER_LEVEL_NONE=
CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=
CONFIG_LOG_BOOTLOADER_LEVEL_WARN=
CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y
CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG=
CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE=
CONFIG_LOG_BOOTLOADER_LEVEL=3
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V=
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y
CONFIG_BOOTLOADER_FACTORY_RESET=
CONFIG_BOOTLOADER_APP_TEST=
CONFIG_BOOTLOADER_WDT_ENABLE=y
CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE=
CONFIG_BOOTLOADER_WDT_TIME_MS=9000
CONFIG_APP_ROLLBACK_ENABLE=y
CONFIG_APP_ANTI_ROLLBACK=

Security features

CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT=
CONFIG_SECURE_BOOT_ENABLED=
CONFIG_FLASH_ENCRYPTION_ENABLED=

Serial flasher config

CONFIG_ESPTOOLPY_PORT="/dev/cu.usbserial-DO00EAB0"
CONFIG_ESPTOOLPY_BAUD_115200B=
CONFIG_ESPTOOLPY_BAUD_230400B=
CONFIG_ESPTOOLPY_BAUD_921600B=y
CONFIG_ESPTOOLPY_BAUD_2MB=
CONFIG_ESPTOOLPY_BAUD_OTHER=
CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200
CONFIG_ESPTOOLPY_BAUD=921600
CONFIG_ESPTOOLPY_COMPRESSED=y
CONFIG_FLASHMODE_QIO=
CONFIG_FLASHMODE_QOUT=
CONFIG_FLASHMODE_DIO=
CONFIG_FLASHMODE_DOUT=y
CONFIG_ESPTOOLPY_FLASHMODE="dout"
CONFIG_ESPTOOLPY_FLASHFREQ_80M=
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
CONFIG_ESPTOOLPY_FLASHFREQ_26M=
CONFIG_ESPTOOLPY_FLASHFREQ_20M=
CONFIG_ESPTOOLPY_FLASHFREQ="40m"
CONFIG_ESPTOOLPY_FLASHSIZE_1MB=
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
CONFIG_ESPTOOLPY_BEFORE_RESET=y
CONFIG_ESPTOOLPY_BEFORE_NORESET=
CONFIG_ESPTOOLPY_BEFORE="default_reset"
CONFIG_ESPTOOLPY_AFTER_RESET=y
CONFIG_ESPTOOLPY_AFTER_NORESET=
CONFIG_ESPTOOLPY_AFTER="hard_reset"
CONFIG_MONITOR_BAUD_9600B=
CONFIG_MONITOR_BAUD_57600B=
CONFIG_MONITOR_BAUD_115200B=y
CONFIG_MONITOR_BAUD_230400B=
CONFIG_MONITOR_BAUD_921600B=
CONFIG_MONITOR_BAUD_2MB=
CONFIG_MONITOR_BAUD_OTHER=
CONFIG_MONITOR_BAUD_OTHER_VAL=115200
CONFIG_MONITOR_BAUD=115200

Partition Table

CONFIG_PARTITION_TABLE_SINGLE_APP=y
CONFIG_PARTITION_TABLE_TWO_OTA=
CONFIG_PARTITION_TABLE_CUSTOM=
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y

Compiler options

CONFIG_OPTIMIZATION_LEVEL_DEBUG=y
CONFIG_OPTIMIZATION_LEVEL_RELEASE=
CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y
CONFIG_OPTIMIZATION_ASSERTIONS_SILENT=
CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED=
CONFIG_CXX_EXCEPTIONS=y
CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE=0
CONFIG_STACK_CHECK_NONE=
CONFIG_STACK_CHECK_NORM=y
CONFIG_STACK_CHECK_STRONG=
CONFIG_STACK_CHECK_ALL=
CONFIG_STACK_CHECK=y
CONFIG_WARN_WRITE_STRINGS=y
CONFIG_DISABLE_GCC8_WARNINGS=

Component config

Application Level Tracing

CONFIG_ESP32_APPTRACE_DEST_TRAX=
CONFIG_ESP32_APPTRACE_DEST_NONE=y
CONFIG_ESP32_APPTRACE_ENABLE=
CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
CONFIG_AWS_IOT_SDK=

Bluetooth

CONFIG_BT_ENABLED=y

Bluetooth controller

CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=
CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY=
CONFIG_BTDM_CONTROLLER_MODE_BTDM=y
CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN=2
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN=0
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0
CONFIG_BTDM_CTRL_AUTO_LATENCY=
CONFIG_BTDM_CTRL_AUTO_LATENCY_EFF=
CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT=y
CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF=y
CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=2
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0
CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0=y
CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_1=
CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0
CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y
CONFIG_BTDM_CONTROLLER_HCI_MODE_UART_H4=

MODEM SLEEP Options

CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=y
CONFIG_BTDM_MODEM_SLEEP_MODE_ORIG=y
CONFIG_BTDM_MODEM_SLEEP_MODE_EVED=
CONFIG_BTDM_LPCLK_SEL_MAIN_XTAL=y
CONFIG_BLE_SCAN_DUPLICATE=y
CONFIG_SCAN_DUPLICATE_BY_DEVICE_ADDR=y
CONFIG_SCAN_DUPLICATE_BY_ADV_DATA=
CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=
CONFIG_SCAN_DUPLICATE_TYPE=0
CONFIG_DUPLICATE_SCAN_CACHE_SIZE=20
CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=
CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y
CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=y
CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM=100
CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD=20
CONFIG_BTDM_COEX_BT_OPTIONS=
CONFIG_BLUEDROID_ENABLED=y
CONFIG_BLUEDROID_PINNED_TO_CORE_0=y
CONFIG_BLUEDROID_PINNED_TO_CORE_1=
CONFIG_BLUEDROID_PINNED_TO_CORE=0
CONFIG_BTC_TASK_STACK_SIZE=8192
CONFIG_BTU_TASK_STACK_SIZE=4096
CONFIG_BLUEDROID_MEM_DEBUG=
CONFIG_CLASSIC_BT_ENABLED=y
CONFIG_A2DP_ENABLE=y
CONFIG_A2DP_SINK_TASK_STACK_SIZE=2048
CONFIG_A2DP_SOURCE_TASK_STACK_SIZE=2048
CONFIG_BT_SPP_ENABLED=y
CONFIG_HFP_ENABLE=y
CONFIG_HFP_CLIENT_ENABLE=y
CONFIG_HFP_AUDIO_DATA_PATH_PCM=y
CONFIG_HFP_AUDIO_DATA_PATH_HCI=
CONFIG_BT_SSP_ENABLED=y
CONFIG_GATTS_ENABLE=y
CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=
CONFIG_GATTS_SEND_SERVICE_CHANGE_AUTO=y
CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE=0
CONFIG_GATTC_ENABLE=y
CONFIG_GATTC_CACHE_NVS_FLASH=
CONFIG_BLE_SMP_ENABLE=y
CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE=
CONFIG_BT_STACK_NO_LOG=y
CONFIG_BT_ACL_CONNECTIONS=4
CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y
CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y
CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK=
CONFIG_SMP_ENABLE=y
CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY=
CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30
CONFIG_BT_RESERVE_DRAM=0xdb5c
CONFIG_BLE_MESH=

Driver configurations

ADC configuration

CONFIG_ADC_FORCE_XPD_FSM=
CONFIG_ADC2_DISABLE_DAC=y

SPI configuration

CONFIG_SPI_MASTER_IN_IRAM=
CONFIG_SPI_MASTER_ISR_IN_IRAM=y
CONFIG_SPI_SLAVE_IN_IRAM=
CONFIG_SPI_SLAVE_ISR_IN_IRAM=y

eFuse Bit Manager

CONFIG_EFUSE_CUSTOM_TABLE=
CONFIG_EFUSE_VIRTUAL=
CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE=
CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y
CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT=
CONFIG_EFUSE_MAX_BLK_LEN=192
CONFIG_C_IMPL=
CONFIG_XTENSA_IMPL=y

ESP-FACE Configuration

CONFIG_MTMN_LITE_QUANT=y
CONFIG_MTMN_LITE_FLOAT=
CONFIG_MTMN_HEAVY_QUANT=
CONFIG_FRMN=
CONFIG_MFN56_1X=y
CONFIG_MFN56_2X=
CONFIG_MFN56_3X=
CONFIG_MFN56_4X=

Object Detection

CONFIG_DETECT_WITH_LANDMARK=

Pose Estimation

CONFIG_HD_NANO1=y
CONFIG_HD_LITE1=
CONFIG_HP_NANO1=y
CONFIG_HP_LITE1=

ESP32-specific

CONFIG_IDF_TARGET_ESP32=y
CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y
CONFIG_ESP32_REV_MIN_0=y
CONFIG_ESP32_REV_MIN_1=
CONFIG_ESP32_REV_MIN_2=
CONFIG_ESP32_REV_MIN_3=
CONFIG_ESP32_REV_MIN=0
CONFIG_ESP32_DPORT_WORKAROUND=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_80=
CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=160
CONFIG_SPIRAM_SUPPORT=y

SPI RAM config

CONFIG_SPIRAM_BOOT_INIT=
CONFIG_SPIRAM_USE_MEMMAP=
CONFIG_SPIRAM_USE_CAPS_ALLOC=y
CONFIG_SPIRAM_USE_MALLOC=
CONFIG_SPIRAM_TYPE_AUTO=y
CONFIG_SPIRAM_TYPE_ESPPSRAM32=
CONFIG_SPIRAM_TYPE_ESPPSRAM64=
CONFIG_SPIRAM_SIZE=-1
CONFIG_SPIRAM_SPEED_40M=y
CONFIG_SPIRAM_CACHE_WORKAROUND=y
CONFIG_SPIRAM_BANKSWITCH_ENABLE=y
CONFIG_SPIRAM_BANKSWITCH_RESERVE=8
CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST=
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=

PSRAM clock and cs IO for ESP32-DOWD

CONFIG_D0WD_PSRAM_CLK_IO=17
CONFIG_D0WD_PSRAM_CS_IO=16

PSRAM clock and cs IO for ESP32-D2WD

CONFIG_D2WD_PSRAM_CLK_IO=9
CONFIG_D2WD_PSRAM_CS_IO=10

PSRAM clock and cs IO for ESP32-PICO

CONFIG_PICO_PSRAM_CS_IO=10
CONFIG_SPIRAM_SPIWP_SD3_PIN=7
CONFIG_SPIRAM_2T_MODE=
CONFIG_MEMMAP_TRACEMEM=
CONFIG_MEMMAP_TRACEMEM_TWOBANKS=
CONFIG_ESP32_TRAX=
CONFIG_TRACEMEM_RESERVE_DRAM=0x0
CONFIG_TWO_UNIVERSAL_MAC_ADDRESS=
CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y
CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4
CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32
CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2048
CONFIG_MAIN_TASK_STACK_SIZE=4096
CONFIG_IPC_TASK_STACK_SIZE=1024
CONFIG_TIMER_TASK_STACK_SIZE=4096
CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y
CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF=
CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR=
CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF=
CONFIG_NEWLIB_STDIN_LINE_ENDING_LF=
CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y
CONFIG_NEWLIB_NANO_FORMAT=
CONFIG_CONSOLE_UART_DEFAULT=y
CONFIG_CONSOLE_UART_CUSTOM=
CONFIG_CONSOLE_UART_NONE=
CONFIG_CONSOLE_UART_NUM=0
CONFIG_CONSOLE_UART_BAUDRATE=115200
CONFIG_ULP_COPROC_ENABLED=y
CONFIG_ULP_COPROC_RESERVE_MEM=512
CONFIG_ESP32_PANIC_PRINT_HALT=
CONFIG_ESP32_PANIC_PRINT_REBOOT=y
CONFIG_ESP32_PANIC_SILENT_REBOOT=
CONFIG_ESP32_PANIC_GDBSTUB=
CONFIG_ESP32_DEBUG_OCDAWARE=y
CONFIG_ESP32_DEBUG_STUBS_ENABLE=y
CONFIG_INT_WDT=y
CONFIG_INT_WDT_TIMEOUT_MS=300
CONFIG_INT_WDT_CHECK_CPU1=y
CONFIG_TASK_WDT=y
CONFIG_TASK_WDT_PANIC=y
CONFIG_TASK_WDT_TIMEOUT_S=5
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=
CONFIG_BROWNOUT_DET=y
CONFIG_BROWNOUT_DET_LVL_SEL_0=y
CONFIG_BROWNOUT_DET_LVL_SEL_1=
CONFIG_BROWNOUT_DET_LVL_SEL_2=
CONFIG_BROWNOUT_DET_LVL_SEL_3=
CONFIG_BROWNOUT_DET_LVL_SEL_4=
CONFIG_BROWNOUT_DET_LVL_SEL_5=
CONFIG_BROWNOUT_DET_LVL_SEL_6=
CONFIG_BROWNOUT_DET_LVL_SEL_7=
CONFIG_BROWNOUT_DET_LVL=0
CONFIG_REDUCE_PHY_TX_POWER=y
CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y
CONFIG_ESP32_TIME_SYSCALL_USE_RTC=
CONFIG_ESP32_TIME_SYSCALL_USE_FRC1=
CONFIG_ESP32_TIME_SYSCALL_USE_NONE=
CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y
CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL=
CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC=
CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256=
CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024
CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000
CONFIG_ESP32_XTAL_FREQ_40=
CONFIG_ESP32_XTAL_FREQ_26=
CONFIG_ESP32_XTAL_FREQ_AUTO=y
CONFIG_ESP32_XTAL_FREQ=0
CONFIG_DISABLE_BASIC_ROM_CONSOLE=
CONFIG_ESP_TIMER_PROFILING=
CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS=
CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5

Wi-Fi

CONFIG_SW_COEXIST_ENABLE=y
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32
CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y
CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32
CONFIG_ESP32_WIFI_CSI_ENABLED=
CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y
CONFIG_ESP32_WIFI_TX_BA_WIN=6
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
CONFIG_ESP32_WIFI_RX_BA_WIN=16
CONFIG_ESP32_WIFI_NVS_ENABLED=y
CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1=
CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32
CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE=
CONFIG_ESP32_WIFI_IRAM_OPT=
CONFIG_ESP32_WIFI_RX_IRAM_OPT=

PHY

CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y
CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION=
CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20
CONFIG_ESP32_PHY_MAX_TX_POWER=20

Power Management

CONFIG_PM_ENABLE=

Camera configuration

CONFIG_OV7670_SUPPORT=y
CONFIG_OV7725_SUPPORT=y
CONFIG_NT99141_SUPPORT=y
CONFIG_OV2640_SUPPORT=y
CONFIG_OV3660_SUPPORT=y
CONFIG_OV5640_SUPPORT=y
CONFIG_SCCB_HARDWARE_I2C_PORT0=
CONFIG_SCCB_HARDWARE_I2C_PORT1=y
CONFIG_CAMERA_CORE0=
CONFIG_CAMERA_CORE1=y
CONFIG_CAMERA_NO_AFFINITY=

ADC-Calibration

CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y
CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y
CONFIG_ADC_CAL_LUT_ENABLE=y

Event Loop Library

CONFIG_EVENT_LOOP_PROFILING=

ESP HTTP client

CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH=

HTTP Server

CONFIG_HTTPD_MAX_REQ_HDR_LEN=512
CONFIG_HTTPD_MAX_URI_LEN=512
CONFIG_HTTPD_ERR_RESP_NO_DELAY=y
CONFIG_HTTPD_PURGE_BUF_LEN=32
CONFIG_HTTPD_LOG_PURGE_DATA=

ESP HTTPS OTA

CONFIG_OTA_ALLOW_HTTP=

Core dump

CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH=
CONFIG_ESP32_ENABLE_COREDUMP_TO_UART=
CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y
CONFIG_ESP32_ENABLE_COREDUMP=

Ethernet

CONFIG_DMA_RX_BUF_NUM=10
CONFIG_DMA_TX_BUF_NUM=10
CONFIG_EMAC_L2_TO_L3_RX_BUF_MODE=y
CONFIG_EMAC_CHECK_LINK_PERIOD_MS=2000
CONFIG_EMAC_TASK_PRIORITY=20
CONFIG_EMAC_TASK_STACK_SIZE=3072

FAT Filesystem support

CONFIG_FATFS_CODEPAGE_DYNAMIC=
CONFIG_FATFS_CODEPAGE_437=
CONFIG_FATFS_CODEPAGE_720=
CONFIG_FATFS_CODEPAGE_737=
CONFIG_FATFS_CODEPAGE_771=
CONFIG_FATFS_CODEPAGE_775=
CONFIG_FATFS_CODEPAGE_850=y
CONFIG_FATFS_CODEPAGE_852=
CONFIG_FATFS_CODEPAGE_855=
CONFIG_FATFS_CODEPAGE_857=
CONFIG_FATFS_CODEPAGE_860=
CONFIG_FATFS_CODEPAGE_861=
CONFIG_FATFS_CODEPAGE_862=
CONFIG_FATFS_CODEPAGE_863=
CONFIG_FATFS_CODEPAGE_864=
CONFIG_FATFS_CODEPAGE_865=
CONFIG_FATFS_CODEPAGE_866=
CONFIG_FATFS_CODEPAGE_869=
CONFIG_FATFS_CODEPAGE_932=
CONFIG_FATFS_CODEPAGE_936=
CONFIG_FATFS_CODEPAGE_949=
CONFIG_FATFS_CODEPAGE_950=
CONFIG_FATFS_CODEPAGE=850
CONFIG_FATFS_LFN_NONE=
CONFIG_FATFS_LFN_HEAP=
CONFIG_FATFS_LFN_STACK=y
CONFIG_FATFS_MAX_LFN=255
CONFIG_FATFS_API_ENCODING_ANSI_OEM=y
CONFIG_FATFS_API_ENCODING_UTF_16=
CONFIG_FATFS_API_ENCODING_UTF_8=
CONFIG_FATFS_FS_LOCK=0
CONFIG_FATFS_TIMEOUT_MS=10000
CONFIG_FATFS_PER_FILE_CACHE=y
CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y

Modbus configuration

CONFIG_MB_QUEUE_LENGTH=20
CONFIG_MB_SERIAL_TASK_STACK_SIZE=2048
CONFIG_MB_SERIAL_BUF_SIZE=256
CONFIG_MB_SERIAL_TASK_PRIO=10
CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT=
CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20
CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20
CONFIG_MB_CONTROLLER_STACK_SIZE=4096
CONFIG_MB_EVENT_QUEUE_TIMEOUT=20
CONFIG_MB_TIMER_PORT_ENABLED=y
CONFIG_MB_TIMER_GROUP=0
CONFIG_MB_TIMER_INDEX=0

FreeRTOS

CONFIG_FREERTOS_UNICORE=
CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF
CONFIG_FREERTOS_CORETIMER_0=y
CONFIG_FREERTOS_CORETIMER_1=
CONFIG_FREERTOS_HZ=1000
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE=
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL=
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y
CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1
CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y
CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE=
CONFIG_FREERTOS_ASSERT_DISABLE=
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024
CONFIG_FREERTOS_ISR_STACKSIZE=1536
CONFIG_FREERTOS_LEGACY_HOOKS=
CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16
CONFIG_SUPPORT_STATIC_ALLOCATION=y
CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK=
CONFIG_TIMER_TASK_PRIORITY=1
CONFIG_TIMER_TASK_STACK_DEPTH=2048
CONFIG_TIMER_QUEUE_LENGTH=10
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0
CONFIG_FREERTOS_USE_TRACE_FACILITY=
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=
CONFIG_FREERTOS_DEBUG_INTERNALS=
CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y
CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE=

Heap memory debugging

CONFIG_HEAP_POISONING_DISABLED=
CONFIG_HEAP_POISONING_LIGHT=y
CONFIG_HEAP_POISONING_COMPREHENSIVE=
CONFIG_HEAP_TRACING=
CONFIG_HEAP_TASK_TRACKING=

libsodium

CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y

Log output

CONFIG_LOG_DEFAULT_LEVEL_NONE=
CONFIG_LOG_DEFAULT_LEVEL_ERROR=
CONFIG_LOG_DEFAULT_LEVEL_WARN=
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_COLORS=

LWIP

CONFIG_L2_TO_L3_COPY=
CONFIG_ETHARP_SUPPORT_VLAN=
CONFIG_LWIP_IRAM_OPTIMIZATION=
CONFIG_LWIP_MAX_SOCKETS=10
CONFIG_LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS=y
CONFIG_USE_ONLY_LWIP_SELECT=
CONFIG_LWIP_SO_LINGER=
CONFIG_LWIP_SO_REUSE=y
CONFIG_LWIP_SO_REUSE_RXTOALL=y
CONFIG_LWIP_SO_RCVBUF=y
CONFIG_LWIP_IP4_FRAG=y
CONFIG_LWIP_IP6_FRAG=y
CONFIG_LWIP_IP4_REASSEMBLY=
CONFIG_LWIP_IP6_REASSEMBLY=
CONFIG_LWIP_STATS=
CONFIG_LWIP_ETHARP_TRUST_IP_MAC=y
CONFIG_ESP_GRATUITOUS_ARP=y
CONFIG_GARP_TMR_INTERVAL=60
CONFIG_TCPIP_RECVMBOX_SIZE=32
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=
CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y

DHCP server

CONFIG_LWIP_DHCPS_LEASE_UNIT=60
CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8
CONFIG_LWIP_AUTOIP=
CONFIG_LWIP_IPV6_AUTOCONFIG=
CONFIG_LWIP_NETIF_LOOPBACK=y
CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8

TCP

CONFIG_LWIP_TCP_ISN_HOOK=y
CONFIG_LWIP_MAX_ACTIVE_TCP=16
CONFIG_LWIP_MAX_LISTENING_TCP=16
CONFIG_TCP_MAXRTX=12
CONFIG_TCP_SYNMAXRTX=6
CONFIG_TCP_MSS=1436
CONFIG_TCP_MSL=60000
CONFIG_TCP_SND_BUF_DEFAULT=5744
CONFIG_TCP_WND_DEFAULT=5744
CONFIG_TCP_RECVMBOX_SIZE=6
CONFIG_TCP_QUEUE_OOSEQ=y
CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES=
CONFIG_TCP_OVERSIZE_MSS=y
CONFIG_TCP_OVERSIZE_QUARTER_MSS=
CONFIG_TCP_OVERSIZE_DISABLE=
CONFIG_LWIP_TCP_RTO_TIME=3000

UDP

CONFIG_LWIP_MAX_UDP_PCBS=16
CONFIG_UDP_RECVMBOX_SIZE=6
CONFIG_TCPIP_TASK_STACK_SIZE=2560
CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=
CONFIG_TCPIP_TASK_AFFINITY_CPU0=y
CONFIG_TCPIP_TASK_AFFINITY_CPU1=
CONFIG_TCPIP_TASK_AFFINITY=0x0
CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3
CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5
CONFIG_PPP_SUPPORT=y
CONFIG_PPP_NOTIFY_PHASE_SUPPORT=
CONFIG_PPP_PAP_SUPPORT=y
CONFIG_PPP_CHAP_SUPPORT=y
CONFIG_PPP_MSCHAP_SUPPORT=y
CONFIG_PPP_MPPE_SUPPORT=y
CONFIG_PPP_DEBUG_ON=

ICMP

CONFIG_LWIP_MULTICAST_PING=
CONFIG_LWIP_BROADCAST_PING=

LWIP RAW API

CONFIG_LWIP_MAX_RAW_PCBS=16

SNTP

CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1
CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000
CONFIG_LWIP_ESP_LWIP_ASSERT=y

mbedTLS

CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=
CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC=
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=16384
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=
CONFIG_MBEDTLS_DEBUG=
CONFIG_MBEDTLS_ECP_RESTARTABLE=
CONFIG_MBEDTLS_CMAC_C=
CONFIG_MBEDTLS_HARDWARE_AES=y
CONFIG_MBEDTLS_HARDWARE_MPI=
CONFIG_MBEDTLS_HARDWARE_SHA=
CONFIG_MBEDTLS_HAVE_TIME=y
CONFIG_MBEDTLS_HAVE_TIME_DATE=
CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=
CONFIG_MBEDTLS_TLS_SERVER_ONLY=
CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y
CONFIG_MBEDTLS_TLS_DISABLED=
CONFIG_MBEDTLS_TLS_CLIENT=y
CONFIG_MBEDTLS_TLS_ENABLED=y

TLS Key Exchange Methods

CONFIG_MBEDTLS_PSK_MODES=y
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y
CONFIG_MBEDTLS_SSL_RENEGOTIATION=y
CONFIG_MBEDTLS_SSL_PROTO_SSL3=y
CONFIG_MBEDTLS_SSL_PROTO_TLS1=y
CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y
CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
CONFIG_MBEDTLS_SSL_ALPN=y
CONFIG_MBEDTLS_SSL_SESSION_TICKETS=y

Symmetric Ciphers

CONFIG_MBEDTLS_AES_C=y
CONFIG_MBEDTLS_CAMELLIA_C=
CONFIG_MBEDTLS_DES_C=y
CONFIG_MBEDTLS_RC4_DISABLED=
CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT=
CONFIG_MBEDTLS_RC4_ENABLED=y
CONFIG_MBEDTLS_BLOWFISH_C=y
CONFIG_MBEDTLS_XTEA_C=y
CONFIG_MBEDTLS_CCM_C=y
CONFIG_MBEDTLS_GCM_C=y
CONFIG_MBEDTLS_RIPEMD160_C=y

Certificates

CONFIG_MBEDTLS_PEM_PARSE_C=y
CONFIG_MBEDTLS_PEM_WRITE_C=y
CONFIG_MBEDTLS_X509_CRL_PARSE_C=y
CONFIG_MBEDTLS_X509_CSR_PARSE_C=y
CONFIG_MBEDTLS_ECP_C=y
CONFIG_MBEDTLS_ECDH_C=y
CONFIG_MBEDTLS_ECDSA_C=y
CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y
CONFIG_MBEDTLS_ECP_NIST_OPTIM=y

mDNS

CONFIG_MDNS_MAX_SERVICES=10

ESP-MQTT Configurations

CONFIG_MQTT_PROTOCOL_311=y
CONFIG_MQTT_TRANSPORT_SSL=y
CONFIG_MQTT_TRANSPORT_WEBSOCKET=y
CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y
CONFIG_MQTT_USE_CUSTOM_CONFIG=
CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED=
CONFIG_MQTT_CUSTOM_OUTBOX=

NVS

OpenSSL

CONFIG_OPENSSL_DEBUG=
CONFIG_OPENSSL_ASSERT_DO_NOTHING=y
CONFIG_OPENSSL_ASSERT_EXIT=

PThreads

CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5
CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048
CONFIG_PTHREAD_STACK_MIN=768
CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y
CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0=
CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1=
CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1
CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread"

SPI Flash driver

CONFIG_SPI_FLASH_VERIFY_WRITE=
CONFIG_SPI_FLASH_ENABLE_COUNTERS=
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS=
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED=
CONFIG_SPI_FLASH_YIELD_DURING_ERASE=

SPIFFS Configuration

CONFIG_SPIFFS_MAX_PARTITIONS=3

SPIFFS Cache Configuration

CONFIG_SPIFFS_CACHE=y
CONFIG_SPIFFS_CACHE_WR=y
CONFIG_SPIFFS_CACHE_STATS=
CONFIG_SPIFFS_PAGE_CHECK=y
CONFIG_SPIFFS_GC_MAX_RUNS=10
CONFIG_SPIFFS_GC_STATS=
CONFIG_SPIFFS_PAGE_SIZE=256
CONFIG_SPIFFS_OBJ_NAME_LEN=32
CONFIG_SPIFFS_USE_MAGIC=y
CONFIG_SPIFFS_USE_MAGIC_LENGTH=y
CONFIG_SPIFFS_META_LENGTH=4
CONFIG_SPIFFS_USE_MTIME=y

Debug Configuration

CONFIG_SPIFFS_DBG=
CONFIG_SPIFFS_API_DBG=
CONFIG_SPIFFS_GC_DBG=
CONFIG_SPIFFS_CACHE_DBG=
CONFIG_SPIFFS_CHECK_DBG=
CONFIG_SPIFFS_TEST_VISUALISATION=

TCP/IP Adapter

CONFIG_IP_LOST_TIMER_INTERVAL=120
CONFIG_TCPIP_LWIP=y

Unity unit testing library

CONFIG_UNITY_ENABLE_FLOAT=y
CONFIG_UNITY_ENABLE_DOUBLE=y
CONFIG_UNITY_ENABLE_COLOR=
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y
CONFIG_UNITY_ENABLE_FIXTURE=

Virtual file system

CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y
CONFIG_SUPPORT_TERMIOS=y

Wear Levelling

CONFIG_WL_SECTOR_SIZE_512=
CONFIG_WL_SECTOR_SIZE_4096=y
CONFIG_WL_SECTOR_SIZE=4096

Wi-Fi Provisioning Manager

CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16

Supplicant

CONFIG_WPA_WPS_WARS=

@shaun-mzj
Copy link
Author

We've also added a component to idf which loads the file via HTTPS and called it from Arduino and it has the same issue. Calling the component from an esp-idf built program and it works. Could you please advise on why the same code when built via esp-idf would work but when built via Arduino would fail?

@me-no-dev
Copy link
Member

Are you saying that when using Arduino as IDF component it is failing, but when using only IDF it does not? Other than that, Arduino does not have the flag for external RAM set

@shaun-mzj
Copy link
Author

I'm using the esp32-arduino-lib-builder and have enabled the external memory option in the config file. When running the output that repo produces from the ./build.sh command mbedtls seems to have issues. However when running the same mbedtls code via edp-idf it works fine.

Disabling external memory and running ./build.sh and using that output with Arduino works fine, for some reason enabling external memory breaks it.

@me-no-dev
Copy link
Member

hmm... since the lib builder is in reality "Using Arduino as IDF component", what happens if you change main.cpp in it with your Arduino sketch and run make flash monitor ESPPORT=[your-uart-port] ESPBAUD=921600 after ./build.sh?

@shaun-mzj
Copy link
Author

Replacing main.cpp with the test idf code and running as above works fine

@me-no-dev
Copy link
Member

Are you sure that you copied the resulting release from ./build.sh to your other Arduino install? ./tools/copy-to-arduino.sh?

@shaun-mzj
Copy link
Author

I'm building on Linux but running Arduino on Mac so am using a different script to copy but am copying the newly build one over. If I wasn't copying it over disabling the external memory flag for mbedtls and copying again wouldn't make it work?

@me-no-dev
Copy link
Member

if something is not copied over properly, your change will not apply. Are you sure that all is copied over?
https://github.com/espressif/esp32-arduino-lib-builder/blob/master/tools/copy-to-arduino.sh#L17-L22

Are you using the same version of esp32-arduino on the Mac? (BTW I use/develop the lib builder on a Mac. Maybe you can try that?)

@shaun-mzj
Copy link
Author

Thanks, I'll try building on Mac and running the same script

@akshar001
Copy link

if something is not copied over properly, your change will not apply. Are you sure that all is copied over?
https://github.com/espressif/esp32-arduino-lib-builder/blob/master/tools/copy-to-arduino.sh#L17-L22

Are you using the same version of esp32-arduino on the Mac? (BTW I use/develop the lib builder on a Mac. Maybe you can try that?)

Yes we did everything. That you mentioned probably like 50 iterations. back and forth.

At the last i have another code in which we just use the static mbedtls

mbedtls_memory_buffer_alloc_init( memory_buf, sizeof(memory_buf) );

Using this.

Interesting thing.

When i use internal ram it works fine.

But if i use psram malloc it crashes.

@akshar001
Copy link

I'll post that code here too.

It's little messy up but it will do our job.

For that i needed to uncomment #define tag from esp_config in mbedtls component esp-idf folder

//#define MBEDTLS_MEMORY_BUFFER_ALLOC_C

I thought if i just allocate psram memory in before everything it might solve the problem but still same issue.

@akshar001
Copy link

akshar001 commented Feb 18, 2021

#include <WiFi.h>
#include <HTTPClient.h>
 #include <string.h>
#include <stdlib.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_wifi.h"
#include "esp_event_loop.h"
#include "esp_log.h"
#include "esp_system.h"
#include "nvs_flash.h"

#include "lwip/err.h"
#include "lwip/sockets.h"
#include "lwip/sys.h"
#include "lwip/netdb.h"
#include "lwip/dns.h"

#include "mbedtls/platform.h"
#include "mbedtls/net_sockets.h"
#include "mbedtls/esp_debug.h"
#include "mbedtls/ssl.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/error.h"
#include "mbedtls/certs.h"
#include "mbedtls/memory_buffer_alloc.h"
const char* ssid = "Akshar";
const char* password =  "sss3kk2aaaa4";

extern const uint8_t server_root_cert_pem_start[] asm("_binary_server_root_cert_pem_start");
extern const uint8_t server_root_cert_pem_end[]   asm("_binary_server_root_cert_pem_end");

#define WEB_SERVER "www.wiphone.io"
#define WEB_PORT "443"
#define WEB_URL "https://www.wiphone.io/static/releases/firmware/WiPhone-phone.ini"

static const char *TAG = "example";

const char rootCert[] = "-----BEGIN CERTIFICATE-----\n"\
"MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UEBhM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gBVGP7pSWTUTsqXnLRbwHOoq7hHwg==\n"\
"-----END CERTIFICATE-----\n";

                                
static const char *REQUEST = "GET " WEB_URL " HTTP/1.0\r\n"
    "Host: "WEB_SERVER"\r\n"
    "User-Agent: esp-idf/1.0 esp32\r\n"
    "\r\n";
// extern "C"
// { 
//     int printf(const char *format,...); 
// } 
// unsigned char alloc_buf[80000];
unsigned char *alloc_buf;
static void https_get_task(void *pvParameters)
{
    char buf[512];
    int ret, flags, len;
    // unsigned char *alloc_buf = (unsigned char *)ps_calloc(80000,1);
    if(alloc_buf == NULL)
    {
        ESP_LOGI(TAG,"alloc_buf is not initialised");
        return;
    }
    mbedtls_entropy_context entropy;
    mbedtls_ctr_drbg_context ctr_drbg;
    mbedtls_ssl_context ssl;
    mbedtls_x509_crt cacert;
    mbedtls_ssl_config conf;
    mbedtls_net_context server_fd;
    
    mbedtls_memory_buffer_alloc_init(alloc_buf, 80000 );
    mbedtls_ssl_init(&ssl);
    mbedtls_x509_crt_init(&cacert);
    mbedtls_ctr_drbg_init(&ctr_drbg);
    ESP_LOGI(TAG, "Seeding the random number generator");

    mbedtls_ssl_config_init(&conf);

    mbedtls_entropy_init(&entropy);
    if((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
                                    NULL, 0)) != 0)
    {
        ESP_LOGE(TAG, "mbedtls_ctr_drbg_seed returned %d", ret);
        abort();
    }

    ESP_LOGI(TAG, "Loading the CA root certificate...");

    ret = mbedtls_x509_crt_parse(&cacert, (const unsigned char*)rootCert,sizeof(rootCert));

    if(ret < 0)
    {
        ESP_LOGE(TAG, "mbedtls_x509_crt_parse returned -0x%x\n\n", -ret);
        abort();
    }

    ESP_LOGI(TAG, "Setting hostname for TLS session...");

     /* Hostname set here should match CN in server certificate */
    if((ret = mbedtls_ssl_set_hostname(&ssl, WEB_SERVER)) != 0)
    {
        ESP_LOGE(TAG, "mbedtls_ssl_set_hostname returned -0x%x", -ret);
        abort();
    }

    ESP_LOGI(TAG, "Setting up the SSL/TLS structure...");

    if((ret = mbedtls_ssl_config_defaults(&conf,
                                          MBEDTLS_SSL_IS_CLIENT,
                                          MBEDTLS_SSL_TRANSPORT_STREAM,
                                          MBEDTLS_SSL_PRESET_DEFAULT)) != 0)
    {
        ESP_LOGE(TAG, "mbedtls_ssl_config_defaults returned %d", ret);
//        goto exit;
    }

    /* MBEDTLS_SSL_VERIFY_OPTIONAL is bad for security, in this example it will print
       a warning if CA verification fails but it will continue to connect.

       You should consider using MBEDTLS_SSL_VERIFY_REQUIRED in your own code.
    */
    mbedtls_ssl_conf_authmode(&conf, MBEDTLS_SSL_VERIFY_OPTIONAL);
    mbedtls_ssl_conf_ca_chain(&conf, &cacert, NULL);
    mbedtls_ssl_conf_rng(&conf, mbedtls_ctr_drbg_random, &ctr_drbg);
#ifdef CONFIG_MBEDTLS_DEBUG
    mbedtls_esp_enable_debug_log(&conf, 4);
#endif

    if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0)
    {
        ESP_LOGE(TAG, "mbedtls_ssl_setup returned -0x%x\n\n", -ret);
//        goto exit;
    }

    while(1) {
        /* Wait for the callback to set the CONNECTED_BIT in the
           event group.
        */
//        xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
//                            false, true, portMAX_DELAY);
        ESP_LOGI(TAG, "Connected to AP");

        mbedtls_net_init(&server_fd);

        ESP_LOGI(TAG, "Connecting to %s:%s...", WEB_SERVER, WEB_PORT);

        if ((ret = mbedtls_net_connect(&server_fd, WEB_SERVER,
                                      WEB_PORT, MBEDTLS_NET_PROTO_TCP)) != 0)
        {
            ESP_LOGE(TAG, "mbedtls_net_connect returned -%x", -ret);
//            goto exit;
        }

        ESP_LOGI(TAG, "Connected.");

        mbedtls_ssl_set_bio(&ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, NULL);

        ESP_LOGI(TAG, "Performing the SSL/TLS handshake...");

        while ((ret = mbedtls_ssl_handshake(&ssl)) != 0)
        {
            if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE)
            {
                ESP_LOGE(TAG, "mbedtls_ssl_handshake returned -0x%x", -ret);
//                goto exit;
            }
        }

        ESP_LOGI(TAG, "Verifying peer X.509 certificate...");

        if ((flags = mbedtls_ssl_get_verify_result(&ssl)) != 0)
        {
            /* In real life, we probably want to close connection if ret != 0 */
            ESP_LOGW(TAG, "Failed to verify peer certificate!");
            bzero(buf, sizeof(buf));
            mbedtls_x509_crt_verify_info(buf, sizeof(buf), "  ! ", flags);
            ESP_LOGW(TAG, "verification info: %s", buf);
        }
        else {
            ESP_LOGI(TAG, "Certificate verified.");
        }

        ESP_LOGI(TAG, "Cipher suite is %s", mbedtls_ssl_get_ciphersuite(&ssl));

        ESP_LOGI(TAG, "Writing HTTP request...");

        size_t written_bytes = 0;
        do {
            ret = mbedtls_ssl_write(&ssl,
                                    (const unsigned char *)REQUEST + written_bytes,
                                    strlen(REQUEST) - written_bytes);
            if (ret >= 0) {
                ESP_LOGI(TAG, "%d bytes written", ret);
                written_bytes += ret;
            } else if (ret != MBEDTLS_ERR_SSL_WANT_WRITE && ret != MBEDTLS_ERR_SSL_WANT_READ) {
                ESP_LOGE(TAG, "mbedtls_ssl_write returned -0x%x", -ret);
//                goto exit;
            }
        } while(written_bytes < strlen(REQUEST));

        ESP_LOGI(TAG, "Reading HTTP response...");

        do
        {
            len = sizeof(buf) - 1;
            bzero(buf, sizeof(buf));
            ret = mbedtls_ssl_read(&ssl, (unsigned char *)buf, len);

            if(ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE)
                continue;

            if(ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
                ret = 0;
                break;
            }

            if(ret < 0)
            {
                ESP_LOGE(TAG, "mbedtls_ssl_read returned -0x%x", -ret);
                break;
            }

            if(ret == 0)
            {
                ESP_LOGI(TAG, "connection closed");
                break;
            }

            len = ret;
            ESP_LOGD(TAG, "%d bytes read", len);
            /* Print response directly to stdout as it is read */
            for(int i = 0; i < len; i++) {
                putchar(buf[i]);
            }
        } while(1);

        mbedtls_ssl_close_notify(&ssl);

//    exit:
//        mbedtls_ssl_session_reset(&ssl);
//        mbedtls_net_free(&server_fd);
//
//        if(ret != 0)
//        {
//            mbedtls_strerror(ret, buf, 100);
//            ESP_LOGE(TAG, "Last error was: -0x%x - %s", -ret, buf);
//        }
//
//        putchar('\n'); // JSON output doesn't have a newline at end
//
//        static int request_count;
//        ESP_LOGI(TAG, "Completed %d requests", ++request_count);
//
//        for(int countdown = 10; countdown >= 0; countdown--) {
//            ESP_LOGI(TAG, "%d...", countdown);
//            vTaskDelay(1000 / portTICK_PERIOD_MS);
//        }
//        ESP_LOGI(TAG, "Starting again!");
    }
}


void setup() {
  // alloc_buf = (unsigned char *)malloc(100);
  alloc_buf =   (unsigned char *)heap_caps_malloc(80000,MALLOC_CAP_SPIRAM);
  Serial.begin(115200);
  
  // if(alloc_buf == NULL)
  // {
  //   Serial.println("alloc_buf is not initialised");
  // }

  delay(1000);
 
  WiFi.begin(ssid, password); 
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi..");
  }
 
  Serial.println("Connected to the WiFi network");
  xTaskCreate(&https_get_task, "https_get_task", 8192, NULL, 5, NULL);
}
 

 
void loop() {
    delay(100);
    Serial.println("getting");
//  if ((WiFi.status() == WL_CONNECTED)) { //Check the current connection status
// 
//    HTTPClient http;
// 
//    http.begin("https://wiphone.io/static/releases/firmware/WiPhone-phone.ini", rootCACertificate); //Specify the URL and certificate
//    int httpCode = http.GET();                                                  //Make the request
// 
//    if (httpCode > 0) { //Check for the returning code
// 
//        String payload = http.getString();
//        Serial.println(httpCode);
//        Serial.println(payload);
//      }
// 
//    else {
//      Serial.println("Error on HTTP request");
//    }
// 
//    http.end(); //Free the resources
//  }
//  
//  delay(10000);
}

@akshar001
Copy link

So if use this

// unsigned char alloc_buf[80000];

it works fine.

@akshar001
Copy link

akshar001 commented Feb 18, 2021

but when we use this

alloc_buf = (unsigned char *)heap_caps_malloc(80000,MALLOC_CAP_SPIRAM);

problem.

@akshar001
Copy link

@me-no-dev #4818 (comment)
Same issue.

@shaun-mzj
Copy link
Author

I've also just finished trying it on Mac and using the copy script linked and it doesn't work still

@me-no-dev
Copy link
Member

i'm really confused why it would work in the lib-builder, but not when copied... it's the same files... except if some flag is missing in the build commands?

They are taken from the build in the 4.2 branch (cmake) but not on master (make). Maybe check the output running a verbose build of the lib-builder and compare flags against what is in platform.txt?

@shaun-mzj
Copy link
Author

We've both been working on this independently to try and figure it out so chances are we've both not done something dumb with copying etc. Are you able to try enabling that external memory setting for mbedtls and try it? I'll have a look and see if I can see anything with the flags

@akshar001
Copy link

Same confusion here. What i have noticed is build settings, I am using mac @me-no-dev i have used this copy-to-arduino.sh one

@akshar001
Copy link

@me-no-dev can you try once doing this same on your side. it might take 10 minutes only. We have one thing to launch and we are just stuck at development because of this.

@shaun-mzj
Copy link
Author

Also we are running it on v1 hardware, not sure if that matters

@me-no-dev
Copy link
Member

what do I need to test this? a board with WROVER module + the sketch above?

@shaun-mzj
Copy link
Author

shaun-mzj commented Feb 18, 2021

I'm using a board with the following chip: ESP32D0WDQ6 (revision 1) with 8MB SPI RAM and Akshar is using: ESP32-D0WDQ6-ATUB00

@shaun-mzj
Copy link
Author

Just to make sure that you know we only see the error when we enable the external memory and enable this option for mbedtls: CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y

@akshar001
Copy link

@me-no-dev yes. nothing more.

@shaun-mzj
Copy link
Author

Looking at the flags I noticed this was missing: -mfix-esp32-psram-cache-issue but adding it didn't fix the issue for me. I'm now running everything on Mac and using Arduino version: 1.18.13 if that matters for producing the issue

@akshar001
Copy link

@shaun-mzj I have tried that as well same for me.
What the arduino one do different than what we are doing now is needed to be figured out.
That's where our issue lies.
We copied everything and it still didn't worked. So there must be some different thing which should be the same

@akshar001
Copy link

@me-no-dev I have also tried using uni core but it didn't helped me either,
And it's been failing at handshake for everytime in mbedtls.

@me-no-dev
Copy link
Member

The issue was that certain libraries that deal with PSRAM issues were not included in the linking process and were also not copied by the lib-builder. Lib-builder commit is here: espressif/esp32-arduino-lib-builder@3fa59d5

You can now create a proper update with mbedts in PSRAM :)

@shaun-mzj
Copy link
Author

Thank you! I've tried it and it working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants