Bootload programs from SD card

Hi,

I am using Arduino UNO and 1,77" TFT LCD. Atmega328's memory is too small for me. I want to increase the flash memory by loading .hex files from SD. But I can't use any external modules, because all the pins are used now. Can You help me with this problem?

Please be understand, because I am new to the forum.

I want to increase the flash memory by loading .hex files from SD.

You can't.

Mark

But supposedly Rogue Robotics bootloader can load hex files from uMMC module. On my board all the pins are used currently and I don't want to use any external modules, just SD reader.

kuba2k2:
But supposedly Rogue Robotics bootloader can load hex files from uMMC module. On my board all the pins are used currently and I don't want to use any external modules, just SD reader.

What you want to do and what you can do may not be the same thing. Loading hex files from an SD card is NOT the same as increasing flash memory.

A program can't write to flash. Only the bootloader can.

Mark

How much flash memory do you need? 128K? 256K?
Or do you need SRAM? '328P has 2K, 1248P has 16K, 2560 has 8K.

kuba2k2:
But supposedly Rogue Robotics bootloader can load hex files from uMMC module. On my board all the pins are used currently and I don't want to use any external modules, just SD reader.

Yes, it can load hex files from an SD card using that uMMC serial reader module. It might be possible, with a lot of careful programming, to make one that used a normal uSD card (that module they use has an added controller on it that bridges from SPI to serial). But no matter what, this would just be a way to change which sketch is loaded on the chip, and the system would have to be restarted in order to make any changes. It's not like you could pause, write the .hex containing the code you need to run, then pick up and continue running (well, it might be possible - I forget whether it's possible to set the fuses so it can self-program from outside of bootloader section - but it would be a hard task for an expert).

It sounds like what you need is more flash - and more pins too, it sounds like...

How about an ATmega1284p (32 IO pins, 128k flash 16k ram)Crossroads sells some cute boards for this) or Arduino Mega (oodles of pins, 256k flash, 8k ram)?

You could conceivably have a bootloader that loaded from an SD card. However then the bootloader itself would need to have the code in it to access and read the SD card. Now the biggest bootloader you can get on the Atmega328 is 2048 bytes, but a quick compile of DumpFile from the SD library shows it is 12 KB. So the bootloader would have to reserve some code in normal program memory, in order to be able to load from SD.

So now out of 32 KB flash you have lost 12 KB in order to be able to load more programs. So your total program size has decreased from 31.5 KB (with the Optiboot loader) to 20 KB. Doesn't sound like a great saving to me.

I think you need to describe why you want to do this. There may be better solutions, one being using a processor with more memory and flash.