Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_some_esp32_host_issues_v5.3' into 'release/v…
Browse files Browse the repository at this point in the history
…5.3'

Bugfix/fix some esp32 host issues(Backport v5.3)

See merge request espressif/esp-idf!32681
  • Loading branch information
jack0c committed Sep 9, 2024
2 parents 37bdbf3 + 71eb08b commit ab11ab7
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 4 deletions.
23 changes: 23 additions & 0 deletions components/esp_wifi/esp32p4/esp_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ extern void wifi_apb80m_request(void);
extern void wifi_apb80m_release(void);
#endif

#if CONFIG_ESP_EXT_CONN_ENABLE
extern uint8_t *esp_extconn_get_mac(void);
#endif

IRAM_ATTR void *wifi_malloc(size_t size)
{
#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
Expand Down Expand Up @@ -427,7 +431,26 @@ static void esp_log_write_wrapper(unsigned int level, const char *tag, const cha

static esp_err_t esp_read_mac_wrapper(uint8_t *mac, unsigned int type)
{
if (mac == NULL) {
ESP_LOGE(TAG, "mac address param is NULL");
return ESP_ERR_INVALID_ARG;
}

// get mac address from target
#if CONFIG_ESP_EXT_CONN_ENABLE
memcpy(mac, esp_extconn_get_mac(), 6);
#else
ESP_LOGE(TAG, "Not support read mac");
return ESP_FAIL;
#endif

if (type == ESP_MAC_WIFI_SOFTAP) {
mac[5] += 1;
}

ESP_LOGD(TAG, "%s MAC addr: " MACSTR, (type == ESP_MAC_WIFI_STA ? "STA" : "AP"), MAC2STR(mac));

return ESP_OK;
}

static int coex_init_wrapper(void)
Expand Down
5 changes: 3 additions & 2 deletions examples/wifi/.build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ examples/wifi/getting_started:

examples/wifi/iperf:
disable:
- if: SOC_WIFI_SUPPORTED != 1
- if: (SOC_WIFI_SUPPORTED != 1) and (SOC_WIRELESS_HOST_SUPPORTED != 1)
- if: (IDF_TARGET == "esp32p4") and CONFIG_NAME in ["defaults", "99"]
disable_test:
- if: IDF_TARGET != "esp32"
- if: IDF_TARGET not in ["esp32"]
temporary: true
reason: lack of runners
depends_components:
Expand Down
4 changes: 2 additions & 2 deletions examples/wifi/iperf/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |

# Iperf Example

Expand Down
4 changes: 4 additions & 0 deletions examples/wifi/iperf/main/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ dependencies:
version: "~0.1.0"
esp-qa/ping-cmd:
version: "~0.0.1"
espressif/esp-extconn:
version: "~0.1.0"
rules:
- if: "target in [esp32p4]"
8 changes: 8 additions & 0 deletions examples/wifi/iperf/main/iperf_example_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ extern int wifi_cmd_get_rx_statistics(int argc, char **argv);
extern int wifi_cmd_clr_rx_statistics(int argc, char **argv);
#endif

#ifdef CONFIG_ESP_EXT_CONN_ENABLE
#include "esp_extconn.h"
#endif

void iperf_hook_show_wifi_stats(iperf_traffic_type_t type, iperf_status_t status)
{
Expand Down Expand Up @@ -69,6 +72,11 @@ void iperf_hook_show_wifi_stats(iperf_traffic_type_t type, iperf_status_t status

void app_main(void)
{
#if CONFIG_ESP_EXT_CONN_ENABLE
esp_extconn_config_t ext_config = ESP_EXTCONN_CONFIG_DEFAULT();
esp_extconn_init(&ext_config);
#endif

esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
Expand Down
6 changes: 6 additions & 0 deletions examples/wifi/iperf/sdkconfig.ci.esp32p4_with_extconn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# ESP32-P4
#
CONFIG_IDF_TARGET="esp32p4"
CONFIG_ESP_HOST_WIFI_ENABLED=y
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y

0 comments on commit ab11ab7

Please sign in to comment.