mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-30 02:37:31 +02:00
protocol_examples_common: fix build for SPI_ETHERNET case with IDF v5.x
This commit is contained in:
9
.github/workflows/target-test.yml
vendored
9
.github/workflows/target-test.yml
vendored
@ -56,16 +56,23 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
. ${IDF_PATH}/export.sh
|
. ${IDF_PATH}/export.sh
|
||||||
cd $GITHUB_WORKSPACE/esp-protocols/components/mdns/examples/
|
cd $GITHUB_WORKSPACE/esp-protocols/components/mdns/examples/
|
||||||
idf.py set-target ${{ matrix.idf_target }}
|
idf.py set-target ${{ matrix.idf_target }}
|
||||||
|
echo "Building for default configuration"
|
||||||
|
idf.py build
|
||||||
|
rm sdkconfig
|
||||||
|
echo "Building for sdkconfig.ci.eth_def"
|
||||||
cat sdkconfig.ci.eth_def >> sdkconfig.defaults
|
cat sdkconfig.ci.eth_def >> sdkconfig.defaults
|
||||||
idf.py build
|
idf.py build
|
||||||
rm sdkconfig sdkconfig.defaults
|
rm sdkconfig sdkconfig.defaults
|
||||||
|
echo "Building for sdkconfig.ci.eth_custom_netif"
|
||||||
cat sdkconfig.ci.eth_custom_netif >> sdkconfig.defaults
|
cat sdkconfig.ci.eth_custom_netif >> sdkconfig.defaults
|
||||||
idf.py build
|
idf.py build
|
||||||
rm sdkconfig sdkconfig.defaults
|
rm sdkconfig sdkconfig.defaults
|
||||||
|
echo "Building for sdkconfig.ci.eth_socket"
|
||||||
cat sdkconfig.ci.eth_socket >> sdkconfig.defaults
|
cat sdkconfig.ci.eth_socket >> sdkconfig.defaults
|
||||||
idf.py build
|
idf.py build
|
||||||
rm sdkconfig sdkconfig.defaults
|
rm sdkconfig sdkconfig.defaults
|
||||||
|
echo "Building for sdkconfig.ci.eth_no_ipv6"
|
||||||
cat sdkconfig.ci.eth_no_ipv6 >> sdkconfig.defaults
|
cat sdkconfig.ci.eth_no_ipv6 >> sdkconfig.defaults
|
||||||
idf.py build
|
idf.py build
|
||||||
cd $GITHUB_WORKSPACE/esp-protocols/components/mdns/tests/test_apps/
|
cd $GITHUB_WORKSPACE/esp-protocols/components/mdns/tests/test_apps/
|
||||||
|
@ -396,7 +396,9 @@ static esp_netif_t *eth_start(void)
|
|||||||
#endif
|
#endif
|
||||||
#elif CONFIG_EXAMPLE_USE_SPI_ETHERNET
|
#elif CONFIG_EXAMPLE_USE_SPI_ETHERNET
|
||||||
gpio_install_isr_service(0);
|
gpio_install_isr_service(0);
|
||||||
|
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
spi_device_handle_t spi_handle = NULL;
|
spi_device_handle_t spi_handle = NULL;
|
||||||
|
#endif
|
||||||
spi_bus_config_t buscfg = {
|
spi_bus_config_t buscfg = {
|
||||||
.miso_io_num = CONFIG_EXAMPLE_ETH_SPI_MISO_GPIO,
|
.miso_io_num = CONFIG_EXAMPLE_ETH_SPI_MISO_GPIO,
|
||||||
.mosi_io_num = CONFIG_EXAMPLE_ETH_SPI_MOSI_GPIO,
|
.mosi_io_num = CONFIG_EXAMPLE_ETH_SPI_MOSI_GPIO,
|
||||||
@ -414,9 +416,14 @@ static esp_netif_t *eth_start(void)
|
|||||||
.spics_io_num = CONFIG_EXAMPLE_ETH_SPI_CS_GPIO,
|
.spics_io_num = CONFIG_EXAMPLE_ETH_SPI_CS_GPIO,
|
||||||
.queue_size = 20
|
.queue_size = 20
|
||||||
};
|
};
|
||||||
|
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
ESP_ERROR_CHECK(spi_bus_add_device(CONFIG_EXAMPLE_ETH_SPI_HOST, &devcfg, &spi_handle));
|
ESP_ERROR_CHECK(spi_bus_add_device(CONFIG_EXAMPLE_ETH_SPI_HOST, &devcfg, &spi_handle));
|
||||||
/* dm9051 ethernet driver is based on spi driver */
|
/* dm9051 ethernet driver is based on spi driver */
|
||||||
eth_dm9051_config_t dm9051_config = ETH_DM9051_DEFAULT_CONFIG(spi_handle);
|
eth_dm9051_config_t dm9051_config = ETH_DM9051_DEFAULT_CONFIG(spi_handle);
|
||||||
|
#else
|
||||||
|
eth_dm9051_config_t dm9051_config = ETH_DM9051_DEFAULT_CONFIG(CONFIG_EXAMPLE_ETH_SPI_HOST, &devcfg);
|
||||||
|
#endif // ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
|
|
||||||
dm9051_config.int_gpio_num = CONFIG_EXAMPLE_ETH_SPI_INT_GPIO;
|
dm9051_config.int_gpio_num = CONFIG_EXAMPLE_ETH_SPI_INT_GPIO;
|
||||||
s_mac = esp_eth_mac_new_dm9051(&dm9051_config, &mac_config);
|
s_mac = esp_eth_mac_new_dm9051(&dm9051_config, &mac_config);
|
||||||
s_phy = esp_eth_phy_new_dm9051(&phy_config);
|
s_phy = esp_eth_phy_new_dm9051(&phy_config);
|
||||||
@ -429,9 +436,13 @@ static esp_netif_t *eth_start(void)
|
|||||||
.spics_io_num = CONFIG_EXAMPLE_ETH_SPI_CS_GPIO,
|
.spics_io_num = CONFIG_EXAMPLE_ETH_SPI_CS_GPIO,
|
||||||
.queue_size = 20
|
.queue_size = 20
|
||||||
};
|
};
|
||||||
|
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
ESP_ERROR_CHECK(spi_bus_add_device(CONFIG_EXAMPLE_ETH_SPI_HOST, &devcfg, &spi_handle));
|
ESP_ERROR_CHECK(spi_bus_add_device(CONFIG_EXAMPLE_ETH_SPI_HOST, &devcfg, &spi_handle));
|
||||||
/* w5500 ethernet driver is based on spi driver */
|
/* w5500 ethernet driver is based on spi driver */
|
||||||
eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(spi_handle);
|
eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(spi_handle);
|
||||||
|
#else
|
||||||
|
eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(CONFIG_EXAMPLE_ETH_SPI_HOST, &devcfg);
|
||||||
|
#endif // ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
w5500_config.int_gpio_num = CONFIG_EXAMPLE_ETH_SPI_INT_GPIO;
|
w5500_config.int_gpio_num = CONFIG_EXAMPLE_ETH_SPI_INT_GPIO;
|
||||||
s_mac = esp_eth_mac_new_w5500(&w5500_config, &mac_config);
|
s_mac = esp_eth_mac_new_w5500(&w5500_config, &mac_config);
|
||||||
s_phy = esp_eth_phy_new_w5500(&phy_config);
|
s_phy = esp_eth_phy_new_w5500(&phy_config);
|
||||||
|
Reference in New Issue
Block a user