Discussion Forum

Stack overflow.. please suggest

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Raju dantuluri
Posted
3-Mar-2008 12:29 GMT
Toolset
C51
New! Stack overflow.. please suggest

Iam using keil version-2 compiler, AT809c51Rd2 microcontroller.

Iam using both ".C" and ".asm" files in my project.
I wrote my program by considering small memory model in both assembly and c files.

Now iam facing "Address space overflow" error. As per my understanding RAM area is not having enough space to fit all my data variables.

I tried by changing memory model from SMALL to LARGE and compiled.Now my assembly files wont support this memory model(because of indirect addressing). If this is the case, whether i must do modifications in assembly file? or please sujjest me if any alternative is there?

Is it possible by keeping mine as SMALL memory model and to shift Stack to extended RAM.

Read-Only
Author
Per Westermark
Posted
3-Mar-2008 12:37 GMT
Toolset
C51
New! RE: Stack overflow.. please suggest

Do your assembly code need to access all variables? If not, move just some variables. You don't need to switch memory model - you can tag individual variables with the memory area you want them in.

Read-Only
Author
Christoph Franck
Posted
3-Mar-2008 12:41 GMT
Toolset
C51
New! RE: Stack overflow.. please suggest

Now iam facing "Address space overflow" error. As per my understanding RAM area is not having enough space to fit all my data variables.

Does your assembly code make use of variable overlaying ? Variables whose lifetimes do not overlap can share the same memory location.

Read-Only
Author
Andy Neil
Posted
3-Mar-2008 13:21 GMT
Toolset
C51
New! Why do you say Stack overflow?

"Now iam facing 'Address space overflow' error. As per my understanding RAM area is not having enough space to fit all my data variables."

The message tells you specifically which address space has overflowed - are you sure it's data rather than code?

Read-Only
Author
tod woolem
Posted
3-Mar-2008 13:55 GMT
Toolset
C51
New! we need more infarmation!

are you using the rtos?

are the variables preserved in a code switch?

Read-Only
Author
Andy Neil
Posted
3-Mar-2008 14:33 GMT
Toolset
C51
New! RE: we need more infarmation!

"are you using the rtos?"

What RTOS?

Read-Only
Author
tod woolem
Posted
3-Mar-2008 15:10 GMT
Toolset
C51
New! RE: we need more infarmation!

what what rtos?

the one he might be using?

Read-Only
Author
Andy Neil
Posted
3-Mar-2008 15:34 GMT
Toolset
C51
New! RE: we need more infarmation!

OK - you said, "the RTOS" as if you knew specifically which one he might be using.

I guess that was just a problem with the translation into English?

Read-Only
Author
tod woolem
Posted
3-Mar-2008 15:43 GMT
Toolset
C51
New! RE: we need more infarmation!

...translation into english?

yes that must be it?

he still does not say if he uses rtos?

will he answer for us to see?

Read-Only
Author
erik malund
Posted
3-Mar-2008 15:44 GMT
Toolset
C51
New! look up OVERLAYABLE in the assembler manual

Is it possible by keeping mine as SMALL memory model and to shift Stack to extended RAM.

Read-Only
Author
Kevin B
Posted
3-Mar-2008 16:29 GMT
Toolset
C51
New! RE: Stack overflow.. please suggest

You said: "...Now I am facing "Address space overflow" error. As per my understanding RAM area is not having enough space to fit all my data variables."

Please post the original full error message.

It should look something like this:

*** ERROR L107: ADDRESS SPACE OVERFLOW
    SPACE:   DATA
    SEGMENT: _DATA_GROUP_
    LENGTH:  0014H

If you are receiving this error for the DATA space, you need to follow the instructions in this KB article:

http://www.keil.com/support/docs/1241.htm

Instead of changing the memory model, move some of your data variables to XDATA. Use the XDATA keyword when you define your global variable, or use the XDATA linker directive. See:

http://www.keil.com/support/man/docs/bl51/bl51_xdata.htm

Also under project -> Options for Target -> 'Target' tab, do you have 'Operating System' set to 'None'?

Read-Only
Author
erik malund
Posted
3-Mar-2008 17:05 GMT
Toolset
C51
New! not necessarily the best

Instead of changing the memory model, move some of your data variables to XDATA. Use the XDATA keyword when you define your global variable, or use the XDATA linker directive.
IDATA would be far better if he has room there. ALso many boards do not have XDATA

Erik

Read-Only
Author
Kevin B
Posted
3-Mar-2008 18:17 GMT
Toolset
C51
New! RE: not necessarily the best

Hello Erik,

You said:
IDATA would be far better if he has room there.

I agree, I should have been more clear that IDATA was an option as well.

Either XDATA or IDATA would work; it comes down to Raju's hardware implementation.

I wanted to make sure Raju saw the Keil documentation pertaining to his overflow issue.

Read-Only
Author
Raju dantuluri
Posted
5-Mar-2008 14:19 GMT
Toolset
C51
New! RE: Stack overflow.. please suggest

thanx kevin...
i declared some of the global variables as Xdata...
now i can able to compile properly..

Thanx to all for ur support...

Next Thread | Thread List | Previous Thread Start a Thread | Settings