Using EXTMEM to Place Variables in External PSRAM

Thanks to all your help (esp Defragster) , I moved 200K of variables into DMAMEM and the project works better than ever.
 
I'm getting this warning and I suspect it means my array is not being allocated in DMAMEM. I'm trying to confirm this but I don't know the command to make teensy display available free memory. Since I have no sound engine inthe project yet, DisplayAudioMemoryUsage prints 0, which is not helpful. Can someone explain to me how I might put this array in DMAMEM? My code to use the array requires uint16_t* and everything I've tried thus far has been unsuccessful. The way I am doing it at least compiles. but I am suspicious it's putting the array in RAM1, not RAM2 but, as I said, I am unsure how to confirm this or how to get the result I need.

60 | uint16_t* displayValues = new DMAMEM uint16_t[xDisplay * yDisplay];
| ^
SimplexNoiseTest:60: warning: 'used' attribute does not apply to types
 
All malloc (and new) calls allocate from the heap which is located in RAM2. To confirm just print the address.
 
I'm getting this warning and I suspect it means my array is not being allocated in DMAMEM. I'm trying to confirm this but I don't know the command to make teensy display available free memory. Since I have no sound engine inthe project yet, DisplayAudioMemoryUsage prints 0, which is not helpful. Can someone explain to me how I might put this array in DMAMEM? My code to use the array requires uint16_t* and everything I've tried thus far has been unsuccessful. The way I am doing it at least compiles. but I am suspicious it's putting the array in RAM1, not RAM2 but, as I said, I am unsure how to confirm this or how to get the result I need.

60 | uint16_t* displayValues = new DMAMEM uint16_t[xDisplay * yDisplay];
| ^
SimplexNoiseTest:60: warning: 'used' attribute does not apply to types

That snippet is a bit short of info - quick guess. It is complaining about 'used' which isn't shown there?

I do see "new" - which will by default will do a dynamic allocation in DMAMEM - and adding DMAMEM is at best redundant - and confusing to the compiler?

Perhaps this is the desired?: uint16_t* displayValues = new uint16_t[xDisplay * yDisplay];

Printing the pointer value will indicate where it is located:
Serial.printf("Address at %p\n", displayValues);

And it should be above this address: // RAM (rwx): ORIGIN = 0x20200000, LENGTH = 512K // RAM2 - DMAMEM
 
Back
Top