I'm using a chipset of NORDIC the nRF9E5 that has an internal data memory build as fellow:
-128 bytes of registers and scratchpad memory accessible through direct or indirect
addressing (addresses 0x000x7F).
- 128 bytes of scratchpad memory accessible through indirect addressing (0x80
- 128 special function registers (SFRs) accessible through direct addressing.
I'm currently using 108 bytes out of the 256 available and now I try to declare an unsigned char ARRAY and the linker complain saying:
?ASlink-Error-Insufficient space in data memory. 36 bytes short.
What can I do in order to use this Array ???
Thanks in advance for the help.
Put the array in idata:
idata unsigned char ARRAY;
By default the compiler puts it in direct accessable data memory which is only 128 bytes large. Since an array is almost always indirectly accessed it's a perfect candidate to move to indirect accessable data memory (idata).
Thanks that solve my problem.
In the same context, I want to understand certain points, pls help.
I am using SDCC with Cygnal C8051F020 having built in 64KB Code, 4 KB external RAM, 256 Data memory etc. I am using large memory model.
1. There is 128 Byte data memory, 128 Byte indeirect memory and SFRs, are all these physically different memory but addressessed with similar address but used by different way of addressing.
2. I am getting same error, i.e. ?ASlink-Error-Insufficient space in data memory. 8 bytes short.
While I am using number of C and header files having many global and many local data variables, I tried putting some of them with 'xdata' but still the memory short count remains exactly as 8, it is not reducing.
I have following questions:
a. Which variable, local, global, global to main or global to other C file makes reduce the data memory used.
b. Is these a case where Compiler automatically makes variable in internal data space even if it is declared in 'xdata'
1. Yes, they're all different address spaces.
2. When using large memory model everything already is allocated in xdata memory, using the xdata keyword doesn't help here. The compiler tries to use registers for calculations but if that's insufficient, it uses spill locations (sloc) in data memory (or on stack if the function is reentrant or --stack-auto is used). It may very well be that it needs more slocs than are available in data memory as overlaying them is not a strong point of SDCC. You could try using --stack-auto which automatically overlays on the stack.
Hope this helps,
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.