DSPRelated.com
Forums

global variable not accessible!

Started by Saqib Ali November 11, 2002
hi

i have been coding on the code composer in the emulator . my project contains 4
source files . i have a global variable in teh file containong main ... but when
i try to access it through the sub routine which is present in the other file ,
in which the global variable is refrenced as extern , it dont take the value , i
have enabled teh file-level optimization in te compiler options ... anybody have
any idea ?

Saqib



Hello Saqib

1- Global variables are typicaly loaded using direct addressing. Make sure
the DP register is correct or has not been corrupted

2- Have you linked the correct RTS libraries. Mixing large/small memory
models and or libraries with the non-matching register passing can lead to
side effects.

3- You did not say exactly what was not working, but if this involves a math
function other than the base add/sub/mpy functions (EG handled in hardware),
you might need to add #inclide <math.h> to the top of your file. This
compiler does not report missing prototype functions (an interesting
loop-hool in the old ANSI-C standards). If no prototype is known, the
compiler will assume integer input and outputs per the count of the calling
function.

4- Tell the linker create a map file for you and make sure the variables
storage location looks sensible. Might be reserved or non-existing memory?

5- Open (or relocate) a memory window at that location. You should see the
variable name and you should be able to edit the displayed data.

Hope this helps,
Keith Larson
====================================
At 01:58 PM 11/11/02 -0800, you wrote:
>hi
>
>i have been coding on the code composer in the emulator . my project
contains 4 source files . i have a global variable in teh file containong
main ... but when i try to access it through the sub routine which is
present in the other file , in which the global variable is refrenced as
extern , it dont take the value , i have enabled teh file-level optimization
in te compiler options ... anybody have any idea ?
>
>Saqib
+-----------+
|Keith Larson |
|Member Group Technical Staff |
|Texas Instruments Incorporated |
| |
| 281-274-3288 |
| |
| www.micro.ti.com/~klarson |
|-----------+
| TMS320C3x/C4x/VC33 Applications |
| |
| TMS320VC33 |
| The lowest cost and lowest power 500 w/Mflop |
| floating point DSP on the planet! |
+-----------+