duino-coin icon indicating copy to clipboard operation
duino-coin copied to clipboard

Atmega 8535

Open Zlody opened this issue 4 years ago • 4 comments

Good afternoon. My name is Alexey, I'm from Russia, I don't speak English well, I'm sorry. I have an Atmega 8535 microcontroller. I made an arduino out of it. Photo below. I wanted to try mining DUINO COIN. Problem: there is not enough memory to load the sketch. Can you think of something? 0fefcd3a-fc47-4bd3-9e13-0f7c32d2828e 760ca9f5-9fad-4f26-9e7f-a478904ea388

Zlody avatar Feb 01 '22 04:02 Zlody

Quite a tough task. The official AVR miner needs about 14k program memory, about 550 bytes of global variables and a some for local variables. The I2C miner even takes a bit more (15k prg.mem., 730 g.var.). Not absolutely sure, but I think the 8535 has 8k program memory and 512bytes of RAM... So its very limited... But there are a some parts that can be optimized for size.

First you can change the optimization for speed to optimization for size. At the beginning of all files (also in the h&cpp's) there is statement like: #pragma GCC optimize ("-Ofast") you can replace it with: #pragma GCC optimize ("-Os")

When you do this, the program memory drops to less than 9k, but the ram drops not so much only a couple of bytes. This is not enough, I guess.

Furthermore, get_DUCOID is pretty useless in your case, because it produces the same string, So you can run it once in a separate sketch and save the result and put it into a fix string in program memory. Then you can remove the function and the include. That saves about 1.5k. So program memory is down to 7.3k. This will not be enough, but we're getting very close.

Also you could remove fully the led blinking stuff, that also saves a bit over 100 bytes. So we are at about 7.2k prg.mem.

Then you can check the full code, on some parts I read comments that they are only needed for some special chips or cases. Maybe you can check for all of them, if they are needed in your case and if not, remove it...

Anyway there is the RAM usage left. For that you have to do a bit more changes, I guess. One part that comes to my mind is there is a job buffer, that is used from the sha-hasher. Its about 104 bytes long. It is only needed during the hashing itself, but allocates global memory. Maybe it can also be used as output buffer. Because they using a couple of strings for that. But the output is about 80-90 bytes long so it should easily fit into the job buffer... Also you should look very carefully if you can remove/optimize variables or parameters, because often they are only used in a very short time, but allocate space all the time. Yeah, I think, the RAM management is the hard part here...

Anyway, hope I could help you a bit to get some ideas to change the code for your needs. My personal feeling is, it should be possible to get it run on an 8535... Good luck! And dont give up! :)

JensL70 avatar Feb 02 '22 07:02 JensL70

try Tiny_Slave or ATTiny_Slave or Tiny_Slave_trinket from https://github.com/JK-Rolling/DuinoCoinI2C_RPI good luck

JK-Rolling avatar Feb 02 '22 08:02 JK-Rolling

Hi, tell me if i can close this issue. (because is off-topic)

LDarki avatar Feb 12 '22 23:02 LDarki

No response, i'll close this issue.

LDarki avatar Feb 24 '22 20:02 LDarki