cancel
Showing results for 
Search instead for 
Did you mean: 

global bit declaration problem

y_gudekar
Associate II
Posted on May 09, 2006 at 08:09

global bit declaration problem

4 REPLIES 4
y_gudekar
Associate II
Posted on May 05, 2006 at 09:46

I am using st72f561 with cosmic compiler & STVD7 environment. I want to use global bit variables, hence I have edited the Linker file & it looks like this,

+seg .text -b 0x1000 -m 0xD000 -n .text

+seg .const -b 0xE000 -m 0x200 -n .const

+seg .bit -b 0x0080 -m 0x10 -n .bit -c

+seg .bsct -b 0x0090 -m 0x50 -n .bsct

+seg .ubsct -b 0x00E0 -m 0x1F -n .ubsct

+seg .share -a .ubsct -n .share -is

+seg .data -b 0x0200 -m 0x600 -n .data

+seg .bss -a .data -n .bss

The default linker file did not contain .bit segment, so I added the segment in the linker file. The compile, Build, Link went correct, w/o any error or wanrning.

The bit started behaving randomly, hence I checked the map file.

The map file was showing that it was mapped at the address of PFDDR:0.

How to avoid the problems related to globally declared bits??

At the same time, localy declared bits are working properly & they were not visible in the map file.

luca239955_st
Associate III
Posted on May 05, 2006 at 11:37

Hello,

if you want to specify an absolute address for the .bit section in the linker file, you have to use bit notation.

Replace

+seg .bit -b 0x0080 -m 0x10 -n .bit -c

with

+seg .bit -b 0x0080:0 -m 0x10 -n .bit -c

and it will probably work as you expect.

If you just append the .bit segment after another segment (make sure you are still in page 0), the compiler will calculate the right address by itself. More details in the manual.

Regards,

Luca (Cosmic)

y_gudekar
Associate II
Posted on May 08, 2006 at 12:44

Thank you Luca 🙂

We did the changes in the linker file as per suggested by you. The results are very good. The global bit is mapped exactly at 000080:0 & serving it's purpose perfectly. Thank you again.

Can you guide us towards any such document, in which such Compiler & Linker details are mentioned. We want to study this bit segemnt issue in detail to find out, where we went wrong in our approch to edit the linker file for the bit segment.

Regards,

Yogesh & Amit

luca239955_st
Associate III
Posted on May 09, 2006 at 08:09

look for ''bit segment handling'' in the compiler manual.

Regards,

Luca