Merges https://github.com/espressif/esp-idf/pull/2940
Required first step before merging back to mainline.