Portenta - Usage of SDRAM.h library

I am interested in using the SDRAM on the Portenta to store large frameBuffers and arrays. Any other example code would be appreiciated.

So far I have success with


#include <SDRAM.h>

SDRAMClass mySDRAM;

uint8_t *sdram_frame_buffer;



// in the setup

  
  mySDRAM.begin(SDRAM_START_ADDRESS);   // for camera 320x320

  sdram_frame_buffer = (uint8_t *)mySDRAM.malloc(320 * 320 * sizeof(uint8_t));
 

// in the main loop
   int myCamResult =  myCam.grab(sdram_frame_buffer); // myCamResult should be zero 



I have more advanced code that better aligns the SDRAM buffer.

#include <SDRAM.h>


SDRAMClass mySDRAM;

uint8_t *ei_camera_frame_buffer; // 32-byte aligned
static uint8_t *ei_camera_frame_mem;

  
  mySDRAM.begin(SDRAM_START_ADDRESS);   // for camera 320x320



    ei_camera_frame_mem = (uint8_t *) SDRAM.malloc(320 * 320 + 32 /*alignment*/);
    ei_camera_frame_buffer = (uint8_t *)ALIGN_PTR((uintptr_t)ei_camera_frame_mem, 32);



// main loop

   int myCamResult =  myCam.grab(ei_camera_frame_buffer); // myCamResult should be zero 



The above work great but they are using only pointers

What I am now trying to do is replace a large array in SDRAM and then use it like a regular array in my program. Any suggestions?

const unsigned char model_tflite[] = { ...}
unsigned int model_tflite_len = 2640; // length of above array to put into SDRAM

  modelSetup(model_tflite);  // How the array is used in setup
  

Any suggestions how to do the above with the SDRAM pointer?