Error compiling for board LOLIN(WEMOS) D1 R2 & mini(but not with example sketch)

Hi all,

I have a weird problem with my wemos D1 mini. If i try to upload the blink code from the example everything works fine, but whenever i try to upload some other code i get the "Error compiling for board" message.

It does compile for the uno board. Just not for the wemos board

Any idea why this is?

Added the error message in a text file since it will exceed the 9000 caracters

here the code borrowed from the internet:

#include <Wire.h>
#include <Adafruit_BMP085.h>
#include "U8glib.h"

// Connect VCC of the BMP085 sensor to 3.3V (NOT 5.0V!)
// Connect GND to Ground
// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5
// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4
// EOC is not used, it signifies an end of conversion
// XCLR is a reset pin, also not used here
Adafruit_BMP085 bmp;

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);  // Display which does not send AC
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);  // I2C / TWI
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);  // Display which does not send AC

float pressure = 0.0;
float tempC = 0.0;
float altitude = 0.0;
void BmpSensorRead(float* pressure, float* tempC, float* altitude);
void DisplayPresTemp(float* pressure, float* tempC, float* altitude);

void setup(void)
{
  Serial.begin(9600);

  // assign default color value
  if (u8g.getMode() == U8G_MODE_R3G3B2)
  {
    u8g.setColorIndex(255);     // white
  }
  else if (u8g.getMode() == U8G_MODE_GRAY2BIT)
  {
    u8g.setColorIndex(3);         // max intensity
  }
  else if (u8g.getMode() == U8G_MODE_BW)
  {
    u8g.setColorIndex(1);         // pixel on
  }
  else if (u8g.getMode() == U8G_MODE_HICOLOR)
  {
    u8g.setHiColorByRGB(255, 255, 255);
  }

  for (int a = 0; a < 30; a++)
  {
    u8g.firstPage();

    do
    {
      u8g.setFont(u8g_font_fub11);
      u8g.setFontRefHeightExtendedText();
      u8g.setDefaultForegroundColor();
      u8g.setFontPosTop();
      u8g.drawStr(4, a, "MAKER . PRO ");
    }
    while (u8g.nextPage());
  }

  delay(3000);

  if (!bmp.begin())
  {
    u8g.firstPage();

    do
    {
      u8g.setFont(u8g_font_fub11);
      u8g.setFontRefHeightExtendedText();
      u8g.setDefaultForegroundColor();
      u8g.setFontPosTop();
      u8g.drawStr(4, 0, "BMP085 Sensor");
      u8g.drawStr(4, 20, " ERROR!");
    }
    while (u8g.nextPage());

    Serial.println("BMP085 sensor, ERROR!");

    while (1) {}
  }
}
void loop(void)
{
  BmpSensorRead(&pressure, &tempC, &altitude);
  DisplayPresTemp(&pressure, &tempC, &altitude);
  delay(1000);
}
void DisplayPresTemp(float* pressure, float* tempC, float* altitude)
{
  u8g.firstPage();

  do
  {
    u8g.setFont(u8g_font_fub11);
    u8g.setFontRefHeightExtendedText();
    u8g.setDefaultForegroundColor();
    u8g.setFontPosTop();
    u8g.drawStr(2, 0, "Pressure");
    u8g.setPrintPos(75, 0);
    u8g.print(*pressure);
    u8g.drawStr(4, 20, "Temp C");
    u8g.setPrintPos(75, 20);
    u8g.print(*tempC);
    u8g.drawStr(4, 40, "Altitude");
    u8g.setPrintPos(75, 40);
    u8g.print(*altitude);
  }
  while (u8g.nextPage());
}
void BmpSensorRead(float* pressure, float* tempC, float* altitude)
{
  *tempC = bmp.readTemperature();
  Serial.print("Temperature = ");
  Serial.print(*tempC);
  Serial.println(" *C");

  *pressure = bmp.readPressure() / 100.0;
  Serial.print("Pressure = ");
  Serial.print(*pressure / 100.0);
  Serial.println(" hPa");

  // Calculate altitude assuming 'standard' barometric
  // pressure of 1013.25 millibar = 101325 Pascal
  *altitude = bmp.readAltitude();
  Serial.print("Altitude = ");
  Serial.print(*altitude);
  Serial.println(" meters");
}

However, it does not matter what code i use from the internet always the same error message

error.txt (624 KB)

tl,dr

c:/users/rode/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\Rode\AppData\Local\Temp\arduino_build_295542/sketch_jan02b.ino.elf section `.irom0.text' will not fit in region `irom0_0_seg'

collect2.exe: error: ld returned 1 exit status

what does tl,dr stand for?

"too long, didn't read"

ok, thank you for pointing out the error message.

I just narrowed it down.

It's a pity you chose not to show the "some other code".

I updated the starting post with the code i used

However, it does not matter what code i use from the internet always the same error message

Could that be a clue?

Not sure how that would be a problem.

It does compile for the uno board. Just not for the wemos board

The very first message I get is:

WARNING: library U8glib claims to run on avr, sam architecture(s) and 
may be incompatible with your current board which runs on esp8266 
architecture(s).

I suspect the problem is that the U8glib is not compatible with the ESP8266 processor.

Thank you this was indeed the case johnwasser

johnwasser:
The very first message I get is:

WARNING: library U8glib claims to run on avr, sam architecture(s) and 

may be incompatible with your current board which runs on esp8266
architecture(s).



I suspect the problem is that the U8glib is not compatible with the ESP8266 processor.

What is the source of the warning? I get it on a couple of libraries I use but I usually ignore it and the project compiles and runs just fine. I would like to fix the library, but I can't figure out how the compiler determines that the code is for an AVR only?

SteveMann:
I can't figure out how the compiler determines that the code is for an AVR only?

I'm going to guess it's the library.properties file:

name=U8glib
version=1.18
author=oliver olikraus@gmail.com
maintainer=oliver olikraus@gmail.com
sentence=A library for monochrome TFTs and OLEDs
paragraph=Supported display controller: SSD1306, SSD1309, SSD1322, SSD1325, SSD1327, SH1106, UC1601, UC1610, UC1611, UC1701, ST7565, ST7920, KS0108, LC7981, PCD8544, PCF8812, SBN1661, TLS8204, T6963.
category=Display
url=GitHub - olikraus/u8glib: Arduino Monochrom Graphics Library for LCDs and OLEDs
architectures=avr,sam

And, it's likely not the compiler issuing the warning but something earlier in the toolchain.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.