Skip to content

VSPI_HOST (old IDY definition replaced by SPI3_HOST) error when building ethernet_test.c example #1509

@rmontrosecbw

Description

@rmontrosecbw

Build environment: Windows 11
Moddable SDK version: 5.8.0
Espressif SDK 5.4 and 5.4.1
Target device: Custom ESP32-S3-WROOM-2

Description
When building the "moddable\examples\network\ethernet\ethernet-test" sample, it will not compile, with VSPI_HOST' undeclared.

# cc ethernet.c.o
In file included from C:\Espressif5\frameworks\esp-idf-v5.4.1\components\esp_hw_support\include/esp_intr_alloc.h:12,
                 from C:\Espressif5\frameworks\esp-idf-v5.4.1\components\esp_hw_support\include/esp_cpu.h:20,
                 from C:\Espressif5\frameworks\esp-idf-v5.4.1\components\esp_hw_support\include/spinlock.h:11,
                 from C:\Espressif5\frameworks\esp-idf-v5.4.1\components\freertos\FreeRTOS-Kernel\portable\xtensa\include\freertos/portmacro.h:49,
                 from C:\Espressif5\frameworks\esp-idf-v5.4.1\components\freertos\FreeRTOS-Kernel\include/freertos/portable.h:57,
                 from C:\Espressif5\frameworks\esp-idf-v5.4.1\components\freertos\FreeRTOS-Kernel\include/freertos/FreeRTOS.h:69,
                 from C:\CBW\EdgeTech\moddable\xs\platforms\esp/xsHost.h:40,
                 from C:\CBW\EdgeTech\moddable\modules\network\ethernet\esp32\ethernet.c:23:
C:\CBW\EdgeTech\moddable\modules\network\ethernet\esp32\ethernet.c: In function 'init_spi':
C:\CBW\EdgeTech\moddable\build\tmp\esp32\edgetech\debug\ethernet-test/mc.defines.h:11:34: error: 'VSPI_HOST' undeclared (first use in this function); did you mean 'SPI3_HOST'?
   11 | #define MODDEF_ETHERNET_SPI_PORT VSPI_HOST
      |                                  ^~~~~~~~~
C:\Espressif5\frameworks\esp-idf-v5.4.1\components\esp_common\include/esp_err.h:109:30: note: in definition of macro 'ESP_ERROR_CHECK'
  109 |         esp_err_t err_rc_ = (x);                                        \
      |                              ^
C:\CBW\EdgeTech\moddable\modules\network\ethernet\esp32\ethernet.c:331:44: note: in expansion of macro 'MODDEF_ETHERNET_SPI_PORT'
  331 |         ESP_ERROR_CHECK(spi_bus_initialize(MODDEF_ETHERNET_SPI_PORT, &buscfg, 2));
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~
C:\CBW\EdgeTech\moddable\build\tmp\esp32\edgetech\debug\ethernet-test/mc.defines.h:11:34: note: each undeclared identifier is reported only once for each function it appears in
   11 | #define MODDEF_ETHERNET_SPI_PORT VSPI_HOST
      |                                  ^~~~~~~~~
C:\Espressif5\frameworks\esp-idf-v5.4.1\components\esp_common\include/esp_err.h:109:30: note: in definition of macro 'ESP_ERROR_CHECK'
  109 |         esp_err_t err_rc_ = (x);                                        \
      |                              ^
C:\CBW\EdgeTech\moddable\modules\network\ethernet\esp32\ethernet.c:331:44: note: in expansion of macro 'MODDEF_ETHERNET_SPI_PORT'
  331 |         ESP_ERROR_CHECK(spi_bus_initialize(MODDEF_ETHERNET_SPI_PORT, &buscfg, 2));
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\CBW\EdgeTech\moddable\modules\network\ethernet\esp32\ethernet.c:26:
C:\CBW\EdgeTech\moddable\modules\network\ethernet\esp32\ethernet.c: In function 'uninit_spi':
C:\CBW\EdgeTech\moddable\build\tmp\esp32\edgetech\debug\ethernet-test/mc.defines.h:11:34: error: 'VSPI_HOST' undeclared (first use in this function); did you mean 'SPI3_HOST'?
   11 | #define MODDEF_ETHERNET_SPI_PORT VSPI_HOST
      |                                  ^~~~~~~~~
C:\CBW\EdgeTech\moddable\modules\network\ethernet\esp32\ethernet.c:348:18: note: in expansion of macro 'MODDEF_ETHERNET_SPI_PORT'
  348 |     spi_bus_free(MODDEF_ETHERNET_SPI_PORT);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~

Steps to Reproduce

  1. Build and install the app using this build command: examples\network\ethernet\ethernet-test>mcconfig -d -m -p esp32

Other information
To resolve the problem insert after the #includes in moddable\modules\network\ethernet\esp32\ethernet.c and moddable\modules\network\ethernet\esp32\drivers\enc28j60\enc28j60_api.c

// ESP-IDF v5.x compatibility
#ifndef VSPI_HOST
#define VSPI_HOST SPI3_HOST
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions