Text section exceeds available space in board

Hi after put my code in arduino ide it shows the output

Sketch uses 77908 bytes (241%) of program storage space. Maximum is 32256 bytes.
Global variables use 845 bytes (41%) of dynamic memory, leaving 1203 bytes for local variables. Maximum is 2048 bytes.
Sketch too big; see https://support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing it.
text section exceeds available space in board

Compilation error: text section exceeds available space in board

the code

#include <TFT_eSPI.h>
#include <Multichannel_Gas_GMXXX.h>
#include <Wire.h>
GAS_GMXXX<TwoWire> gas;

TFT_eSPI tft; 
// Stock font and GFXFF reference handle
TFT_eSprite spr = TFT_eSprite(&tft);  // Sprite 

void setup() {
  // put your setup code here, to run once:
  tft.begin();
  tft.setRotation(3);
  spr.createSprite(tft.width(),tft.height()); 
  gas.begin(Wire, 0x08); // use the hardware I2C
}

void loop() {
  // put your main code here, to run repeatedly:
  int val;
  spr.fillSprite(TFT_BLACK);
  spr.setFreeFont(&FreeSansBoldOblique18pt7b); 
  spr.setTextColor(TFT_BLUE);
  spr.drawString("Gas Terminal", 60 - 15, 10 , 1);// Print the test text in the custom font
  for(int8_t line_index = 0;line_index < 5 ; line_index++)
  {
    spr.drawLine(0, 50 + line_index, tft.width(), 50 + line_index, TFT_GREEN);
  }
  
  spr.setFreeFont(&FreeSansBoldOblique9pt7b);                 // Select the font
  // GM102B NO2 sensor
  val = gas.getGM102B();
  if (val > 999) val = 999;
  spr.setTextColor(TFT_WHITE);
  spr.drawString("NO2:", 60 - 24, 100 -24 , 1);// Print the test text in the custom font
  spr.drawRoundRect(60 - 24,100,80,40,5,TFT_WHITE); 
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(val,60 - 20,100+10,1);
  spr.setTextColor(TFT_GREEN);
  // GM302B C2H5CH sensor
  val = gas.getGM302B();
  if (val > 999) val = 999;
  spr.setTextColor(TFT_WHITE);
  spr.drawString("C2H5CH:", 230 -24 , 100 - 24 , 1);// Print the test text in the custom font
  spr.drawRoundRect(230 - 24,100,80,40,5,TFT_WHITE);
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(val,230 - 20,100+10,1);
  spr.setTextColor(TFT_GREEN);
  // GM502B VOC sensor
  val = gas.getGM502B();
  if (val > 999) val = 999;
  spr.setTextColor(TFT_WHITE);
  spr.drawString("VOC:", 60 - 24, 180 -24 , 1);// Print the test text in the custom font
  spr.drawRoundRect(60 - 24,180,80,40,5,TFT_WHITE);
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(val,60 - 20,180+10,1);
  spr.setTextColor(TFT_GREEN);
  // GM702B CO sensor
  val = gas.getGM702B();
  if (val > 999) val = 999;
  spr.setTextColor(TFT_WHITE);
  spr.drawString("CO:", 230 -24 , 180 - 24, 1);// Print the test text in the custom font
  spr.drawRoundRect(230 - 24 ,180,80,40,5,TFT_WHITE);
  spr.setTextColor(TFT_WHITE);
  spr.drawNumber(val ,230 - 20 ,180+10,1);
  spr.setTextColor(TFT_GREEN);
  
  spr.pushSprite(0, 0);
  delay(100);

}

Your sketch as shown does not compile. Perhaps parts of it were lost since you did not enclose it with the <CODE/> tool.

#include <TFT_eSPI.h>
#include <Multichannel_Gas_GMXXX.h>
#include <Wire.h>
GAS_GMXXX gas;

TFT_eSPI tft;
// Stock font and GFXFF reference handle
TFT_eSprite spr = TFT_eSprite(&tft); // Sprite

void setup() {
   // put your setup code here, to run once:
   tft.begin();
   tft.setRotation(3);
   spr.createSprite(tft.width(),tft.height());
   gas.begin(Wire, 0x08); // use the hardware I2C
}

void loop() {
   // put your main code here, to run repeatedly:
   int val;
   spr.fillSprite(TFT_BLACK);
   spr.setFreeFont(&FreeSansBoldOblique18pt7b);
   spr.setTextColor(TFT_BLUE);
   spr.drawString("Gas Terminal", 60 - 15, 10 , 1);// Print the test text in the custom font
   for(int8_t line_index = 0;line_index < 5 ; line_index++)
   {
      spr.drawLine(0, 50 + line_index, tft.width(), 50 + line_index, TFT_GREEN);
   }

   spr.setFreeFont(&FreeSansBoldOblique9pt7b); // Select the font
   // GM102B NO2 sensor
   val = gas.getGM102B();
   if (val > 999) val = 999;
   spr.setTextColor(TFT_WHITE);
   spr.drawString("NO2:", 60 - 24, 100 -24 , 1);// Print the test text in the custom font
   spr.drawRoundRect(60 - 24,100,80,40,5,TFT_WHITE);
   spr.setTextColor(TFT_WHITE);
   spr.drawNumber(val,60 - 20,100+10,1);
   spr.setTextColor(TFT_GREEN);
   // GM302B C2H5CH sensor
   val = gas.getGM302B();
   if (val > 999) val = 999;
   spr.setTextColor(TFT_WHITE);
   spr.drawString("C2H5CH:", 230 -24 , 100 - 24 , 1);// Print the test text in the custom font
   spr.drawRoundRect(230 - 24,100,80,40,5,TFT_WHITE);
   spr.setTextColor(TFT_WHITE);
   spr.drawNumber(val,230 - 20,100+10,1);
   spr.setTextColor(TFT_GREEN);
   // GM502B VOC sensor
   val = gas.getGM502B();
   if (val > 999) val = 999;
   spr.setTextColor(TFT_WHITE);
   spr.drawString("VOC:", 60 - 24, 180 -24 , 1);// Print the test text in the custom font
   spr.drawRoundRect(60 - 24,180,80,40,5,TFT_WHITE);
   spr.setTextColor(TFT_WHITE);
   spr.drawNumber(val,60 - 20,180+10,1);
   spr.setTextColor(TFT_GREEN);
   // GM702B CO sensor
   val = gas.getGM702B();
   if (val > 999) val = 999;
   spr.setTextColor(TFT_WHITE);
   spr.drawString("CO:", 230 -24 , 180 - 24, 1);// Print the test text in the custom font
   spr.drawRoundRect(230 - 24 ,180,80,40,5,TFT_WHITE);
   spr.setTextColor(TFT_WHITE);
   spr.drawNumber(val ,230 - 20 ,180+10,1);
   spr.setTextColor(TFT_GREEN);

   spr.pushSprite(0, 0);
   delay(100);

}

arduino-cli compile -b arduino:avr:uno --warnings all --output-dir /home/me/tmp --no-color (in directory: /home/me/Documents/sketchbook/Uno_R3/test)
In file included from /home/me/Documents/sketchbook/Uno_R3/test/test.ino:1:0:
/home/me/Documents/sketchbook/libraries/TFT_eSPI/TFT_eSPI.h:973:8: warning: #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available! [-Wcpp]
       #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available!
        ^~~~~~~
/home/me/Documents/sketchbook/Uno_R3/test/test.ino:4:1: error: invalid use of template-name 'GAS_GMXXX' without an argument list
 GAS_GMXXX gas;
 ^~~~~~~~~
/home/me/Documents/sketchbook/Uno_R3/test/test.ino:4:1: note: class template argument deduction is only available with -std=c++1z or -std=gnu++1z
In file included from /home/me/Documents/sketchbook/Uno_R3/test/test.ino:2:0:
/home/me/Documents/sketchbook/libraries/Seeed_Arduino_MultiGas/src/Multichannel_Gas_GMXXX.h:55:7: note: 'template<class T> class GAS_GMXXX' declared here
 class GAS_GMXXX {
       ^~~~~~~~~
/home/me/Documents/sketchbook/Uno_R3/test/test.ino: In function 'void setup()':
/home/me/Documents/sketchbook/Uno_R3/test/test.ino:15:1: error: 'gas' was not declared in this scope
 gas.begin(Wire, 0x08); // use the hardware I2C
 ^~~
/home/me/Documents/sketchbook/Uno_R3/test/test.ino: In function 'void loop()':
/home/me/Documents/sketchbook/Uno_R3/test/test.ino:32:7: error: 'gas' was not declared in this scope
 val = gas.getGM102B();
       ^~~
Used library           Version Path
TFT_eSPI               2.5.43  /home/me/Documents/sketchbook/libraries/TFT_eSPI
SPI                    1.0     /home/me/.arduino15/packages/arduino/hardware/avr/1.8.3/libraries/SPI
Seeed Arduino MultiGas 1.0.1   /home/me/Documents/sketchbook/libraries/Seeed_Arduino_MultiGas
Wire                   1.0     /home/me/.arduino15/packages/arduino/hardware/avr/1.8.3/libraries/Wire
Used platform Version Path
arduino:avr   1.8.3   /home/me/.arduino15/packages/arduino/hardware/avr/1.8.3
Error during build: exit status 1
Compilation failed.

I've fixed your code tags; thanks for trying. Code tags are three backticks on their own line ( ``` ); one before the code, one after the code.


Maximum is 32256 bytes. and Maximum is 2048 bytes. indicate that your compiling for an 328P processor (boards like Uno and Nano).

Why do you try to use #include <TFT_eSPI.h> which sounds like it's meant for an ESP board?

And you have suitably edited the User_Setup.h file in the TFT_eSPI library to remove all the fonts that your sketch is not using? Using that library on an Uno R3 (which is what I assume you are using since you haven't said) could be a challenge.

I see hardky any text in your sketch....
If you share the text we could see if has large duplicate sections...
Otherwise you could put the text on a SD card. But the SD card library is rather heavy on UNO....
Maybe better to move to ESP32 like board.
Some are for sale for less than 10 Euro...

The compiler simply indicates the programme code with 'text section'.

The only Multichannel_Gas_GMXXX.h library I could find is for MBed systems. And the TFTP_eSPI I could find says it's for ESP and rp2040 boards.

So it looks like you're trying to compile a sketch/application designed for a more powerful board, on an Uno. That's not going to work.