Sketch Too Big Error Attempting To Verify/compile Project – Arduino

Welcome to Tweaking4All … - Computer Tips and Tricks for everybody! Tweaking4All
  • Home
  • News
  • Pages
  • Forum
  • Info
  • Log in
  • Nederlands
Sketch too big error attempting to verify/compile project – – Arduino – Forum Search for: Search for: Page 1 of 1 Forum

Welcome to the Tweaking4All community forums! When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system. For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!

Forums Hardware Arduino sketch too big erro... Share: Notifications Clear all [Solved] sketch too big error attempting to verify/compile project Page 1 / 5 1 2 3 4 5 Next Arduino Last Post by tvr4 5 years ago 69 Posts 2 Users 0 Reactions 34.7 K Views RSS tvr4 (@tvr4) Estimable Member Joined: 6 years ago Posts: 122 Topic starter June 19, 2020 6:44 PM

I downloaded the code from the arduino project hub called GPS Data Logger, Real-Time Curve, Max Height and Max SpeedIt is found here: https://create.arduino.cc/projecthub/yv ... eed-575b16

I am using the code under sauvegarde SD

When I try to verify/compile the code I get the error message below. I have not modified the code, just pasted it into a new filein the arduino IDE

Any help is greatly appreciatedThanks

Verify/Compile Output------------------------------Arduino: 1.8.12 (Windows 10), Board: "Arduino Uno"

Sketch uses 33296 bytes (103%) of program storage space.Maximum is 32256 bytes.text section exceeds available space in board

Global variables use 1571 bytes (76%) of dynamic memory, leaving 477 bytes for local variables.Maximum is 2048 bytes.

Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.Error compiling for board Arduino Uno.

This report would have more information with"Show verbose output during compilation"option enabled in File -> Preferences.

ReplyQuote Hans (@hans) Famed Member Admin Joined: 12 years ago Posts: 3020 June 20, 2020 4:54 AM

Hi TVR4,

Seems that particular sketch is just a little too big for your Arduino Uno.I have compiled it for my Arduino Uno (can't run it of course), and it gave me a 63% memory use (20622 bytes).

On that note, I do not know what "sauvegarde SD" is, and I noticed that quite a few libraries are being used, even though it did not seem to be a problem for my Arduino Uno (R3).

Since your result is more than 30% bigger, which is quite significant, I can only make these assumptions;

1) Update your Arduino IDE (the most recent one seems to be 1.8.13).

2) Update the libraries as they may be outdated and bigger than the need to be.

Manually:

Under "Tools" - "Manage Libraries", verify that the use libraries are up to date. I'd focus on the Adafruit libraries (Adafruit_GFX and Adafruit_ST7735, and the libraries used by these 2 libraries.I'd also check that you have the latest TinyGPS++ library (source where I found it).

Automatically (easier):

You can check the libraries easier for updates by using "Tools" - "Manage Libraries", and selecting "Updatable" to see which libraries have an update available). Then for each library you find, you'll just have to click each "Update" button.

 

If none of this helps ...

Did you add anything else? If so: please post the full code.Since it It looks like you're running on an Arduino Uno as well, I'd assume your compiled result should be similar to my compile results (unless I goofed up somehow of course).

 

 

 

p.s. Just for reference, I've pasted the code from the link you provided below (cleaned up);

#include <Adafruit_GFX.h> #include <Adafruit_ST7735.h> #include <SoftwareSerial.h> #include <TinyGPS++.h> #define cs 10 #define dc 9 #define rst 8 #define OLED_RESET 5 Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst); static const int RXPin = 4, TXPin = 3; //GPS communication static const uint32_t GPSBaud = 9600; TinyGPSPlus gps; SoftwareSerial ss(RXPin, TXPin); int x = 80; int xh = 80; int maxhigh = 0; int maxspeed = 0, speed1 = 0; int high1 = 0;; void setup() { Serial.begin(9600); ss.begin(GPSBaud); tft.initR(INITR_GREENTAB); tft.fillScreen(ST7735_BLACK); tft.setCursor(5, 58); tft.setTextSize(1); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.print("initilisation"); } void loop() { tft.setTextSize(1); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); // affichage des informations a chaque bonne reception satellite while (ss.available() > 0) { gps.encode(ss.read()); if (gps.location.isUpdated()) { cadre(); tft.setCursor(5, 44); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.print("Latitude :"); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(gps.location.lat(), 6); tft.setCursor(5, 58); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.print("Longitude :"); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(gps.location.lng(), 6); //affichage ecran date tft.setCursor(5, 7); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.print("date : "); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(gps.date.day()); tft.print(" "); tft.print(gps.date.month()); tft.print(" "); tft.print(gps.date.year()); //affichage ecran heure tft.setCursor(5, 20); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.print("heure : "); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(gps.time.hour() + 1); tft.print(" "); tft.print(gps.time.minute()); tft.print(" "); tft.print(gps.time.second()); tft.print(" "); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.setCursor(3, 30); //affichage ecran altitude tft.setCursor(5, 80); tft.print("H m :"); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(gps.altitude.meters(), 0); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(" "); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.setCursor(5, 95); hmax(); tft.print("Hmax :"); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(maxhigh); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(" "); courbeh(); //affichage ecran vitesse tft.setCursor(5, 115); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.print("V act: "); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(gps.speed.kmph(), 0); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(" "); tft.setCursor(5, 130); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); vmax(); tft.print("vmax: "); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(maxspeed); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(" "); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); courbe(); //affichage ecran nombre de satellites tft.setCursor(5, 147); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.print("nombre de Sat : "); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(gps.satellites.value()); tft.setTextColor(ST7735_CYAN, ST7735_BLACK); tft.print(" "); // Horizontal Dim. of Precision (100ths-i32) Serial.print("HDOP = "); Serial.println(gps.hdop.value()); smartDelay(400); } } } // delai pour une bonne recption static void smartDelay(unsigned long ms) { unsigned long start = millis(); do { while (ss.available()) gps.encode(ss.read()); } while (millis() - start < ms); } void cadre() { // affichage ecran //cadre tft.drawLine(0, 0, 130, 0, ST7735_RED); tft.drawLine(0, 1, 130, 1, ST7735_RED); tft.drawLine(0, 158, 130, 158, ST7735_RED); tft.drawLine(0, 142, 130, 142, ST7735_RED); tft.drawLine(0, 141, 130, 141, ST7735_RED); tft.drawLine(0, 107, 130, 107, ST7735_RED); tft.drawLine(0, 108, 130, 108, ST7735_RED); tft.drawLine(80, 108, 80, 140, ST7735_RED); tft.drawLine(81, 109, 81, 140, ST7735_RED); tft.drawLine(80, 70, 80, 108, ST7735_RED); tft.drawLine(81, 70, 81, 108, ST7735_RED); tft.drawLine(0, 159, 130, 159, ST7735_RED); tft.drawLine(0, 0, 0, 156, ST7735_RED); tft.drawLine(1, 1, 1, 157, ST7735_RED); tft.drawLine(127, 0, 127, 156, ST7735_RED); tft.drawLine(126, 0, 126, 156, ST7735_RED); tft.drawLine(0, 35, 130, 35, ST7735_RED); tft.drawLine(0, 36, 130, 36, ST7735_RED); tft.drawLine(0, 70, 130, 70, ST7735_RED); tft.drawLine(0, 71, 130, 71, ST7735_RED); } void courbe() { int nouvelleValeur; // converison vitesse max (350 km/h) en pixel nouvelleValeur = map((gps.speed.kmph()), 0, 150, 137, 110); // car l'cran a 64 pixels de haut x++; tft.drawPixel(x, nouvelleValeur, ST7735_CYAN); if (x > 123) { x = 80; tft.fillRect(82, 110, 43, 30, ST7735_BLACK); } } void courbeh() { int nouvelleValeurh; // converison vitesse max (350 km/h) en pixel nouvelleValeurh = map((gps.altitude.meters()), 0, 1000, 104, 72); // car l'cran a 64 pixels de haut xh++; tft.drawPixel(xh, nouvelleValeurh, ST7735_CYAN); if (xh > 123) { xh = 80; tft.fillRect(82, 72, 43, 35, ST7735_BLACK); } } void vmax() { // calcul vitese maximum speed1 = (gps.speed.kmph()); if (speed1 > maxspeed) { maxspeed = speed1; } } void hmax() { // calcul altitude maximum high1 = (gps.altitude.meters()); if (high1 > maxhigh) { maxhigh = high1; } } ReplyQuote tvr4 (@tvr4) Estimable Member Joined: 6 years ago Posts: 122 Topic starter June 20, 2020 8:03 AM

Thank you so much fr the help.  

1) I do have an Arduino UNO R32) sauvegarde SD is french for SD Backup3) I just updated my Arduino IDE and all libraries prior to downloading this code

4) I found the TinyGPS++ Library on the site you mentioned but can not find the version number on the web site. 5) Currently my IDE shows version 13.0.0 installed

I did not change any code.  I was in the process of translating the comments to English and changing the units to MPG and feet.But when I had the problem compiling the code I did not finish the translation.  So the code I am working with is direct from the project

Hope this helps

 

ReplyQuote tvr4 (@tvr4) Estimable Member Joined: 6 years ago Posts: 122 Topic starter June 20, 2020 8:23 AM

Something is strange in the code pasted directly from the project site.  I deleted the code I had and pasted the code from the project site into a new file in the IDE.The same error occurred.

I took the cleaned up code you posted and it compiled without errors.  Sketch uses 20622 bytes (63%) of program storage space. Maximum is 32256 bytes.Global variables use 868 bytes (42%) of dynamic memory, leaving 1180 bytes for local variables. Maximum is 2048 bytes.

ReplyQuote tvr4 (@tvr4) Estimable Member Joined: 6 years ago Posts: 122 Topic starter June 20, 2020 8:25 AM

The code you posted is for the datalogger without SD card support.  The issue is with the sauvegarde SD which supports the SD card

ReplyQuote Hans (@hans) Famed Member Admin Joined: 12 years ago Posts: 3020 June 20, 2020 9:23 AM

Ah OK, my bad ... my French is pretty terrible haha.Could you post the entire code (maybe attach the ino sketch file)?

This way we can take a look and see where so much memory is being used. 😊 

ReplyQuote tvr4 (@tvr4) Estimable Member Joined: 6 years ago Posts: 122 Topic starter June 20, 2020 9:57 AM
Posted by: @hans

Ah OK, my bad ... my French is pretty terrible haha.Could you post the entire code (maybe attach the ino sketch file)?

This way we can take a look and see where so much memory is being used. 😊 

Not to worry.  The secret was using google translate

I am attaching the code ino file directly from the project

Attachment : sauvegarde_sd.ino

 

 

ReplyQuote Hans (@hans) Famed Member Admin Joined: 12 years ago Posts: 3020 June 20, 2020 2:44 PM

Yep, getting the same 103% ....

Looking at the code, my best guess is that adding the SD.h library just makes it for a too high space requirement to accommodate all the included libraries. I have found quite a few posts (this one for example), running into the same issue.

Since the error message says:

Sketch uses 33260 bytes (103%) of program storage space. Maximum is 32256 bytes. text section exceeds available space in boardGlobal variables use 1571 bytes (76%) of dynamic memory, leaving 477 bytes for local variables. Maximum is 2048 bytes.Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.Error compiling for board Arduino Uno.  

This makes me believe that all of these libraries (combined) have too much text or number constants defined (const, not #define).

When looking at sd.h I do notice (probably for a very good reason of course) that there a lot of constants defined.Of course we cannot blame just sd.h, it is the combination of these libraries that is just too much.

But even if you could clean that up a little ... 1004 bytes is a lot of cleaning and I doubt it will be easy.

I'd start looking for alternative libraries.I did see a few smaller libraries:

  • FAT16 library,
  • TinyFAT
  • SDFat
  • PetitFS

At first glance that last two looks promising, but I do not know if this will be a drop-in replacement and I don't know if this will even be useful for your purposes.  The last 2 seem to claim that they do support FAT16 and FAT32.

A too large SD library does seem quite common though (see this Google Search). 

Interesting to that just the SD library adds 40% 😱 .

ReplyQuote tvr4 (@tvr4) Estimable Member Joined: 6 years ago Posts: 122 Topic starter June 20, 2020 3:49 PM

Looks like I have some tinkering to do.  If I change the SD library I would guess that I would need to change the associated code as the syntax would be different?

I ordered the wrong display.  So while I am waiting for the correct one I will tinker with this

Let me know if you come up with anything else?

Thanks for the head start!

ReplyQuote Hans (@hans) Famed Member Admin Joined: 12 years ago Posts: 3020 June 21, 2020 3:33 AM

Yeah, and the tinkering is not going to be fun (but very satisfying if you get it to work).

I do not know if any of these libraries are drop-in replacements for the standard SD-library, but I cannot imagine it to be super hard.

Digging into PetitFS, I found no examples - so that one could be more challenging.I did find an example though on another website: link. Not too complicated.

TinyFAT on the other hand comes with examples, and doesn't seem too complicated. It is however no longer maintained. Not sure if that is going to to a problem.

A quick look at SDFat, shows that it has examples as well, but for some reason I found them harder to read.

I could be wrong, but FAT16 library seems very old (not updated since 2009?).

Most of these work in a fashion that you have to "open" the file, then "write" to the file and finally "close" the file.With a datalogger the question of course will be how often you'd want the file to be opened and closed.SD cards are notoriously unreliable over time.

Note:

I happened to be playing with an ESP8266 today, a super cheap Arduino alternative (can use the same code as for your Arduino), but it comes with a few great advantages;

  • Much cheaper (app. $5/per board)
  • Significantly faster
  • Much more memory (4 Mb!)
  • Much smaller than most Arduino models
  • Build in WiFi
  • More GPIO pins

If there would be a downside then I'd say, it has only one analog pin, and it uses 3.3V on some pins (I need to investigate that some more what the implications are). But in the end you use it like a regular Arduino. So this may be an easier alternative.Not sure where you're located, but I got these from Amazon US which can be bought from Amazon Germany as well.

ReplyQuote tvr4 (@tvr4) Estimable Member Joined: 6 years ago Posts: 122 Topic starter June 21, 2020 7:41 AM

I agree, tinkering is not how I wanted to learn arduino coding.  But I may not have a choice.

That alternative board looks really interesting.  Is there documentation somewhere?

Considering the cost, I think I am going to order one and see what I can do with it.

Keep me posted on your testing

ReplyQuote Hans (@hans) Famed Member Admin Joined: 12 years ago Posts: 3020 June 21, 2020 7:51 AM

Well, I just started with the ESP8266 myself and I just posted an article on my first experiences. 

I had mine laying around already for a while, but ... time is always an issue 😋 

Next experiment I'll be doing is controlling WS2812 LED strips. But that may be for tomorrow 🤪 

My only concern would be the 3.3 V levels - but from what I have seen, most people just ignore it hahah.

ReplyQuote tvr4 (@tvr4) Estimable Member Joined: 6 years ago Posts: 122 Topic starter June 21, 2020 8:05 AM

Looks like MakerFocus has these on sale for fathers day.  3 boards for $12.15

 

ReplyQuote Hans (@hans) Famed Member Admin Joined: 12 years ago Posts: 3020 June 21, 2020 8:58 AM

Oh wow, nice deal! 👍 😊 

ReplyQuote tvr4 (@tvr4) Estimable Member Joined: 6 years ago Posts: 122 Topic starter June 21, 2020 4:27 PM

I apologize for not posting the link before.  Would you recommend ordering anything else since there is a sale and free shipping?

https://www.makerfocus.com/products/3pcs-esp8266-nodemcu-lua-cp2102-esp-12f-internet-wifi-development-board-for-esp8266-esp01?_pos=6&_sid=9cc9455af&_ss=r

 

ReplyQuote Page 1 / 5 1 2 3 4 5 Next Please Login or Register to reply to this topic. Forum Jump: Software — MacOS X Software — Windows Software — Linux Software — Miscellaneous Software — Tweaking4All Applications — — ApplePi-Baker — — ConnectMeNow — — MiniWOL — — MovieScanner — — Rename My TV Series 2 Hardware — Apple/Mac Hardware — Windows/Linux Hardware — Raspberry Pi — Arduino — QNAP NAS — Other Hardware Home Automation — Home Assistant Mobile Devices — iOS Devices — Android Devices — Other Software Development — Delphi, Lazarus, Free Pascal — Databases — Web Development — Miscellaneous — Website Updates Multimedia — Home Theatre — Video — Music — Games and Gaming — Graphics & Design Previous Topic Next Topic

Currently viewing this topic 1 guest.

Share: Forum Information Mark all read Recent Posts Unread Posts Tags
  • 30 Forums
  • 1,194 Topics
  • 5,479 Posts
  • 12 Online
  • 830 Members
Our newest member: cconway66 Latest Post: Lazarus Pascal - How to get a Transparent TPanel Forum Icons: Forum contains no unread posts Forum contains unread posts Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

©2000-2025 Hans Luijten - Tweaking4All.comContent may NOT be reproduced without explicit permission of the author(s).You can contact us through the "Contact Us" form.Linking to our page(s) however is very much appreciated.

  • Downloads
  • Links
  • 3D Printing
  • Applications
  • CD, DVD, Blu-Ray Disc Burning
  • Graphics & Design
  • Hardware
  • Home Theatre
  • Mobile Devices
  • Music
  • Network and Internet
  • News & Updates
  • Online Tools
  • OS Tips & Tricks
  • Photography
  • QNAP
  • Software
  • Software Development
  • Video
  • Web Development
  • Main Forum Page
  • Forum Rules
  • Home Assistant
  • Software
  • MacOS X Software
  • Windows Software
  • Linux Software
  • Miscellaneous Software
  • Tweaking4All Applications
  • Hardware
  • Apple/Mac Hardware
  • Windows/Linux Hardware
  • Raspberry Pi
  • Arduino
  • QNAP NAS
  • Other Hardware
  • Home Automation
  • Mobile Devices
  • iOS Devices
  • Other
  • Software Development
  • Delphi, Lazarus, Free Pascal
  • Databases
  • Web Development
  • Miscellaneous
  • Website Updates

Tag » Arduino Esp32 Text Section Exceeds Available Space In Board