Skip to content

Commit 82279f4

Browse files
committed
Updates for review part 2
Ethernet changes - MDC, MDIO tidy up - IPV6 local address not allocated on ethernet adapters Add P4 to builds Other fixes as per review
1 parent 29046ed commit 82279f4

File tree

6 files changed

+42
-16
lines changed

6 files changed

+42
-16
lines changed

azure-pipelines-nightly.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,15 @@ jobs:
579579
PackageName: ESP_WROVER_KIT
580580
CMakePreset: ESP_WROVER_KIT
581581

582+
ESP32_P4_USB:
583+
TargetBoard: ESP32_P4
584+
TargetSeries: "esp32p4"
585+
BuildOptions:
586+
IDF_Target: esp32p4
587+
TargetName: ESP32_P4_USB
588+
PackageName: ESP32_P4_USB
589+
CMakePreset: ESP32_P4_USB
590+
582591
variables:
583592
DOTNET_NOLOGO: true
584593
# creates a counter and assigns it to the revision variable

azure-pipelines.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,15 @@ jobs:
521521
PackageName: ESP32_ETHERNET_KIT_1.2
522522
CMakePreset: ESP32_ETHERNET_KIT_1.2
523523

524+
ESP32_P4_UART:
525+
TargetBoard: ESP32_P4
526+
TargetSeries: "esp32p4"
527+
BuildOptions:
528+
IDF_Target: esp32p4
529+
TargetName: ESP32_P4_UART
530+
PackageName: ESP32_P4_UART
531+
CMakePreset: ESP32_P4_UART
532+
524533
variables:
525534
DOTNET_NOLOGO: true
526535
# creates a counter and assigns it to the revision variable

targets/ESP32/_IDF/esp32/partitions_nanoclr_2mb.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ nvs, data, nvs, 0x9000, 0x6000,
88
phy_init, data, phy, 0xf000, 0x1000,
99
# Factory area for nanoCLR - 1728k
1010
factory, app, factory, 0x10000, 0x1B0000,
11-
# Deployment area for Managed code 12k
11+
# Deployment area for Managed code 192k
1212
deploy, data, 0x84, 0x1C0000, 0x30000,
1313
# Config data for Network, Wireless, certificates, user data 64k
1414
config, data, littlefs, 0x1F0000, 0x10000,

targets/ESP32/_Network/NF_ESP32_Ethernet.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ esp_eth_handle_t eth_handle = NULL;
2929
#define ETH_PHY_ADDR 0
3030
#endif
3131

32-
#ifndef ETH_MDC_GPIO
33-
// GPIO number used by SMI MDC
34-
#define ETH_MDC_GPIO 23
35-
#endif
36-
37-
#ifndef ETH_MDIO_GPIO
38-
// GPIO number used by SMI MDIO
39-
#define ETH_MDIO_GPIO 18
40-
#endif
41-
4232
#if CONFIG_IDF_TARGET_ESP32
4333
#define NANO_ETH_ESP32_EMAC_DEFAULT_CONFIG() \
4434
{ \
@@ -156,18 +146,27 @@ esp_err_t NF_ESP32_InitialiseEthernet(uint8_t *pMacAdr)
156146
CPU_GPIO_ReservePin(esp32_emac_config.clock_config.rmii.clock_gpio, true); // REF_CLK IN
157147
#endif
158148

149+
// If ETH_MDC_GPIO or ETH_MDIO_GPIO defined then use new values
150+
#ifdef ETH_MDC_GPIO
159151
esp32_emac_config.smi_gpio.mdc_num = ETH_MDC_GPIO;
152+
#endif
153+
154+
#ifdef ETH_MDIO_GPIO
160155
esp32_emac_config.smi_gpio.mdio_num = ETH_MDIO_GPIO;
156+
#endif
157+
158+
ESP_LOGI(TAG, "Ethernet pins for MDC %d MDIO %d\n", esp32_emac_config.smi_gpio.mdc_num, esp32_emac_config.smi_gpio.mdio_num);
159+
161160
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
162161

163162
ESP_LOGI(TAG, "Ethernet mdio %d mdc %d\n", ETH_MDIO_GPIO, ETH_MDC_GPIO);
164163

165164
// Reserve all pins used by ethernet interface
166-
CPU_GPIO_ReservePin(ETH_MDIO_GPIO, true); // MDIO (18)
165+
CPU_GPIO_ReservePin(esp32_emac_config.smi_gpio.mdio_num, true); // MDIO
167166
CPU_GPIO_ReservePin(19, true); // TXD0
168167
CPU_GPIO_ReservePin(21, true); // TX_EN
169168
CPU_GPIO_ReservePin(22, true); // TXD1
170-
CPU_GPIO_ReservePin(ETH_MDC_GPIO, true); // MDC (23)
169+
CPU_GPIO_ReservePin(esp32_emac_config.smi_gpio.mdc_num, true); // MDC
171170
CPU_GPIO_ReservePin(25, true); // RXD0
172171
CPU_GPIO_ReservePin(26, true); // RXD1
173172
CPU_GPIO_ReservePin(27, true); // CRS_DV

targets/ESP32/_common/targetHAL_Network.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,15 @@ static void event_handler(void *arg, esp_event_base_t event_base, int32_t event_
373373
#ifdef PRINT_NET_EVENT
374374
ets_printf("ETHERNET_EVENT_CONNECTED\n");
375375
#endif
376+
377+
#if LWIP_IPV6
378+
{
379+
// Create IPV6 link local address for ETH interface
380+
struct netif *netif = esp_netif_get_handle_from_ifkey("ETH_DEF")->lwip_netif;
381+
netif_create_ip6_linklocal_address(netif, 1);
382+
}
383+
#endif
384+
376385
PostAvailabilityOn(IDF_ETH_DEF);
377386
break;
378387

targets/ESP32/_include/nf_sockets_priv.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
* Author: Joel Cunningham <[email protected]>
3535
*
3636
*/
37-
#ifndef LWIP_HDR_SOCKETS_PRIV_H
38-
#define LWIP_HDR_SOCKETS_PRIV_H
37+
#ifndef NF_LWIP_HDR_SOCKETS_PRIV_H
38+
#define NF_LWIP_HDR_SOCKETS_PRIV_H
3939

4040
#include "lwip/opt.h"
4141

@@ -179,4 +179,4 @@ struct lwip_select_cb {
179179

180180
#endif /* LWIP_SOCKET */
181181

182-
#endif /* LWIP_HDR_SOCKETS_PRIV_H */
182+
#endif /* NF_LWIP_HDR_SOCKETS_PRIV_H */

0 commit comments

Comments
 (0)