AnsweredAssumed Answered

Modify LDF for 21479

Question asked by Chris75 on Mar 14, 2012
Latest reply on Mar 29, 2012 by CraigG

Hi, in a previous project I have changed the LDF file for a 21364 Sharc Processor and all was working correctly.


Now I am trying to change the LDF file for a 21479 and I have some issues.


First when I create the LDF file for 21479, Expert Linker display the following error message :

Expert Linker failed to modify the default LDF file because it uses preprocessor macros extensively.


So I try to modify myself the default LDF file generated by VisualDSP.


I want to move the seg_pmda in another place to have more space for code.


Block 0

is ok for me, I want to place some code in the seg_int_code

Block 1

I want to move seg_stak in another place and add the seg_pmda in this block, so I have

seg_dmda and seg_pmda in this block

Block 2

I want to move seg_pmda in block 1 and create a new segment for my code (named alt_pmco).

Block 3

I want to add the seg_stak in this block, so I have

seg_heap + seg_stak


With this memory mapping I have two segments to place C++ code.


In my previous project I was placing some classes in seg_int_code and some classes in alt_pmco.


I want to do the same thing so I have modified the LDF file, but there is some differences with 21364.


Here is some of the LDF file which I was modified.


// The SHARC 21479 has 5Mbit RAM and 4Mbit ROM in total.
  // -------------------------- BLOCK 0 ----------------------------------------
  // 0x0008 C000 to 0x0009 3FFF  Normal word (48) Space (1.5 Mbit RAM)
  // 0x0009 2000 to 0x0009 DFFF  Normal word (32) Space (1.5 Mbit RAM)
  // 0x0012 4000 to 0x0013 BFFF  Short word  (16) Space (1.5 Mbit RAM)
  seg_rth      { TYPE(PM RAM) START(0x0008c000) END(0x0008c0ff) WIDTH(48) }
#ifdef __MEMINIT__
  seg_init     { TYPE(PM RAM) START(0x0008c100) END(0x0008c2ff) WIDTH(48) }
  seg_int_code { TYPE(SW RAM) START(0x00124900) END(0x0013Bfff) WIDTH(16) }
  seg_int_code { TYPE(SW RAM) START(0x00124300) END(0x0013BFFF) WIDTH(16) }
#endif // __MEMINIT__

  // -------------------------- BLOCK 1 ----------------------------------------
  // 0x000A C000 to 0x000B 3FFF  Normal word (48) Space (1.5 Mbit RAM)
  // 0x000B 2000 to 0x000B DFFF  Normal word (32) Space (1.5 Mbit RAM)
  // 0x0016 4000 to 0x0017 BFFF  Short word (16)  Space (1.5 Mbit RAM)
#ifdef IDDE_ARGS
#define ARGV_START 0xb2000
  mem_argv { TYPE(DM RAM) START(0x000b2000) END(0x000b20ff) WIDTH(32) }
  seg_dmda { TYPE(DM RAM) START(0x000b2100) END(0x000bbfff) WIDTH(32) }
  seg_dmda { TYPE(DM RAM) START(0x000b2000) END(0x000bbfff) WIDTH(32) }

  seg_pmda { TYPE(PM RAM) START(0x000bc000) END(0x000bdfff) WIDTH(32) }

  // -------------------------- BLOCK 2 ----------------------------------------
  // 0x000C 0000 to 0x000C 5554  Normal word (48) Space (1 Mbit RAM)
  // 0x000C 0000 to 0x000C 7FFF  Normal word (32) Space (1 Mbit RAM)
  // 0x0018 0000 to 0x0018 FFFF  Short word (16) Space (1 Mbit RAM)
  alt_pmco { TYPE(SW RAM) START(0x000c0000) END(0x000c7fff) WIDTH(32) }

  // ------------------------- BLOCK 3 -----------------------------------------
  // 0x000E 0000 to 0x000E 5554  Normal word (48) Space (1 Mbit RAM)
  // 0x000E 0000 to 0x000E 7FFF  Normal word (32) Space (1 Mbit RAM)
  // 0x001C 0000 to 0x001C FFFF  Short word (16)  Space (1 Mbit RAM)
  seg_heap { TYPE(DM RAM) START(0x000e0000) END(0x000e3fff) WIDTH(32) }
  seg_stak { TYPE(DM RAM) START(0x000e4000) END(0x000e7fff) WIDTH(32) }

  // ------------------------- SDRAM -------------------------------------------
  // 0x00200000 to 0x009FFFFF  Normal word (32) Space (32MB RAM) as found on the
  // ADSP-21479 Ez-Board.
  seg_ext_swco { TYPE(SW RAM) START(0x00600000) END(0x0065FFFF) WIDTH(16) }
  seg_ext_nwco { TYPE(PM RAM) START(0x00220000) END(0x0043FFFF) WIDTH(16) }
  seg_ext_dmda { TYPE(DM RAM) START(0x00660000) END(0x009FFFFF) WIDTH(16) }
  seg_ext_pmda { TYPE(DM RAM) START(0x00A00000) END(0x00AFFFFF) WIDTH(16) }

  seg_flash { TYPE(DM RAM) START(0x04000000) END(0x043FFFFF) WIDTH(8) }
  seg_sram { TYPE(DM RAM) START(0x0C000000) END(0x0C07FFFF) WIDTH(16) }
} /* MEMORY */


So I have added the following declaration, to place a class code in this segment.

seg_swco SW
            // now map the default code sections, sw first
            INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_swco))
            INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_pmco))
            //INPUT_SECTIONS( $OBJECTS(seg_swco) $LIBRARIES(seg_swco))
            //INPUT_SECTIONS( $OBJECTS(seg_pmco) $LIBRARIES(seg_pmco))


               INPUT_SECTIONS( main.doj(seg_pmco) $LIBRARIES(seg_swco))

               INPUT_SECTIONS( main.doj(seg_pmco) $LIBRARIES(seg_pmco))
        } > seg_int_code

        seg_pmco PM
            // now map the default code sections, pm after sw
            INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_pmco))
            //INPUT_SECTIONS( $OBJECTS(seg_pmco) $LIBRARIES(seg_pmco))


            INPUT_SECTIONS( main.doj(seg_pmco) $LIBRARIES(seg_pmco))
        } > seg_int_code




     // now map the default code sections

    INPUT_SECTIONS( Monitoring.doj(seg_pmco) )

} > alt_pmco


The problem is that the Expert Linker doesn't display where the classes are located in the segment.

It was correctly working with 21364, but now, I think my LDF isn't correct, and I don't know where the linker place my code.


It seem's that the memory map is correct, the segment are correctly placed in Expert Linker.