Global & Static initialization problem

Hi,
I am developing a firmware for EZUSB FX based board. I am facing a small problem. I am not able to initialize a Global variable in my firmware. Even though I assign the global variable with 0 initial value, But the variable does not take that value. I am using SMALL memory model for my development.

my declerations looks like this :-
BYTE GlobalCount = 0;

and in my sof() I am using this variable and updating it and reusing it again in next sof().
Please advise ..

Rahul Gupta

Parents
  • Since GlobalCount is declared as follows:

    BYTE GlobalCount = 0;

    I have a few questions.

    1. Are you using LARGE memory model.

    2. Did you enable clearing of XDATA in your STARTUP code?

    3. Have you started the uVision Debugger (without running to main) and set a breakpoint on read or write accesses to GlobalCount? The debugger will halt execution whenever anything reads or writes this variable INCLUDING the initialization routines.

    Jon

Reply
  • Since GlobalCount is declared as follows:

    BYTE GlobalCount = 0;

    I have a few questions.

    1. Are you using LARGE memory model.

    2. Did you enable clearing of XDATA in your STARTUP code?

    3. Have you started the uVision Debugger (without running to main) and set a breakpoint on read or write accesses to GlobalCount? The debugger will halt execution whenever anything reads or writes this variable INCLUDING the initialization routines.

    Jon

Children
More questions in this forum