Placing and using large data in Arduino Mega

Hi,
In my program I need to place large chunks of data in Arduino Mega and use them. Initially I used PROGMEM. However since PROGMEM places the data in the first 64K of Flash, the program started giving problems when I used Adafruit fonts.etc.

I followed the tips given in the below article and came up with a technique to place large data outside of 64K Flash memory and ensure the remaining data and program fits in the lower 64K region.

https://www.avrfreaks.net/forum/atmega2560-full-flash-memory-access-progmem

In order to use this technique Platfomr.txt file located in Arduino installation was edited to include the section definitions as below:

compiler.c.elf.flags={compiler.warning_flags} -Os -g -flto -fuse-linker-plugin -Wl,-section-start=.block1_table=0x20000 -Wl,-section-start=.block2_table=0x24000 -Wl,-section-start=.block3_table=0x30000 -Wl,--gc-sections

The parts shown in bold are what I added to get the program to work.

This program now works. However here are my questions:

  1. When the program is compiled in Arduino IDE it reports the Flash memory size used by the program. This size doesn't include the additional chunks of data kept beyond 64K region. Is this is a problem?

  2. On reprogramming I noticed that Flash region containing this additional data is not erased. Arduino IDE erases only the section of Flash where the new sketch gets placed.

Is there a way to make Arduino IDE recognize this additional data chunk and include it when it compiles and loads the sketch, This will avoid complete Flash erase when the data in the higher regions of Flash has to be modified.

Looking forward to your suggestions.

Mega_large_data.ino (1.9 KB)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.