How to access 512KB Battery-Backable SRAM in RCM 6760

Hi.
I tried to use _xalloc and XALLOC_BB in parameter3 but it doesn’t work and gave me the error bellow :

Run Time Error:Xmem allocation failed (out of memory)…
file:MEM.LIB
function: _xalloc
line:400

I’m trying to allocate 15000 bytes.

pszGER = _xalloc(szGER+szNOME+szTD+szSet+szL1L2+szSR+szER+szVIR+szCC+szAER+szANA+szFER,0, XALLOC_BB);

The first parameter for _xalloc is a pointer to an long integer as the function may return a larger block and will update the long at that location with the actual amount allocated so you should have something like:

long block_size;

block_size = szGER+szNOME+szTD+szSet+szL1L2+szSR+szER+szVIR+szCC+szAER+szANA+szFER;

pszGER = _xalloc(&block_size,0, XALLOC_BB);

Regards,
Peter

1 Like