Hey guys. This is my first post to the Arduino Forums
I'm doing a project for school. We've built a custom "Arduino-style" board using the Atmega 328P-PU, with 3.3V 8MHz logic. We're treating it as an Arduino Pro or Pro Mini. Our code is getting kindof big. There's a lot we can still do to reduce RAM usage, optimize our code, etc.. However, I'm afraid we still might run out of FLASH and RAM memory before reaching our goal for the project.
Part of the design is to browse an SD card and allow a user to read/write data to it. I had the idea that we might be able to have the Arduino find some unused memory on the SD card and use it to store variables, (including SdFile variables,) and misc. temporary data while it worked, then clean up after itself on exit. Is this possible?
Also, if possible, we'd like to stick to the SD.h and SdFat.h libraries which come with the Arduino software, without downloading any new versions of the SdFat.h library.
From the lack of quick response you can be fairly sure that what you want to do (treat part of the SD card as RAM) can't be done.
Remember that if you are using "print()" and "println()" with string constants you can save a lot of RAM by using the F() macro to keep the string constant in FLASH: Serial.print(F("String constant"));
You can save memory space by re-reading the SD card instead of keeping data in memory. Don't try to make a list of files, just search the SD card each time you want to know what files are there.
If you have large data arrays you may be able to calculate the contents of the array on the fly instead.
Thanks very much for your response. I've found a few variables that I will need to calculate on the fly, as you said. Still working on it, but I'm making progress.