www.pudn.com > LinkDrvDemo.rar > ADSP-TS101.ldf


 
ARCHITECTURE(ADSP-TS101) 
 
$USER_LIB = TSLinkDrv.dlb; 
 
#ifndef __NO_STD_LIB 
SEARCH_DIR( $ADI_DSP/TS/lib ) 
#endif 
 
// Set this macro if you want to use the run-time support libraries that 
// contain workarounds, including not using predicted branches. 
//          "-flags-link -MD__WORKAROUNDS_ENABLED" 
//   in the IDDE, add -MD__WORKAROUNDS_ENABLED to the linker additional 
//   options. 
// For ADSP-TS101 no silicon revision or silicon revisions 0.2 and  
// later this option is not passed to the linker by default. 
 
#ifndef __WORKAROUNDS_ENABLED 
#define _PREDICTED_BRANCH_LIBS 
#endif  // !__WORKAROUNDS_ENABLED 
 
// Libsim provides fast, mostly host emulated IO only supported by 
// the simulator. The libio library provides IO processing (including  
// file support) mostly done by the TigerSHARC target that is supported  
// by the emulator and simulator. Libio together with libsim is the  
// default used, but if __USING_LIBSIM is defined only libsim will be used. 
//   From the driver command line, use options, 
//          "-flags-link -MD__USING_LIBSIM=1" 
//   in the IDDE, add -MD__USING_LIBSIM=1 to the linker additional 
//   options 
 
#ifndef __USING_LIBSIM 
#ifdef _PREDICTED_BRANCH_LIBS 
 #ifdef __TS_BYTE_ADDRESS 
  $IOLIB     = libio_TS101_ba.dlb; 
  $IOLIB_MT  = libio_TS101_mt_ba.dlb; 
 #else 
  // default option, using libio and libsim 
  $IOLIB     = libio_TS101.dlb; 
  $IOLIB_MT  = libio_TS101_mt.dlb.dlb; 
 #endif  // __TS_BYTE_ADDRESS 
#else 
 #ifdef __TS_BYTE_ADDRESS 
  $IOLIB     = libio_TS101_ba_np.dlb; 
  $IOLIB_MT  = libio_TS101_mt_ba_np.dlb; 
 #else 
  $IOLIB     = libio_TS101_np.dlb; 
  $IOLIB_MT  = libio_TS101_mt_np.dlb; 
 #endif  // __TS_BYTE_ADDRESS 
#endif  // _PREDICTED_BRANCH_LIBS 
#else   
  // using only libsim 
  $IOLIB     = ; 
  $IOLIB_MT  = ; 
#endif //  __USING_LIBSIM 
 
$MEMINIT = meminit_ts101.doj; 
$MEMINIT_NP = meminit_ts101_np.doj; 
 
#ifdef __TS_BYTE_ADDRESS 
$LIBC = libc_TS101_ba.dlb; 
$LIBC_MT =  libc_TS101_mt_ba.dlb; 
$LIBC_NP = libc_TS101_ba_np.dlb; 
$LIBC_MT_NP =  libc_TS101_mt_ba_np.dlb; 
$LIBDSP    =  libdsp_TS101_ba.dlb; 
$LIBDSP_NP =  libdsp_TS101_ba_np.dlb; 
#ifdef __cplusplus 
#ifdef __exceptions 
$LIBCPP       = libx_TS101_ba.dlb, libcpp_TS101_x_ba.dlb, libcpprt_TS101_x_ba.dlb; 
$LIBCPP_MT    = libx_TS101_mt_ba.dlb, libcpp_TS101_x_mt_ba.dlb, libcpprt_TS101_x_mt_ba.dlb; 
$LIBCPP_NP    = libx_TS101_ba_np.dlb, libcpp_TS101_x_ba_np.dlb, libcpprt_TS101_x_ba_np.dlb; 
$LIBCPP_MT_NP = libx_TS101_mt_ba_np.dlb, libcpp_TS101_x_mt_ba_np.dlb, libcpprt_TS101_x_mt_ba_np.dlb; 
#else 
$LIBCPP       = libx_TS101_ba.dlb, libcpp_TS101_ba.dlb, libcpprt_TS101_ba.dlb; 
$LIBCPP_MT    = libx_TS101_mt_ba.dlb, libcpp_TS101_mt_ba.dlb, libcpprt_TS101_mt_ba.dlb; 
$LIBCPP_NP    = libx_TS101_ba_np.dlb, libcpp_TS101_ba_np.dlb, libcpprt_TS101_ba_np.dlb; 
$LIBCPP_MT_NP = libx_TS101_mt_ba_np.dlb, libcpp_TS101_mt_ba_np.dlb, libcpprt_TS101_mt_ba_np.dlb; 
#endif 
$EXIT         = ts_exit_cpp_TS101_ba.doj; 
$EXIT_MT      = ts_exit_cpp_TS101_mt_ba.doj; 
$EXIT_NP      = ts_exit_cpp_TS101_ba_np.doj; 
$EXIT_MT_NP   = ts_exit_cpp_TS101_mt_ba_np.doj; 
$HDR          = ts_hdr_cpp_TS101_ba.doj; 
$HDR_MT       = ts_hdr_cpp_TS101_mt_ba.doj; 
$HDR_NP       = ts_hdr_cpp_TS101_ba_np.doj; 
$HDR_MT_NP    = ts_hdr_cpp_TS101_mt_ba_np.doj; 
#else 
$LIBCPP       = libcpprt_TS101_ba.dlb; 
$LIBCPP_MT    = libcpprt_TS101_mt_ba.dlb; 
$LIBCPP_NP    = libcpprt_TS101_ba_np.dlb; 
$LIBCPP_MT_NP = libcpprt_TS101_mt_ba_np.dlb; 
$EXIT         = ts_exit_TS101_ba.doj; 
$EXIT_MT      = ts_exit_TS101_mt_ba.doj; 
$EXIT_NP      = ts_exit_TS101_ba_np.doj; 
$EXIT_MT_NP   = ts_exit_TS101_mt_ba_np.doj; 
$HDR          = ts_hdr_TS101_ba.doj; 
$HDR_MT       = ts_hdr_TS101_mt_ba.doj; 
$HDR_NP       = ts_hdr_TS101_ba_np.doj; 
$HDR_MT_NP    = ts_hdr_TS101_mt_ba_np.doj; 
#endif  // __cplusplus 
#else 
$LIBC = libc_TS101.dlb; 
$LIBC_MT = libc_TS101_mt.dlb; 
$LIBC_NP = libc_TS101_np.dlb; 
$LIBC_MT_NP = libc_TS101_mt_np.dlb; 
$LIBDSP    =  libdsp_TS101.dlb; 
$LIBDSP_NP =  libdsp_TS101_np.dlb; 
#ifdef __cplusplus 
#ifdef __exceptions 
$LIBCPP       = libx_TS101.dlb, libcpp_TS101_x.dlb, libcpprt_TS101_x.dlb; 
$LIBCPP_MT    = libx_TS101_mt.dlb, libcpp_TS101_x_mt.dlb, libcpprt_TS101_x_mt.dlb; 
$LIBCPP_NP    = libx_TS101_np.dlb, libcpp_TS101_x_np.dlb, libcpprt_TS101_x_np.dlb; 
$LIBCPP_MT_NP = libx_TS101_mt_np.dlb, libcpp_TS101_mt_np.dlb, libcpprt_TS101_x_mt_np.dlb; 
#else 
$LIBCPP       = libx_TS101.dlb, libcpp_TS101.dlb, libcpprt_TS101.dlb; 
$LIBCPP_MT    = libx_TS101_mt.dlb, libcpp_TS101_mt.dlb, libcpprt_TS101_mt.dlb; 
$LIBCPP_NP    = libx_TS101_np.dlb, libcpp_TS101_np.dlb, libcpprt_TS101_np.dlb; 
$LIBCPP_MT_NP = libx_TS101_mt_np.dlb, libcpp_TS101_mt_np.dlb, libcpprt_TS101_mt_np.dlb; 
#endif 
$EXIT         = ts_exit_cpp_TS101.doj; 
$EXIT_MT      = ts_exit_cpp_TS101_mt.doj; 
$EXIT_NP      = ts_exit_cpp_TS101_np.doj; 
$EXIT_MT_NP   = ts_exit_cpp_TS101_mt_np.doj; 
$HDR          = ts_hdr_cpp_TS101.doj; 
$HDR_MT       = ts_hdr_cpp_TS101_mt.doj; 
$HDR_NP       = ts_hdr_cpp_TS101_np.doj; 
$HDR_MT_NP    = ts_hdr_cpp_TS101_mt_np.doj; 
#else 
$LIBCPP       = libcpprt_TS101.dlb; 
$LIBCPP_MT    = libcpprt_TS101_mt.dlb; 
$LIBCPP_NP    = libcpprt_TS101_np.dlb; 
$LIBCPP_MT_NP = libcpprt_TS101_mt_np.dlb; 
$EXIT         = ts_exit_TS101.doj; 
$EXIT_MT      = ts_exit_TS101_mt.doj; 
$EXIT_NP      = ts_exit_TS101_np.doj; 
$EXIT_MT_NP   = ts_exit_TS101_mt_np.doj; 
$HDR          = ts_hdr_TS101.doj; 
$HDR_MT       = ts_hdr_TS101_mt.doj; 
$HDR_NP       = ts_hdr_TS101_np.doj; 
$HDR_MT_NP    = ts_hdr_TS101_mt_np.doj; 
#endif  // __cplusplus 
#endif  // __TS_BYTE_ADDRESS 
 
// Libraries from the command line are included in COMMAND_LINE_OBJECTS. 
// The order of the default libraries within $OBJECTS is header/startup,  
// libc, I/O libraries, libdsp, libcpp and exit routine.  
// This order has to be maintained. 
 
#ifdef _PREDICTED_BRANCH_LIBS 
#ifdef _ADI_THREADS 
  // This list describes the libraries/ object files used to build programs 
  // with thread support. Any custom file that falls into this category  
  // should be added here. 
  $OBJECTS = $HDR_MT, $COMMAND_LINE_OBJECTS, $MEMINIT, $EXIT_MP; 
  $LIBRARIES = $LIBC_MT, $IOLIB_MT, $LIBDSP, $USER_LIB, 
               $LIBCPP_MT, libsim.dlb; 
#else 
  // This list describes the libraries/ object files used to build programs 
  // without thread support. Any custom file that falls into this category 
  // should be added here. 
  $OBJECTS = $HDR, $COMMAND_LINE_OBJECTS, $MEMINIT, $EXIT; 
  $LIBRARIES = $LIBC, $IOLIB,  $LIBDSP, $USER_LIB, 
               $LIBCPP, libsim.dlb; 
#endif  // _ADI_THREADS 
#else  // _PREDICTED_BRANCH_LIBS 
#ifdef _ADI_THREADS 
  // This list describes the libraries/ object files used to build programs 
  // with thread support. Any custom file that falls into this category  
  // should be added here. 
  $OBJECTS = $HDR_MT_NP, $COMMAND_LINE_OBJECTS, $MEMINIT_NP, $EXIT_MT_NP; 
  $LIBRARIES = $LIBC_MT_NP, $IOLIB_MT, $LIBDSP_NP, 
               $LIBCPP_MT_NP, libsim.dlb; 
#else   
  // This list describes the libraries/ object files used to build programs 
  // without thread support. Any custom file that falls into this category 
  // should be added here. 
  $OBJECTS = $HDR_NP, $COMMAND_LINE_OBJECTS, $MEMINIT_NP, $EXIT_NP; 
  $LIBRARIES = $LIBC_NP, $IOLIB,  $LIBDSP_NP, $USER_LIB, 
               $LIBCPP_NP, libsim.dlb; 
#endif  // _ADI_THREADS 
#endif  // _PREDICTED_BRANCH_LIBS 
 
 
// Internal memory blocks are 0x10000 (64k) 
 
MEMORY 
  
{ 
    M0Code      { TYPE(RAM) START(0x00000000) END(0x0000FFFF) WIDTH(32) } 
     
    M1Data      { TYPE(RAM) START(0x00080000) END(0x0008BFFF) WIDTH(32) } 
    M1Heap      { TYPE(RAM) START(0x0008C000) END(0x0008C7FF) WIDTH(32) } 
    M1Stack     { TYPE(RAM) START(0x0008C800) END(0x0008FFFF) WIDTH(32) } 
     
    M2Data      { TYPE(RAM) START(0x00100000) END(0x0010BFFF) WIDTH(32) } 
    M2Stack     { TYPE(RAM) START(0x0010C000) END(0x0010FFFF) WIDTH(32) } 
     
    SDRAM       { TYPE(RAM) START(0x04000000) END(0x07FFFFFF) WIDTH(32) } 
    MS0         { TYPE(RAM) START(0x08000000) END(0x0BFFFFFF) WIDTH(32) } 
    MS1         { TYPE(RAM) START(0x0C000000) END(0x0FFFFFFF) WIDTH(32) } 
     
// Memory blocks need to be less than 2 Gig. 
    HOST        { TYPE(RAM) START(0x10000000) END(0x2FFFFFFF) WIDTH(32) } 
    HOST1       { TYPE(RAM) START(0x30000000) END(0x4FFFFFFF) WIDTH(32) } 
    HOST2       { TYPE(RAM) START(0x50000000) END(0x6FFFFFFF) WIDTH(32) } 
    HOST3       { TYPE(RAM) START(0x70000000) END(0x8FFFFFFF) WIDTH(32) } 
    HOST4       { TYPE(RAM) START(0x90000000) END(0xAFFFFFFF) WIDTH(32) } 
    HOST5       { TYPE(RAM) START(0xB0000000) END(0xCFFFFFFF) WIDTH(32) } 
    HOST6       { TYPE(RAM) START(0xD0000000) END(0xEFFFFFFF) WIDTH(32) } 
    HOST7       { TYPE(RAM) START(0xF0000000) END(0xFFFFFFFF) WIDTH(32) } 
} 
 
PROCESSOR p0 
{ 
#ifdef IDDE_ARGS 
      RESOLVE(___argv_string, ARGV_START) 
#endif 
          RESOLVE( _____system_start, 0x00000000 ) 
          KEEP( _____system_start, _main, ___ctor_end, __sw_handler_ctor ) 
 
    OUTPUT( $COMMAND_LINE_OUTPUT_FILE ) 
 
    SECTIONS 
    { 
        code 
        { 
            FILL(0xb3c00000) 
            INPUT_SECTION_ALIGN(4) 
            INPUT_SECTIONS( $OBJECTS(program) $LIBRARIES(program) ) 
            // The next line adds 8 nops to the end of the code section. 
            // This is required on TS101 to prevent uninitialised memory 
            // getting into the pipeline. 
            . = . + 8; 
        } >M0Code 
 
        // Provide support for initialization, including C++ static 
        // initialization. This section builds a table of 
        // initialization function pointers. These functions are 
        // called in order before the main routine is entered. The 
        // order is determined by the linker section in which the 
        // function pointer has been defined: the C library uses 
        // ctor0 through ctor4, and the compiler uses ctor for C++ 
        // static initializers. The C library uses several sections 
        // to satisfy ordering requirements among initializers. 
 
        ctor 
        { 
            INPUT_SECTIONS( $OBJECTS(ctor0) $LIBRARIES(ctor0) ) 
            INPUT_SECTIONS( $OBJECTS(ctor1) $LIBRARIES(ctor1) ) 
            INPUT_SECTIONS( $OBJECTS(ctor2) $LIBRARIES(ctor2) ) 
            INPUT_SECTIONS( $OBJECTS(ctor3) $LIBRARIES(ctor3) ) 
            INPUT_SECTIONS( $OBJECTS(ctor4) $LIBRARIES(ctor4) ) 
            INPUT_SECTIONS( $OBJECTS(ctor) $LIBRARIES(ctor) ) 
            INPUT_SECTIONS( $OBJECTS(ctorl) $LIBRARIES(ctorl) ) 
        } >M1Data 
 
 
        // Table containing heap segment descriptors 
        heaptab 
        { 
            INPUT_SECTIONS( $OBJECTS(heaptab) $LIBRARIES(heaptab) ) 
        } >M1Data 
 
        data1 
        { 
            INPUT_SECTIONS( $OBJECTS(data1) $LIBRARIES(data1) ) 
        } >M1Data 
 
 
        bsz_init 
        { 
            INPUT_SECTIONS( $OBJECTS(bsz_init) $LIBRARIES(bsz_init)) 
        } >M1Data 
 
        .meminit {} >M1Data 
 
        bsz ZERO_INIT 
        { 
            INPUT_SECTIONS( $OBJECTS(bsz) $LIBRARIES(bsz) ) 
        } >M1Data 
 
        MEM_ARGV 
        { 
            INPUT_SECTIONS( $OBJECTS(MEM_ARGV) $LIBRARIES(MEM_ARGV) ) 
        } >M1Data 
         
         
#ifdef __cplusplus 
    .gdt 
    { 
      INPUT_SECTIONS( $OBJECTS(.gdt) $LIBRARIES(.gdt) ) 
      INPUT_SECTIONS( $OBJECTS(.gdtl) $LIBRARIES(.gdtl) ) 
    } > M1Data 
 
    .frt 
    { 
      INPUT_SECTIONS( $OBJECTS(.frt) $LIBRARIES(.frt) ) 
      INPUT_SECTIONS( $OBJECTS(.frtl) $LIBRARIES(.frtl) ) 
    } > M1Data 
 
    .cht 
    { 
      INPUT_SECTIONS( $OBJECTS(.cht) $LIBRARIES(.cht) ) 
    } > M1Data 
 
    .edt 
    { 
      INPUT_SECTIONS( $OBJECTS(.edt) $LIBRARIES(.edt) ) 
    } > M1Data 
#endif 
        data2 
        { 
            INPUT_SECTIONS( $OBJECTS(data2) $LIBRARIES(data2) ) 
        } >M2Data 
 
 
        // Allocate stacks for the application. Note that stacks 
        // grow downward, and must be quad-word aligned. This means 
        // that the location just after the highest word of the stack 
        // is quad-word aligned (evenly divisible by 4). There are two 
        // labels for each stack: "*_base" is the location just ABOVE 
        // the top of the stack, and "*_limit" is the lowest word that 
        // is part of the stack. Each stack occupies all of its own 
        // memory block. 
 
        jstackseg 
        { 
            ldf_jstack_limit = .; 
            ldf_jstack_base = . + MEMORY_SIZEOF(M1Stack); 
        } >M1Stack 
 
        kstackseg 
        { 
            ldf_kstack_limit = .; 
            ldf_kstack_base = . + MEMORY_SIZEOF(M2Stack); 
        } >M2Stack 
 
        // The default heap occupies its own memory block 
        defheapseg 
        { 
            ldf_defheap_base = .; 
            ldf_defheap_size = MEMORY_SIZEOF(M1Heap); 
        } >M1Heap 
    } 
}