Discussion in "Software" started by    nismo    Sep 14, 2008.
Sun Sep 14 2008, 03:17 am
#1
when i am trying to compile my code with sdcc, i get this error mssg...

ASlink-Error-Could not get 59 consecutive bytes in internal RAM for area DSEG...

The answer to solve this problem i get from a web sounds like this...

You are using all your direct memory.Try either moving your variables into xdata or compile with --model-large.

what does he mean?

Sun Sep 14 2008, 10:28 am
#2
@nismo,
the error indicates that the compiler is not finding enough data memory space to translate ur code because u have defined too many variables in the data space.
note that if u define a array like:
char array[59]; OR
char array[]= {"this text will be stored in data memory. Please store it incode memory")

the compiler has to compulsory reserve this data to the data memory.So try to avoid large arrays while deciding on the variables.
If the array is constant i.e. if the data in the array is fixed like a message, then use the 'code' or 'constant' directive so that the compiler can store it in the program memory. e.g.
const char array[]={"this text will be stored in program memory"};


also check if the compiler options are set to use the extended data memory (128 to 256byte memory).
another good practice is to use local variables as far as posible instead of global variables as the same memory can be used for different local variables in different functions.
another method to reduce usage of data RAM is to avoid usage of nested functions ( calling functions within functions) as far as possible in the code.




[ Edited Sun Sep 14 2008, 10:38 am ]
Sun Sep 14 2008, 10:51 am
#3
but i need to cread and array of 512. How? it is compulsory?? :bye
Sun Sep 14 2008, 11:07 am
#4
In that case you need to use a variant with extra ram....like the P89V51RD2 from NXP with 1k data ram.
Or use external ram with the standard 8051.


[ Edited Sun Sep 14 2008, 11:23 am ]
Sun Sep 14 2008, 11:21 am
#5


It means 59 consecutive bytes of the direct addressable ram ie 00h-7Fh,is not available for an array.

It means,now you have to push your variables/arrays into the SFR part ie 80h-FFh.This area when addressed directly,results in access to the SFRs.For using it to store user variables,you must use the idata keyword when declaring your variables.

Plz post the .map file here.

sashijoseph



you mean i have to rename my array as idata[512] ??Excuse me, i don't see any map file here.
Sun Sep 14 2008, 11:26 am
#6
oops sorry,I posted that before I read your post about the 512 byte array.Plz read the edited followup.
Sun Sep 14 2008, 11:30 am
#7
the external ram you mentioned is external memory...sorry to ask stupid questions i can not use other microcontroller. That is the term and condition of the project


[ Edited Sun Sep 14 2008, 11:33 am ]
Sun Sep 14 2008, 06:34 pm
#8
@nismo,
can u give the details of the project?
i just want to confirm whether u really need the external data memory......

many a times i have experienced that by 'twisting' the logic of my code a bit i could restrict the code within the 128 data RAM space. so thought if we could give an ideas in ur case....

:-)
Sun Sep 14 2008, 08:04 pm
#9
Thanks for you reply pdi33, i have solved the problem
Mon Sep 15 2008, 09:10 am
#10
Congrats Nismo,and plz share the soln.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Sazrzhk
Sun Oct 06 2024, 01:34 am
Sazrjgz
Sun Oct 06 2024, 01:23 am
Dnrthvf
Sat Oct 05 2024, 08:39 pm
Dnrthwo
Sat Oct 05 2024, 08:27 pm
Mofredka
Sat Oct 05 2024, 03:43 pm
ErnestClagS
Sat Oct 05 2024, 06:44 am
Arisha4Et
Fri Oct 04 2024, 05:53 pm
LancenuT
Fri Oct 04 2024, 02:15 pm