I'm starting off with the Geo watch sketch on a project that i'm working on, and I keep on getting the error Sketch too big..
I'm assuming that since the demo was put together there might be some library updates that are causing the error. Any idea on what I can do?
Binary sketch size: 28,742 bytes (of a 28,672 byte maximum)
Neo Geo Sketch too big
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Neo Geo Sketch too big
Hunh.. haven't seen that before.
I'll check with the folks who are responsible for that project and see if they have any preferred suggestions for things to chop, but in the meatime the good old process of Muntzing always works.
George Muntz was a New York salesman and huckster who ended up running an electronics company. He became famous for selling hardware that cost less than anyone else's because it achieved more with less hardware than anyone else's. He carried a set of diagonal cutters with him, and if an engineer had a circuit working he'd look at it, listen to the explanation of what it was doing, then clip out any components he considered unnecessary. If the circuit still worked, he'd clip out more. When the circuit stopped working, he'd say, "okay, put that last one back in." That process became known as 'Muntzing'.
Start by making your own copy of all the files associated with the project, and rename things if necessary so the compiler knows how to find the ones you're about to commit atrocities upon.
Once the bookkeeping is out of the way, start commenting stuff out. If a library contains a function you don't use, wrap comment tags around it. Test the code after every change to make sure it still builds, and when you get build errors uncomment the most recent change.
Once you're done at the block level, go through the functions and comment out any cases you don't use for the project. Our libraries have to support several different microcontrollers, but your project doesn't. Clip away anything that doesn't seem relevant to the NeoGeo.
When there's nothing left to cut, see if you can consolidate or simplify what's left.
I'll check with the folks who are responsible for that project and see if they have any preferred suggestions for things to chop, but in the meatime the good old process of Muntzing always works.
George Muntz was a New York salesman and huckster who ended up running an electronics company. He became famous for selling hardware that cost less than anyone else's because it achieved more with less hardware than anyone else's. He carried a set of diagonal cutters with him, and if an engineer had a circuit working he'd look at it, listen to the explanation of what it was doing, then clip out any components he considered unnecessary. If the circuit still worked, he'd clip out more. When the circuit stopped working, he'd say, "okay, put that last one back in." That process became known as 'Muntzing'.
Start by making your own copy of all the files associated with the project, and rename things if necessary so the compiler knows how to find the ones you're about to commit atrocities upon.
Once the bookkeeping is out of the way, start commenting stuff out. If a library contains a function you don't use, wrap comment tags around it. Test the code after every change to make sure it still builds, and when you get build errors uncomment the most recent change.
Once you're done at the block level, go through the functions and comment out any cases you don't use for the project. Our libraries have to support several different microcontrollers, but your project doesn't. Clip away anything that doesn't seem relevant to the NeoGeo.
When there's nothing left to cut, see if you can consolidate or simplify what's left.
- ufarman
- Posts: 2
- Joined: Wed Aug 13, 2014 8:53 pm
Re: Neo Geo Sketch too big
Yeah, its really weird. I'm going to try to find older versions of the libraries - maybe there was some bloat over time.
The weird thing is that its only 70 BYTES over...
Binary sketch size: 28,742 bytes (of a 28,672 byte maximum)
The weird thing is that its only 70 BYTES over...
Binary sketch size: 28,742 bytes (of a 28,672 byte maximum)
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: Neo Geo Sketch too big
I took a look too and tracked down all the latest versions of the libraries, and unfortunately also see the sketch is just a little too big. I commented out some setup code which I think is unnecessary (asking for GPS antenna updates, asking for the GPS firmware version), and put the serial output of received GPS sentences behind an if check that defaults to false. With those changes the sketch just barely gets under the limit again. I don't have the hardware handy to test it though, do you mind giving the attached a shot and checking if it works for you? If it looks good I can update the sketch code in github so other folks don't run into the same issue.
- Attachments
-
- Flora_NeoGeo_Watch.zip
- (8.16 KiB) Downloaded 37 times
- theTALLone
- Posts: 2
- Joined: Wed Oct 08, 2014 9:22 pm
Re: Neo Geo Sketch too big
that code did cut down the size but but it's still 70 bytes too big, what parts of the code are unnecessary? is it possible to remove any more?
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: Neo Geo Sketch too big
One thing to try is removing a few Serial.println calls if there are any left in the code. Just to check were you using the code I attached to the earlier reply, or the code from the GitHub repository? Try the code from my earlier reply as I removed a few Serial print statements to get it under the limit.
- theTALLone
- Posts: 2
- Joined: Wed Oct 08, 2014 9:22 pm
Re: Neo Geo Sketch too big
the code i used was the one you posted, but it was still too big. i did try and remove some println commands but there were none to remove.
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: Neo Geo Sketch too big
Yeah unfortunately it looks like there aren't any easy space saving fixes left to make, but one thing you can try is disabling one of the modes that you don't think you'll use on the watch. For example if you aren't using the nav mode to navigate to a point then try commenting it out so Arduino doesn't need to compile all the code for it. I have a feeling this will save a significant amount of space and get it compiling again.
Here's where each mode runs in the loop function:
If you're not using the nav mode, try commenting it out by changing it to:
Or if you've configured it and are using nav mode, try commenting out the compass mode like:
Here's where each mode runs in the loop function:
Code: Select all
if (mode == 0) {
clockMode();
}
if (mode == 1) {
navMode();
}
if (mode == 2) {
compassMode();
}
Code: Select all
if (mode == 0) {
clockMode();
}
//if (mode == 1) {
// navMode();
//}
if (mode == 2) {
compassMode();
}
Code: Select all
if (mode == 0) {
clockMode();
}
if (mode == 1) {
navMode();
}
//if (mode == 2) {
// compassMode();
//}
- madnys
- Posts: 1
- Joined: Mon Nov 17, 2014 5:07 am
Re: Neo Geo Sketch too big
Apologies for resurrecting the thread, but the problem seems to have gotten worse.
Just built the watch, trying to get the code to compile. Using the code on the project page, the sketch is too big, and not just by a little. 29,532 bytes. Using the code above, the sketch is slightly smaller, but still too big at 29,506 bytes.
Removing both the compass and GPS features will get it in under the limit (26,352 bytes,) but there has to be a better way.
Just built the watch, trying to get the code to compile. Using the code on the project page, the sketch is too big, and not just by a little. 29,532 bytes. Using the code above, the sketch is slightly smaller, but still too big at 29,506 bytes.
Removing both the compass and GPS features will get it in under the limit (26,352 bytes,) but there has to be a better way.
- bcochran1
- Posts: 497
- Joined: Mon Jan 21, 2013 10:46 pm
Re: Neo Geo Sketch too big
I wonder if a serial eeprom can be added to the Flora to give it some additional space.
Bob
Bob
Please be positive and constructive with your questions and comments.