This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Viewing struct data during debug

Hi,

I am a new user of Keil C compiler.
During debug, I am trying to watch struct data members. But all of them show 0x0000. And they are not updated. With other variables it's just working fine.

Any suggestions?

Thanks,
Titu

Parents
  • "don't use the word static when declaring the item in your c-file but instead declare it as external in the header file belonging to that c file."

    Let's get the terminology correct here:

    "don't use the word static when defining the item in your c-file but declare it as external in the header file belonging to that c file."

    In other words:

    The definition needs to be in exactly one .c file - without the 'static' keyword;

    The 'extern' declaration should be in the header file.

    Remember:

    The definition is what actually creates the item - this is what causes memory to be allocated;

    The declaration merely provides information for other modules that need to access the item - it causes no memory allocation.

Reply
  • "don't use the word static when declaring the item in your c-file but instead declare it as external in the header file belonging to that c file."

    Let's get the terminology correct here:

    "don't use the word static when defining the item in your c-file but declare it as external in the header file belonging to that c file."

    In other words:

    The definition needs to be in exactly one .c file - without the 'static' keyword;

    The 'extern' declaration should be in the header file.

    Remember:

    The definition is what actually creates the item - this is what causes memory to be allocated;

    The declaration merely provides information for other modules that need to access the item - it causes no memory allocation.

Children
  • Let's get the terminology correct here:

    "don't use the word static when defining the item in your c-file but declare it as external in the header file belonging to that c file."

    In other words:

    The definition needs to be in exactly one .c file - without the 'static' keyword;

    The 'extern' declaration should be in the header file.


    You've put it in an more correct context, Andy, which is absolutely OK.
    But you understood what I was trying to explain, and that's the most important for me! ;-)

    -- Geert