This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

manually written header files

Other Parts Discussed in Thread: CCSTUDIO

 hi all,

i am using CCStudio v5 . i am using c6000 series multicore DSP simulator. I've declared some global variables in the "Main.c " file. i need to use these variables throught my program. so i manually wrote header files , and declared the global variables with extern in these header files. and i've included these files wherever required.

Now the problem is that, these global variables are all taking zero (in the child functions , whre these are included)instead of the assigned values..


why is this happening?

thanks in advance,

phani

  • idid not encounter any error. i've declared he global variables and initialized them. but in the child functions when i am including this header file these same variables are becoming zeros.i.e, say in main.c i've declared

    int x=5


    and in headers.h

    extern int x;

    and when i try to use this in another function

    #include<headers.h>

    void sum()

    {

    if(x==5)

    {

    statements....

    }

    }

    the "IF block" is not being executed because x has become zero

  • I would expect this to work and the value of the variable to be 5 inside the sum() function. I tried creating a small simple exmaple and it worked. Are you sure the variable is declared globally and its value being set before the function call? 

    Which version of CCS and compiler tools are you using and which simulator?

  • i am using CCS version 5. C6670 device cycle approximate simulator. i also tried the sample code. it is working.

    But i have around 20 constants and seven look up tables in my program. while some are being recognized as actual value, sum are being taken as zeros by default. i've included the header files which contain the look up tables .  I've declared them as extern in headers.


    i dont know where it is going wrong. the same code is being executed in "Code Blocks".

  • I'm attaching a part of the code. please go through this. i've declared Nc as 1600 in main file as a global variable. whereas when i'm trying to print this value in the scrambler module , it is showing 0 or 1.

    for_ti.rar
  • Do you have a linker command file as part of your project? I noticed some issues with the value of Nc changing as well if there is no linker command file in the project. Try adding an appropriate linker command file to the project and see if that helps.

    If you are not sure where to get one, there is one for the C6678 included with CCS (see the file c6678_unified.cmd in the directory <ccs_install_dir>\ccsv5\ccs_base\c6000\include). You would need to check that the memory map defined in that file is accurate for C6670 as well. But I created a project in CCS 5.5, added your source files and this linker command file, built the project, and loaded the code to the simulator. I verified that the value of Nc at the call to Pusch_Scrambler and inside the routine is still 1600.

    I did have some trouble with the printfs but that is likely due to insufficient heap (you have a lot of printfs in your code which is going to require a lot of heap, so make sure you have a sufficiently large heap and stack size set in your project options).