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.

Problem with linker



Hi! I have C5515 eZdsp USB Stick and I'm trying to use hwafft_br and hwafft functions (calling from ROM)
So I read some usefull documentation about FFT Implementation on C5515 DSP and Chapter 8 from "Assembly Language Tools, User’s Guide" but faced with the one problem.  
Here's my "c5515.cmd" file.

MEMORY
{
    MMR     (RW)  : origin = 0000000h length = 0000c0h       /* MMRs */
    /*DARAM (RW)  : origin = 00000c0h length = 00ff40h*/     /* on-chip DARAM */
    DARAM_0 (RW)  : origin = 00000c0h length = 001f40h
    DARAM_1 (RW)  : origin = 0002000h length = 002000h
    DARAM_2 (RW)  : origin = 0004000h length = 002000h
    DARAM_3 (RW)  : origin = 0006000h length = 002000h
    DARAM   (RW)  : origin = 0008000h length = 008000h
    
    SARAM   (RW)  : origin = 0010000h length = 040000h        /* on-chip SARAM */

    SAROM_0 (RX)  : origin = 0fe0000h length = 008000h 	      /* on-chip ROM 0 */
    SAROM_1 (RX)  : origin = 0fe8000h length = 008000h 	      /* on-chip ROM 1 */
    SAROM_2 (RX)  : origin = 0ff0000h length = 008000h 	      /* on-chip ROM 2 */
    SAROM_3 (RX)  : origin = 0ff8000h length = 008000h 	      /* on-chip ROM 3 */
    
    EMIF_CS0 (RW)  : origin = 0050000h  length = 07B0000h     /* mSDR */ 
    EMIF_CS2 (RW)  : origin = 0800000h  length = 0400000h     /* ASYNC1 : NAND */ 
    EMIF_CS3 (RW)  : origin = 0C00000h  length = 0200000h     /* ASYNC2 : NAND */
    EMIF_CS4 (RW)  : origin = 0E00000h  length = 0100000h     /* ASYNC3 : NOR  */
    EMIF_CS5 (RW)  : origin = 0F00000h  length = 00E0000h     /* ASYNC4 : SRAM */

}
 
 
SECTIONS
{

    vectors (NOLOAD)
    .bss        : > DARAM      /*, fill = 0 */
    vector      : > DARAM      ALIGN = 256 
    .stack      : > DARAM  
    .sysstack   : > DARAM  
    .sysmem     : > DARAM 
    .text       : > SARAM  
    .data       : > DARAM
    .cinit      : > DARAM
    .const      : > DARAM
    .cio	: > DARAM
    .usect      : > DARAM
    .switch     : > DARAM 
    .emif_cs0   : > EMIF_CS0
    .emif_cs2   : > EMIF_CS2
    .emif_cs3   : > EMIF_CS3
    .emif_cs4   : > EMIF_CS4
    .emif_cs5   : > EMIF_CS5
	
    data_buf    : > DARAM_1
    data_br_buf : > DARAM_2	
    scratch_buf : > DARAM_3
	
}
/* C5505/C5515 (PG2.0)  */
/* Hardware accelerated FFT ROM table addresses */
 _hwafft_br      = 0x00ff6cd6; 
 _hwafft_8pts    = 0x00ff6cea; 
 _hwafft_16pts   = 0x00ff6dd9; 
 _hwafft_32pts   = 0x00ff6f2f; 
 _hwafft_64pts   = 0x00ff7238; 
 _hwafft_128pts  = 0x00ff73cd; 
 _hwafft_256pts  = 0x00ff75de; 
 _hwafft_512pts  = 0x00ff77dc; 
 _hwafft_1024pts = 0x00ff7a56; 
 
And that's what I got when the program starts.
My question is why data_buf,data_br_buf,scratch_buf  are placed at addresses I did not expect?
(0x00004000, 0x00004102 and  0x00004204) instead of  DARAM_1 ,DARAM_2, DARAM_3 (0x00002000, 0x00004000 and  0x00006000)

 

 
Best regards,

Nick

  • First of all, remember that the C55x data addresses (16-bit units) are half what the equivalent code address (8-bit units) would be, and in the linker, all addresses are dealt with as code addresses (8-bit units).  So, a data address of 0x4000 is equivalent to a code address of 0x8000.  Those three symbols are actually showing up in DARAM, which is what I'd expect of a variable stored in .bss, which is probably where they are.

    Secondly, the linker places code and data by sections, not by symbols.  You'll need to use a #pragma DATA_SECTION to place your object data_buf in a section named data_buf, otherwise the compiler will put it into .bss

  • Good answer!

    Adding the #pragma DATA_SECTION lines like below should fix it.

    #pragma DATA_SECTION(data_br_buf, "data_br_buf");
    Int32 data_br_buf[DATA_LEN];
    #pragma DATA_SECTION(scratch_buf, "scratch_buf");
    Int32 scratch_buf[DATA_LEN];

    Hope this helps,
    Mark