cancel
Showing results for 
Search instead for 
Did you mean: 

end address of .share region

sjayapal
Associate II
Posted on March 23, 2006 at 00:34

end address of .share region

5 REPLIES 5
sjayapal
Associate II
Posted on March 22, 2006 at 08:42

Micro used - ST7FL35

Compiler used - Cosmic

Memory Model used - Medium Memory Model

Is there a way to store the end address of the .share region generated in a variable?

Learning this value from the linker file did not help. I had given like below in my linker file and expected _share to hold the end address of the .share region but it did not help

+def __share=@.share # end of share segment

Regards,

Suganya

:)

luca239955_st
Associate III
Posted on March 22, 2006 at 09:34

it should work.

Of course it also depends on where and how you use it; if that's in crtsx, make sure that this file is the first in the list of the files to be linked (as I answered in the thread about crtsx and the bss address).

Regards,

Luca

sjayapal
Associate II
Posted on March 22, 2006 at 09:47

Luca,

As said i am acessing it in the crtsx file and it is first in the list of the files to be linked, but i get __share assigned with the start value of the share region instead of the end address.

Any suggestions ???

-Suganya

luca239955_st
Associate III
Posted on March 22, 2006 at 12:41

Suganya,

sorry, my previous answer was too quick.

The syntax you have tried works for ''normal'' segments, but not for the shared segment, as this segment is built by the linker and its start and end addresses are not yet known when the +def is evaluated.

In order to get the end address of the .share segment, you can define an empty data segment, append it to the .share and use that address instead:

In the linker file:

....

+seg .share -a iram -n share -is # shared segment

+seg .prova -a share # empty segment

....

+def __endshare=@.prova

In the initialisaton file:

...

xref.b c_x, c_y, __endzp, __endshare

...

ld a,#__endshare

...

I've just tried and it works as expected.

Regards,

Luca (Cosmic)

sjayapal
Associate II
Posted on March 23, 2006 at 00:34

Thank You !!!

It worked !!!

-Suganya :D