Array in RAM1?

JimSoft

New member
I hope not posting full code here is not going to get me banned but it's rather large and superfluous in this case. ;)

I'm writing an emulator and putting the entire 64K memory map in an array. When compiled the array appears to reside in RAM2, is there any way to get it into RAM1 as I belive this would be up to four times faster. I think there should be sufficient space there.

uint8_t memory[0x10000];

Memory Usage on Teensy 4.1:
FLASH: code:63912, data:140232, headers:8844 free for files:7913476
RAM1: variables:209248, code:60440, padding:5096 free for local variables:249504
RAM2: variables:12416 free for malloc/new:511872

Using Arduino IDE 2.3.6

Thanks, Graham.
 
Last edited:
RAM1 has 209248 bytes of data while RAM2 only has 12416 bytes. Your 65536 byte array is definitely in RAM1.
 
Thank you for your help. I was just hunting around for clues as to where it was located in the lst file. The only thing I had to go on so far is that using DMAMEM made no difference to the measured performance.
 
RAM2 is cached. The CPU cache is 32K. Even for cache misses, RAM2 is still very fast. It's also 64 bits wide, so a cache miss quickly fills a 32 byte cache row.

For most "normal" programs, there's little to no performance difference because the cache is so effective.
 
Back
Top