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.

confused about .cmd files

I don't understand the first thing about .cmd files. Is there an easy-to-consume reference?

My program is growing larger and I believe I am seeing memory corruption since linking (and "adding a file") the DSPLIB library to my project. I believe I am seeing good results from DSPLIB's FFT functions, but other variables in my program seem to have garbage values.

Does adding a dependency change the memory organization? Can someone tell me what I might need to do? 

My .cmd file is as follows:

/* Welch, Wright, & Morrow, 					*/
/* Real-time Digital Signal Processing, 2011	*/


/*/////////////////////////////////////////////////////////////////////
// Filename: lnk6713.cmd
//
// Synopsis: Linker command file for 6713 DSK
//
/////////////////////////////////////////////////////////////////////*/-c
-heap  0x400
-stack 0x400 /* very large stack for DSP programs. */
-lrts6700.lib /* floating point library */
  
MEMORY
{
    vecs:       o = 00000000h   l = 00000200h
    IRAM:       o = 00000200h   l = 0003FE00h                           
    SDRAM:      o = 80000000h	l = 01000000h 
                
                                               
}

SECTIONS
{
    "vectors"   >       vecs 
    .cinit      >       IRAM
    .text       >       IRAM
    .stack      >       IRAM
    .bss        >       IRAM
    .const      >       IRAM
    .data       >       IRAM
    .far        >       IRAM
    .switch     >       IRAM
    .sysmem     >       IRAM
    .tables     >       IRAM
    .cio        >       IRAM
    "CE0"		>		SDRAM
}                             

 

I am using a daughter card for I/O, which has a MATLAB support library for communication via USB. I believe I do not link with any dependencies other than DSPLIB in my DSP application. The daughter card came with source files for all the DSKC6713 attributes and initialization procedures. I build the DSP application with CCS v6.0 and I upload and run the program using the daughter card's MATLAB support. I debug by using MATLAB to access variables in the DSP application's global address space. 

  • Linker command file should be in the compiler or assembler user guide. Good luck on that. The linker command script is probably the most arcane component of the build process.

    The linker will complain if there is not enough statically allocated memory for your code. Check the map file to see the allocation.

    You might be running out of dynamically allocated memory such as stack or heap. Stack usage is not so easy to predict. Heap usage is harder to predict. If you don't use malloc, the heap can be reduced. Try increasing the stack value. Especially if you declare big arrays locally in a function. The stack could grow downward into the heap or  .text or .cinit sections.