From 070f2b3a14aebb164b20c1462b0f599a6c075702 Mon Sep 17 00:00:00 2001 From: Markus Sattler Date: Sat, 9 May 2015 16:19:32 +0200 Subject: [PATCH 1/3] many speed optimizations in Adafruit_ILI9341 lib (3x times faster) add new SPI function: void write(uint8_t data); void write16(uint16_t data); void write16(uint16_t data, bool msb); void writeBytes(uint8_t * data, uint32_t size); void writePattern(uint8_t * data, uint8_t size, uint32_t repeat); Adafruit_ILI9341: | Benchmark | Old (ms) | New (ms) | Speedup | | ------------------------- | -------- | -------- | ----------- | | Screen fill | 1248369 | 278707 | +347,91% | | Text | 86102 | 53785 | +60,09% | | Lines | 825400 | 536374 | +53,89% | | Horiz/Vert Lines | 101875 | 24653 | +313,24% | | Rectangles (outline) | 65720 | 17295 | +279,99% | | Rectangles (filled) | 2592250 | 579157 | +347,59% | | Circles (filled) | 411475 | 179454 | +129,29% | | Circles (outline) | 360002 | 233584 | +54,12% | | Triangles (outline) | 261772 | 170118 | +53,88% | | Triangles (filled) | 866951 | 246237 | +252,08% | | Rounded rects (outline) | 154131 | 81570 | +88,96% | | Rounded rects (filled) | 2828112 | 660983 | +327,86% | | | | | | | Total | 9802159 | 3061917 | +220,13% | --- libraries/SPI/SPI.cpp | 122 ++++++++++++++++++++++++++++++++++++++++-- libraries/SPI/SPI.h | 10 ++++ 2 files changed, 128 insertions(+), 4 deletions(-) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index d9f9ea1eb..6b3d29784 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -36,6 +36,7 @@ typedef union { SPIClass SPI; SPIClass::SPIClass() { + useHwCs = false; } void SPIClass::begin() { @@ -54,9 +55,26 @@ void SPIClass::end() { pinMode(SCK, INPUT); pinMode(MISO, INPUT); pinMode(MOSI, INPUT); + if(useHwCs) { + pinMode(SS, INPUT); + } +} + +void SPIClass::setHwCs(bool use) { + if(use) { + pinMode(SS, SPECIAL); ///< GPIO15 + SPI1U |= (SPIUCSSETUP | SPIUCSHOLD); + } else { + if(useHwCs) { + pinMode(SS, INPUT); + SPI1U &= ~(SPIUCSSETUP | SPIUCSHOLD); + } + } + useHwCs = use; } void SPIClass::beginTransaction(SPISettings settings) { + while(SPI1CMD & SPIBUSY) {} setFrequency(settings._clock); setBitOrder(settings._bitOrder); setDataMode(settings._dataMode); @@ -199,12 +217,10 @@ void SPIClass::setClockDivider(uint32_t clockDiv) { } uint8_t SPIClass::transfer(uint8_t data) { - while(SPI1CMD & SPIBUSY) - ; + while(SPI1CMD & SPIBUSY) {} SPI1W0 = data; SPI1CMD |= SPIBUSY; - while(SPI1CMD & SPIBUSY) - ; + while(SPI1CMD & SPIBUSY) {} return (uint8_t) (SPI1W0 & 0xff); } @@ -230,3 +246,101 @@ uint16_t SPIClass::transfer16(uint16_t data) { return out.val; } +void SPIClass::write(uint8_t data) { + while(SPI1CMD & SPIBUSY) {} + SPI1W0 = data; + SPI1CMD |= SPIBUSY; + while(SPI1CMD & SPIBUSY) {} +} + +void SPIClass::write16(uint16_t data) { + write16(data, (SPI1C & (SPICWBO | SPICRBO))); +} + +void SPIClass::write16(uint16_t data, bool msb) { + while(SPI1CMD & SPIBUSY) {} + // Set to 16Bits transfer + SPI1U1 = (SPI1U1 & ~((SPIMMOSI << SPILMOSI))) | ((16 - 1) << SPILMOSI); + if(msb) { + // MSBFIRST Byte first + SPI1W0 = (data >> 8) | (data << 8); + SPI1CMD |= SPIBUSY; + } else { + // LSBFIRST Byte first + SPI1W0 = data; + SPI1CMD |= SPIBUSY; + } + while(SPI1CMD & SPIBUSY) {} + // reset to 8Bit mode + SPI1U1 = (SPI1U1 & ~((SPIMMOSI << SPILMOSI))) | ((8 - 1) << SPILMOSI); +} + +void SPIClass::writeBytes(uint8_t * data, uint32_t size) { + while(size) { + if(size > 64) { + writeBytes_(data, 64); + size -= 64; + data += 64; + } else { + writeBytes_(data, size); + size = 0; + } + } +} + +void SPIClass::writeBytes_(uint8_t * data, uint8_t size) { + while(SPI1CMD & SPIBUSY) {} + // Set Bits to transfer + SPI1U1 = (SPI1U1 & ~((SPIMMOSI << SPILMOSI))) | ((size * 8 - 1) << SPILMOSI); + + volatile uint32_t * fifoPtr = &SPI1W0; + uint32_t * dataPtr = (uint32_t*) data; + uint8_t dataSize = ((size + 3) / 4); + + while(dataSize--) { + *fifoPtr = *dataPtr; + dataPtr++; + fifoPtr++; + } + + SPI1CMD |= SPIBUSY; + while(SPI1CMD & SPIBUSY) {} + // reset to 8Bit mode + SPI1U1 = (SPI1U1 & ~((SPIMMOSI << SPILMOSI))) | ((8 - 1) << SPILMOSI); +} + +void SPIClass::writePattern(uint8_t * data, uint8_t size, uint32_t repeat) { + if(size > 64) return; //max Hardware FIFO + + uint32_t byte = (size * repeat); + uint8_t r = (64 / size); + + while(byte) { + if(byte > 64) { + writePattern_(data, size, r); + byte -= 64; + } else { + writePattern_(data, size, (byte / size)); + byte = 0; + } + } +} + +void SPIClass::writePattern_(uint8_t * data, uint8_t size, uint8_t repeat) { + uint8_t bytes = (size * repeat); + uint8_t buffer[64]; + uint8_t * bufferPtr = &buffer[0]; + uint8_t * dataPtr; + uint8_t dataSize = bytes; + for(uint8_t i = 0; i < repeat; i++) { + dataSize = size; + dataPtr = data; + while(dataSize--) { + *bufferPtr = *dataPtr; + dataPtr++; + bufferPtr++; + } + } + + writeBytes(&buffer[0], bytes); +} diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index 3a37c52e1..1030eeaa9 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -64,6 +64,7 @@ public: SPIClass(); void begin(); void end(); + void setHwCs(bool use); void setBitOrder(uint8_t bitOrder); void setDataMode(uint8_t dataMode); void setFrequency(uint32_t freq); @@ -71,7 +72,16 @@ public: void beginTransaction(SPISettings settings); uint8_t transfer(uint8_t data); uint16_t transfer16(uint16_t data); + void write(uint8_t data); + void write16(uint16_t data); + void write16(uint16_t data, bool msb); + void writeBytes(uint8_t * data, uint32_t size); + void writePattern(uint8_t * data, uint8_t size, uint32_t repeat); void endTransaction(void); +private: + bool useHwCs; + void writeBytes_(uint8_t * data, uint8_t size); + void writePattern_(uint8_t * data, uint8_t size, uint8_t repeat); }; extern SPIClass SPI; From 27f45a205abfb9efb28df419bf85b00e71e1e6d8 Mon Sep 17 00:00:00 2001 From: Markus Sattler Date: Sun, 10 May 2015 17:34:16 +0200 Subject: [PATCH 2/3] SD: - optimize SPI usage 148% write speed (24kB/s -> 37kB/s) and 127% read speed (121kB/s -> 155kB/s) at 8MHz - add clock frequency as parameter for begin(csPin, frequency) - SD @80MHz write: 84kB/s read: 231kB/s SPI add functions: - void write32(uint32_t data); - void write32(uint32_t data, bool msb); - void transferBytes(uint8_t * out, uint8_t * in, uint32_t size); Adafruit_ILI9341: - code clean --- libraries/SD/src/SD.cpp | 12 +--- libraries/SD/src/SD.h | 4 +- libraries/SD/src/utility/Sd2Card.cpp | 36 +++++++++- libraries/SPI/SPI.cpp | 98 ++++++++++++++++++++++++++-- libraries/SPI/SPI.h | 5 ++ 5 files changed, 135 insertions(+), 20 deletions(-) diff --git a/libraries/SD/src/SD.cpp b/libraries/SD/src/SD.cpp index 65d32741c..d426dbe8e 100644 --- a/libraries/SD/src/SD.cpp +++ b/libraries/SD/src/SD.cpp @@ -326,13 +326,7 @@ boolean callback_rmdir(SdFile& parentDir, char *filePathComponent, return true; } - - -/* Implementation of class used to create `SDCard` object. */ - - - -boolean SDClass::begin(uint8_t csPin) { +boolean SDClass::begin(uint8_t csPin, uint32_t sckRateID) { /* Performs the initialisation required by the sdfatlib library. @@ -340,13 +334,11 @@ boolean SDClass::begin(uint8_t csPin) { Return true if initialization succeeds, false otherwise. */ - return card.init(SPI_HALF_SPEED, csPin) && + return card.init(sckRateID, csPin) && volume.init(card) && root.openRoot(volume); } - - // this little helper is used to traverse paths SdFile SDClass::getParentDir(const char *filepath, int *index) { // get parent directory diff --git a/libraries/SD/src/SD.h b/libraries/SD/src/SD.h index 7435cf577..e229cf8ad 100644 --- a/libraries/SD/src/SD.h +++ b/libraries/SD/src/SD.h @@ -65,8 +65,8 @@ private: public: // This needs to be called to set up the connection to the SD card // before other methods are used. - boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN); - + boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN, uint32_t sckRateID = SPI_FULL_SPEED); + // Open the specified file/directory with the supplied mode (e.g. read or // write, etc). Returns a File object for interacting with the file. // Note that currently only one file can be open at a time. diff --git a/libraries/SD/src/utility/Sd2Card.cpp b/libraries/SD/src/utility/Sd2Card.cpp index 98a02ba42..2d7618d65 100644 --- a/libraries/SD/src/utility/Sd2Card.cpp +++ b/libraries/SD/src/utility/Sd2Card.cpp @@ -33,9 +33,13 @@ static void spiSend(uint8_t b) { SPDR = b; while (!(SPSR & (1 << SPIF))) ; +#else +#ifdef ESP8266 + SPI.write(b); #else SPI.transfer(b); #endif +#endif } /** Receive a byte from the card */ static uint8_t spiRec(void) { @@ -116,8 +120,14 @@ uint8_t Sd2Card::cardCommand(uint8_t cmd, uint32_t arg) { // send command spiSend(cmd | 0x40); +#ifdef ESP8266 + // send argument + SPI.write32(arg, true); +#else // send argument for (int8_t s = 24; s >= 0; s -= 8) spiSend(arg >> s); +#endif + // send CRC uint8_t crc = 0xFF; @@ -424,7 +434,14 @@ uint8_t Sd2Card::readData(uint32_t block, dst[n] = SPDR; #else // OPTIMIZE_HARDWARE_SPI +#ifdef ESP8266 + // skip data before offset + SPI.transferBytes(NULL, NULL, offset_); + // transfer data + SPI.transferBytes(NULL, dst, count); + +#else // skip data before offset for (;offset_ < offset; offset_++) { spiRec(); @@ -433,6 +450,7 @@ uint8_t Sd2Card::readData(uint32_t block, for (uint16_t i = 0; i < count; i++) { dst[i] = spiRec(); } +#endif #endif // OPTIMIZE_HARDWARE_SPI offset_ += count; @@ -463,7 +481,11 @@ void Sd2Card::readEnd(void) { while (!(SPSR & (1 << SPIF))) ; #else // OPTIMIZE_HARDWARE_SPI +#ifdef ESP8266 + SPI.transferBytes(NULL, NULL, (514-offset_)); +#else while (offset_++ < 514) spiRec(); +#endif #endif // OPTIMIZE_HARDWARE_SPI chipSelectHigh(); inBlock_ = 0; @@ -479,7 +501,11 @@ uint8_t Sd2Card::readRegister(uint8_t cmd, void* buf) { } if (!waitStartBlock()) goto fail; // transfer data +#ifdef ESP8266 + SPI.transferBytes(NULL, dst, 16); +#else for (uint16_t i = 0; i < 16; i++) dst[i] = spiRec(); +#endif spiRec(); // get first crc byte spiRec(); // get second crc byte chipSelectHigh(); @@ -646,13 +672,21 @@ uint8_t Sd2Card::writeData(uint8_t token, const uint8_t* src) { #else // OPTIMIZE_HARDWARE_SPI spiSend(token); +#ifdef ESP8266 + // send argument + SPI.writeBytes((uint8_t *)src, 512); +#else for (uint16_t i = 0; i < 512; i++) { spiSend(src[i]); } +#endif #endif // OPTIMIZE_HARDWARE_SPI +#ifdef ESP8266 + SPI.write16(0xFFFF, true); +#else spiSend(0xff); // dummy crc spiSend(0xff); // dummy crc - +#endif status_ = spiRec(); if ((status_ & DATA_RES_MASK) != DATA_RES_ACCEPTED) { error(SD_CARD_ERROR_WRITE); diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 6b3d29784..be4627740 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -216,8 +216,16 @@ void SPIClass::setClockDivider(uint32_t clockDiv) { SPI1CLK = clockDiv; } +inline void SPIClass::setDataBits(uint16_t bits) { + const uint32_t mask = ~((SPIMMOSI << SPILMOSI) | (SPIMMISO << SPILMISO)); + bits--; + SPI1U1 = ((SPI1U1 & mask) | ((bits << SPILMOSI) | (bits << SPILMISO))); +} + uint8_t SPIClass::transfer(uint8_t data) { while(SPI1CMD & SPIBUSY) {} + // reset to 8Bit mode + setDataBits(8); SPI1W0 = data; SPI1CMD |= SPIBUSY; while(SPI1CMD & SPIBUSY) {} @@ -248,19 +256,21 @@ uint16_t SPIClass::transfer16(uint16_t data) { void SPIClass::write(uint8_t data) { while(SPI1CMD & SPIBUSY) {} + // reset to 8Bit mode + setDataBits(8); SPI1W0 = data; SPI1CMD |= SPIBUSY; while(SPI1CMD & SPIBUSY) {} } void SPIClass::write16(uint16_t data) { - write16(data, (SPI1C & (SPICWBO | SPICRBO))); + write16(data, !(SPI1C & (SPICWBO | SPICRBO))); } void SPIClass::write16(uint16_t data, bool msb) { while(SPI1CMD & SPIBUSY) {} // Set to 16Bits transfer - SPI1U1 = (SPI1U1 & ~((SPIMMOSI << SPILMOSI))) | ((16 - 1) << SPILMOSI); + setDataBits(16); if(msb) { // MSBFIRST Byte first SPI1W0 = (data >> 8) | (data << 8); @@ -271,8 +281,31 @@ void SPIClass::write16(uint16_t data, bool msb) { SPI1CMD |= SPIBUSY; } while(SPI1CMD & SPIBUSY) {} - // reset to 8Bit mode - SPI1U1 = (SPI1U1 & ~((SPIMMOSI << SPILMOSI))) | ((8 - 1) << SPILMOSI); +} + +void SPIClass::write32(uint32_t data) { + write32(data, !(SPI1C & (SPICWBO | SPICRBO))); +} + +void SPIClass::write32(uint32_t data, bool msb) { + while(SPI1CMD & SPIBUSY) {} + // Set to 32Bits transfer + setDataBits(32); + if(msb) { + union { + uint32_t l; + uint8_t b[4]; + } data_; + data_.l = data; + // MSBFIRST Byte first + SPI1W0 = (data_.b[3] | (data_.b[2] << 8) | (data_.b[1] << 16) | (data_.b[0] << 24)); + SPI1CMD |= SPIBUSY; + } else { + // LSBFIRST Byte first + SPI1W0 = data; + SPI1CMD |= SPIBUSY; + } + while(SPI1CMD & SPIBUSY) {} } void SPIClass::writeBytes(uint8_t * data, uint32_t size) { @@ -291,7 +324,7 @@ void SPIClass::writeBytes(uint8_t * data, uint32_t size) { void SPIClass::writeBytes_(uint8_t * data, uint8_t size) { while(SPI1CMD & SPIBUSY) {} // Set Bits to transfer - SPI1U1 = (SPI1U1 & ~((SPIMMOSI << SPILMOSI))) | ((size * 8 - 1) << SPILMOSI); + setDataBits(size * 8); volatile uint32_t * fifoPtr = &SPI1W0; uint32_t * dataPtr = (uint32_t*) data; @@ -305,8 +338,6 @@ void SPIClass::writeBytes_(uint8_t * data, uint8_t size) { SPI1CMD |= SPIBUSY; while(SPI1CMD & SPIBUSY) {} - // reset to 8Bit mode - SPI1U1 = (SPI1U1 & ~((SPIMMOSI << SPILMOSI))) | ((8 - 1) << SPILMOSI); } void SPIClass::writePattern(uint8_t * data, uint8_t size, uint32_t repeat) { @@ -344,3 +375,56 @@ void SPIClass::writePattern_(uint8_t * data, uint8_t size, uint8_t repeat) { writeBytes(&buffer[0], bytes); } + +void SPIClass::transferBytes(uint8_t * out, uint8_t * in, uint32_t size) { + while(size) { + if(size > 64) { + transferBytes_(out, in, 64); + size -= 64; + if(out) out += 64; + if(in) in += 64; + } else { + transferBytes_(out, in, size); + size = 0; + } + } +} + +void SPIClass::transferBytes_(uint8_t * out, uint8_t * in, uint8_t size) { + while(SPI1CMD & SPIBUSY) {} + // Set in/out Bits to transfer + + setDataBits(size * 8); + + volatile uint32_t * fifoPtr = &SPI1W0; + uint8_t dataSize = ((size + 3) / 4); + + if(out) { + uint32_t * dataPtr = (uint32_t*) out; + while(dataSize--) { + *fifoPtr = *dataPtr; + dataPtr++; + fifoPtr++; + } + } else { + // no out data only read fill with dummy data! + while(dataSize--) { + *fifoPtr = 0xFFFFFFFF; + fifoPtr++; + } + } + + SPI1CMD |= SPIBUSY; + while(SPI1CMD & SPIBUSY) {} + + if(in) { + volatile uint8_t * fifoPtr8 = (volatile uint8_t *) &SPI1W0; + dataSize = size; + while(dataSize--) { + *in = *fifoPtr8; + in++; + fifoPtr8++; + } + } +} + diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index 1030eeaa9..e67b5b0d5 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -75,13 +75,18 @@ public: void write(uint8_t data); void write16(uint16_t data); void write16(uint16_t data, bool msb); + void write32(uint32_t data); + void write32(uint32_t data, bool msb); void writeBytes(uint8_t * data, uint32_t size); void writePattern(uint8_t * data, uint8_t size, uint32_t repeat); + void transferBytes(uint8_t * out, uint8_t * in, uint32_t size); void endTransaction(void); private: bool useHwCs; void writeBytes_(uint8_t * data, uint8_t size); void writePattern_(uint8_t * data, uint8_t size, uint8_t repeat); + void transferBytes_(uint8_t * out, uint8_t * in, uint8_t size); + inline void setDataBits(uint16_t bits); }; extern SPIClass SPI; From c31d99eabdaae94421e230f9dfe26700f2c12b24 Mon Sep 17 00:00:00 2001 From: Markus Sattler Date: Mon, 11 May 2015 19:10:32 +0200 Subject: [PATCH 3/3] remove libc still not working! ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-exit.o):(.literal+0x4): undefined reference to `_exit' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-exit.o): In function `exit': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/exit.c:65: undefined reference to `_exit' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-fopen.o):(.literal+0x0): undefined reference to `_open_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-fopen.o): In function `_fopen_r': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdio/../../../../../newlib/libc/stdio/fopen.c:141: undefined reference to `_open_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-freer.o):(.literal+0x14): undefined reference to `_sbrk_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-freer.o): In function `_malloc_trim_r': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:3325: undefined reference to `_sbrk_r' d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:3332: undefined reference to `_sbrk_r' d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:3340: undefined reference to `_sbrk_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-fseeko.o):(.literal+0x10): undefined reference to `_fstat_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-fseeko.o): In function `_fseeko_r': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdio/../../../../../newlib/libc/stdio/fseeko.c:231: undefined reference to `_fstat_r' d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdio/../../../../../newlib/libc/stdio/fseeko.c:258: undefined reference to `_fstat_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-makebuf.o): In function `__smakebuf_r': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdio/../../../../../newlib/libc/stdio/makebuf.c:59: undefined reference to `_fstat_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-mallocr.o): In function `malloc_extend_top': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:2165: undefined reference to `_sbrk_r' d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdlib/../../../../../newlib/libc/stdlib/mallocr.c:2202: undefined reference to `_sbrk_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-stdio.o):(.literal+0x4): undefined reference to `_read_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-stdio.o):(.literal+0x8): undefined reference to `_lseek_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-stdio.o):(.literal+0xc): undefined reference to `_write_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-stdio.o):(.literal+0x10): undefined reference to `_close_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-stdio.o): In function `__sread': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdio/../../../../../newlib/libc/stdio/stdio.c:48: undefined reference to `_read_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-stdio.o): In function `__swrite': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdio/../../../../../newlib/libc/stdio/stdio.c:89: undefined reference to `_lseek_r' d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdio/../../../../../newlib/libc/stdio/stdio.c:97: undefined reference to `_write_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-stdio.o): In function `__sseek': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdio/../../../../../newlib/libc/stdio/stdio.c:117: undefined reference to `_lseek_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-stdio.o): In function `__sclose': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\stdio/../../../../../newlib/libc/stdio/stdio.c:135: undefined reference to `_close_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-sysclose.o): In function `close': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\syscalls/../../../../../newlib/libc/syscalls/sysclose.c:10: undefined reference to `_close_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-time.o):(.literal+0x0): undefined reference to `_gettimeofday_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-time.o): In function `time': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\time/../../../../../newlib/libc/time/time.c:46: undefined reference to `_gettimeofday_r' ../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libc.a(isatty.o): In function `_isatty_r': d:\Neo\Project\ESP8266\DevKit\build\compiler\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libc\sys\xtensa/../../../../../../newlib/libc/sys/xtensa/isatty.c:13: undefined reference to `_fstat_r' collect2.exe: error: ld returned 1 exit status --- platform.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.txt b/platform.txt index ebeeadfd4..cd09aff98 100644 --- a/platform.txt +++ b/platform.txt @@ -23,7 +23,7 @@ compiler.S.flags=-c -g -x assembler-with-cpp -MMD compiler.c.elf.ldscript=eagle.app.v6.ld compiler.c.elf.flags=-nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{compiler.c.elf.ldscript}" compiler.c.elf.cmd=xtensa-lx106-elf-gcc -compiler.c.elf.libs=-lm -lc -lgcc -lhal -lphy -lnet80211 -llwip -lwpa -lmain -lpp -lsmartconfig +compiler.c.elf.libs=-lm -lgcc -lhal -lphy -lnet80211 -llwip -lwpa -lmain -lpp -lsmartconfig compiler.cpp.cmd=xtensa-lx106-elf-g++ compiler.cpp.flags=-c -Os -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -std=c++11 -MMD