Build environment: macOS
Moddable SDK version: 7.0.0
Target device: Moddable Three
Description
Including $(MODDABLE)/modules/io/manifest.json in a project targeting any ESP8266 board whose display format is not RGB565LE (e.g. Moddable Three, which uses Gray256) produces a linker error for the undefined symbol modSPITxSwap16.
Steps to Reproduce
- Create a project whose manifest.json includes $(MODDABLE)/modules/io/manifest.json
- Build for esp8266/moddable_three:
mcconfig -d -m -p esp8266/moddable_three
- See linker error:
modules/io/spi/esp/spi.c: undefined reference to `modSPITxSwap16'
collect2: error: ld returned 1 exit status
Expected behavior
The project links and flashes successfully.
Images
N/A
Other information
modules/io/spi/esp/spi.c calls modSPITxSwap16 unconditionally when spi->transform is set. However, in modules/pins/spi/esp/modSPI.c the function is only compiled when kCommodettoBitmapFormat == kCommodettoBitmapRGB565LE. On Moddable Three the format is Gray256, so the symbol is never emitted and the link fails.
Suggested fix — guard the call in spi.c with the same #if already used in modSPI.c, falling through to the plain modSPITx on non-RGB565LE targets:
// modules/io/spi/esp/spi.c xs_spi_write
#if kCommodettoBitmapFormat == kCommodettoBitmapRGB565LE
if (spi->transform)
modSPITxSwap16(&spi->config, (uint8_t *)data, (uint16_t)count);
else
#endif
modSPITx(&spi->config, (uint8_t *)data, (uint16_t)count);
Build environment: macOS
Moddable SDK version: 7.0.0
Target device: Moddable Three
Description
Including $(MODDABLE)/modules/io/manifest.json in a project targeting any ESP8266 board whose display format is not RGB565LE (e.g. Moddable Three, which uses Gray256) produces a linker error for the undefined symbol
modSPITxSwap16.Steps to Reproduce
mcconfig -d -m -p esp8266/moddable_threeExpected behavior
The project links and flashes successfully.
Images
N/A
Other information
modules/io/spi/esp/spi.ccallsmodSPITxSwap16unconditionally when spi->transform is set. However, inmodules/pins/spi/esp/modSPI.cthe function is only compiled whenkCommodettoBitmapFormat == kCommodettoBitmapRGB565LE. On Moddable Three the format isGray256, so the symbol is never emitted and the link fails.Suggested fix — guard the call in spi.c with the same #if already used in modSPI.c, falling through to the plain modSPITx on non-RGB565LE targets: