I was having a nasty error when adding W5500 for ESP32S2:


board/esp32s2_w5500.c: In function 'up_enable':
board/esp32s2_w5500.c:139:13: warning: implicit declaration of function 'ESP32S2_PIN2IRQ'; did you mean 'ESP32S2_PERIPH2IRQ'? [-Wimplicit-function-declaration]
  139 |   int irq = ESP32S2_PIN2IRQ(GPIO_W5500_INTR);
      |             ^~~~~~~~~~~~~~~
      |             ESP32S2_PERIPH2IRQ
board/esp32s2_w5500.c:135:13: note: declared here
  135 | static void up_enable(const struct w5500_lower_s *lower, bool enable)



After spend much time trying to fix it I looked the esp32s2_gpio.c and decided to follow the same header files order, then it worked:

#include <nuttx/config.h>

#include <sys/types.h>
#include <syslog.h>
#include <assert.h>
#include <debug.h>

#include <nuttx/irq.h>
#include <arch/irq.h>

#include <nuttx/spi/spi.h>
#include <nuttx/net/w5500.h>
#include <nuttx/ioexpander/gpio.h>

#include <arch/board/board.h>

#include "esp32s2-saola-1.h"
#include "esp32s2_spi.h"
#include "esp32s2_gpio.h"
#include "hardware/esp32s2_gpio_sigmap.h"