From 1a3bb069163f60f14e5fb762406d3b62587187a9 Mon Sep 17 00:00:00 2001 From: morris Date: Fri, 17 Jan 2020 13:40:44 +0800 Subject: [PATCH] ethernet: always put eth_driver handle in SRAM Closes https://github.com/espressif/esp-idf/issues/4635 --- components/esp_eth/src/esp_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/esp_eth/src/esp_eth.c b/components/esp_eth/src/esp_eth.c index 4e61078f6..64025c4bd 100644 --- a/components/esp_eth/src/esp_eth.c +++ b/components/esp_eth/src/esp_eth.c @@ -171,7 +171,8 @@ esp_err_t esp_eth_driver_install(const esp_eth_config_t *config, esp_eth_handle_ esp_eth_mac_t *mac = config->mac; esp_eth_phy_t *phy = config->phy; ETH_CHECK(mac && phy, "can't set eth->mac or eth->phy to null", err, ESP_ERR_INVALID_ARG); - esp_eth_driver_t *eth_driver = calloc(1, sizeof(esp_eth_driver_t)); + // eth_driver contains an atomic variable, which should not be put in PSRAM + esp_eth_driver_t *eth_driver = heap_caps_calloc(1, sizeof(esp_eth_driver_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); ETH_CHECK(eth_driver, "request memory for eth_driver failed", err, ESP_ERR_NO_MEM); atomic_init(ð_driver->ref_count, 1); eth_driver->mac = mac;