Keil™, An ARM® Company

Discussion Forum

pointer cannot cross 64k boundary

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

DetailsMessage
Read-Only
Author
Puzzled me
Posted
2-Feb-2007 06:20 GMT
Toolset
C51
New! pointer cannot cross 64k boundary

I have a big problem with the compiler. It cannot point to the correct location. When I declared a pointer to a structure in EEPROM and try to access a member within it, the member pointed to is incorrect. Seems that it cannot add the offset address to the base address of the structure correctly especially when we are at the boundary of a sector/segment.

Has anyone encountered this? Any quick fix?

Eg,

struct A
{ char x; int y;
}

A EEPROM* Var;

Var->y

Read-Only
Author
Thomas Brandl
Posted
2-Feb-2007 09:24 GMT
Toolset
C51
New! RE: pointer cannot cross 64k boundary

To analyse your problem, one needs at least the memory model you're using, the linker settings and the exact code snippets.

Read-Only
Author
erik malund
Posted
2-Feb-2007 15:27 GMT
Toolset
C51
New! RE: pointer cannot cross 64k boundary

I do not know about pointers, but offsets as in Ralph[offset] do not push the addressed item across a boundary, it 'folds' instead.

Erik

Read-Only
Author
Suvidh Kankariya
Posted
2-Feb-2007 15:58 GMT
Toolset
C51
New! RE: pointer cannot cross 64k boundary

It Might be the case that the pointer is 16 bit by default for your compiler.

Suvidh

Read-Only
Author
Per Westermark
Posted
2-Feb-2007 16:31 GMT
Toolset
C51
New! RE: pointer cannot cross 64k boundary

do not push the addressed item across a boundary, it 'folds' instead.

Actually it wraps around.

Doesn't folding specifically mean something that reaches a limit, and then reverses direction? An example is a digital filter, when the input frequency is above the Nyquist frequency.

Read-Only
Author
Andy Neil
Posted
2-Feb-2007 17:05 GMT
Toolset
C51
New! Fold or wrap

"Doesn't folding specifically mean something that reaches a limit, and then reverses direction?"

No, I don't think there is any such specific definition!

I took Erik's "fold" to mean "wrap" - I'm sure he'll clarify...

"An example is a digital filter..."

Maybe "folding" does have a specific meaning in the specific context of digital filters...

Read-Only
Author
erik malund
Posted
5-Feb-2007 15:46 GMT
Toolset
C51
New! RE: Fold or wrap

well, one Dane (I guess) correcting another danes English, what a situation.

Yoe, I should have used 'wrap' instead of 'fold'

Erik

Read-Only
Author
Per Westermark
Posted
5-Feb-2007 16:42 GMT
Toolset
C51
New! RE: Fold or wrap

Just a bit to thw east and quite a bit to the north actually :)

700km north of Stockholm.

Read-Only
Author
erik malund
Posted
5-Feb-2007 17:54 GMT
Toolset
C51
New! RE: Fold or wrap

Exculse my mistake. I tend to recall that the Danish 'Per" usually is spelled 'Pär' in Sweden.

anyhow, "a Swede correcting a Danes English"
is equally ironic.

Jag hoppas du maar bra

Erik

Read-Only
Author
Per Westermark
Posted
6-Feb-2007 02:50 GMT
Toolset
C51
New! RE: Fold or wrap

Tack, mycket bra :)

Soon banned for off-topic posts though...

We use both spellings in Sweden.

By the way: in many forums it is often the natives who have the most spelling and grammar errors.

Read-Only
Author
Andy Neil
Posted
7-Feb-2007 07:34 GMT
Toolset
C51
New! It's in the knowledgebase

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

"The far data pointer type is only 16 bits long, so it can only 'see' 64k of space."

and

"There is no pointer type, in C51, that can see more than 64k of data space at a time."

But see the article for possible workarounds...

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