TomNisbet / TommyPROM

Simple Arduino-based EEPROM programmer
https://tomnisbet.github.io/TommyPROM/
143 stars 29 forks source link

Can sketch size be reduced to run on Nano 168 ? #40

Closed srayner closed 1 year ago

srayner commented 2 years ago

Hi Tom,

Is there anything that can be stripped out to allow this sketch to fit into the Nano 168 (rather than the 328)? Or would that be unachievable? I only need to program the 28C256 chip, but it looks like you only load code for the selected chip anyway.

I'm not sure if there are any other reasons why this would not run on a Nano 168, other than memory size.

Steve

TomNisbet commented 2 years ago

You are correct that the code for the other chip families is not included, so there aren't any savings there. You'll have half the RAM and half the flash to work with. The flash is only using about 40%, so that shouldn't be a problem. Squeezing the code to fit into only 1K of RAM might be a bit tricky. The XModem code requires a 128 byte buffer, so that's 12% of your RAM just for that. You could try removing features you aren't using. Also look for any debug and status variables that might not be necessary or commands you don't need. The code is already trying to use minimal resources, so I'm not sure how much you'll be able to cut out and still have something useful.

Other than the RAM, there shouldn't be any reason that the code wouldn't run on the 168 instead of the 328. One thing that will probably change is that the code uses direct port writes instead of digitalWrite() calls for speed. Those would need to be re-written to match the I/O pins that are connected to the flash chip.

If you are trying to use only a limited subset of the code, I may be able to direct you to code that can be trimmed away.

Good luck with your project! Tom