//-------------------------------------------------------------------------
//      XLINK command file template for V850E microcontroller uPD70F3454.
//
//      This file can be used to link object files from the V850E
//      Assembler, AV850, and the C/C++ compiler ICCV850.
//
//          This file is generated from the device file:
//          DF3454.800
//          Copyright (C) NEC Corporation 2007
//          Format version 2.20, File version 1.00 
//-------------------------------------------------------------------------

//-------------------------------------------------------------------------
//      The following segments are defined in this template link file:
//
//      INTVEC      -- Interrupt vectors.
//      TRAPVEC     -- Trap vector.
//      CLTVEC      -- Calltable vectors.
//      CSTART      -- The C/C++ startup code.
//      RCODE       -- Code used by C/C++ run-time library.
//      ICODE       -- Code used by interrupt functions.
//      CLTCODE     -- Code of calltable functions.
//      CODE        -- Program code.
//      DIFUNCT     -- Dynamic initialization vector used by C++
//      CSTACK      -- The stack used by C/C++ programs.
//      HEAP        -- The heap used for malloc and free
//      SADDR7_x    -- Variables used by __saddr (128 byte offset).
//      SADDR8_x    -- Variables used by __saddr (256 byte offset).
//      NEAR_x      -- Variables used by __near (must be +- 32KB from address 0).
//      BREL_x      -- Variables used by __brel.
//      HUGE_x      -- Variables used by __huge.
//
//      Where _x could be one of:
//
//      _BASE   -- An empty placeholder segment that should be placed
//                 in front of the other segments (SADDR and BREL).
//      _CBASE  -- An empty placeholder segment that should be placed
//                 in front of the other segments (BREL_C).
//      _Z      -- Initialized data (initvalue = 0 or without init value).
//      _I      -- Initialized data (initvalue != 0).
//      _ID     -- The inial values of _I.
//      _N      -- Uninitialized data, used by __no_init.
//      _C      -- Constants.
//
//      NOTE:   Be sure to use end values for the defined addresses.
//-------------------------------------------------------------------------

//-------------------------------------------------------------------------
//      Define CPU
//-------------------------------------------------------------------------
-cv850

//-------------------------------------------------------------------------
//      Size of the stack.
//      Remove comment and modify number if used from command line.
//-------------------------------------------------------------------------
//-D_CSTACK_SIZE=400

//-------------------------------------------------------------------------
//      Size of the heap.
//      Remove comment and modify number if used from command line.
//-------------------------------------------------------------------------
//-D_HEAP_SIZE=400

//-------------------------------------------------------------------------
//      Define the format functions used by printf/scanf.
//      Default is full formatting.
//      Remove appropriate comment(s) to get reduced formatting
//      if used from command line.
//-------------------------------------------------------------------------
//-e_PrintfTiny=_Printf
//-e_PrintfSmall=_Printf
//-e_PrintfLarge=_Printf

//-e_ScanfSmall=_Scanf
//-e_ScanfLarge=_Scanf

//-------------------------------------------------------------------------
//      Define if row buffering should be used by terminal output.
//      Default is no buffering.
//      Remove comment to get buffered terminal output if used from command line.
//-------------------------------------------------------------------------
//-e__write_buffered=__write

///////////////////////////////////////////////////////////////////////////
//      Allocate the read only segments that are mapped to ROM.
///////////////////////////////////////////////////////////////////////////

-Z(CODE)INTVEC=00000000-000007CF
-Z(CONST)SECUID=00000070-00000079

//-------------------------------------------------------------------------
//      BREL_CBASE is an empty placeholer segment, it should be placed in
//      front of the BREL_C segments holding constant data.
//-------------------------------------------------------------------------
-Z(CONST)NEAR_C=000007D0-00007FFF
-Z(CONST)BREL_CBASE,BREL_C=000007D0-0000FFFF
-Z(CONST)HUGE_C=000007D0-0003FFFB
-Z(CODE)CSTART,RCODE,ICODE,TRAPVEC,DIFUNCT=000007D0-0003FFFB
-Z(CONST)SADDR7_ID,SADDR8_ID,NEAR_ID,BREL_ID,HUGE_ID=000007D0-0003FFFB
-Z(CONST)CLTVEC=000007D0-0003FFFB

-Z(CODE)CLTCODE,CODE=000007D0-0003FFFB

//-------------------------------------------------------------------------
//      The CHECKSUM segment must be defined when ROM checksum should
//      be generated.
//-------------------------------------------------------------------------
-Z(CONST)CHECKSUM=0003FFFC-0003FFFF

///////////////////////////////////////////////////////////////////////////
//      Allocate the read/write segments that are mapped to RAM.
///////////////////////////////////////////////////////////////////////////

//-------------------------------------------------------------------------
//      Short loads relative from EP with 7 and 8 bit offset.
//
//      SADDR_BASE is an empty segment that mark the beginning of the saddr
//      data segments.
//-------------------------------------------------------------------------
-Z(DATA)SADDR_BASE=FFFFC000
-Z(DATA)SADDR7_I,SADDR7_Z,SADDR7_N=FFFFC000-FFFFC07F
-Z(DATA)SADDR8_I,SADDR8_Z,SADDR8_N=FFFFC000-FFFFC0FF

//-------------------------------------------------------------------------
//      16-bit access from GP.
//      BREL_BASE is an empty placeholer segment, it should be placed in
//      front of the DATA (i.e. RAM) BREL segments.
//-------------------------------------------------------------------------
-Z(DATA)BREL_BASE,BREL_I,BREL_Z,BREL_N=FFFFC000-FFFFEFFF

//-------------------------------------------------------------------------
//      Global and 32-bit offset from GP.
//      The rest of the external memory (all external memory not used
//      by BREL segment variables) is addressed with HUGE memory model.
//-------------------------------------------------------------------------
-Z(DATA)HUGE_I,HUGE_Z,HUGE_N=FFFFBFFC-FFFFBFFC  // No memory availabale

//-------------------------------------------------------------------------
//      Data relative from zero with 16 bit offset.
//      This segment is for TINY data model. All internal memory, SFR,
//      and CONST variables in area 0000-7FFF may be accessed.
//-------------------------------------------------------------------------
-Z(DATA)NEAR_Z,NEAR_I,NEAR_N=FFFFC000-FFFFEFFF

//-------------------------------------------------------------------------
//      The stack and the heap.
//-------------------------------------------------------------------------
-Z(DATA)CSTACK+_CSTACK_SIZE,HEAP+_HEAP_SIZE=FFFFC000-FFFFEFFF

// Set up near RT_HEAP 
//fify 20100505 HEAP for RTT
-Z(DATA)RT_HEAP+800=FFFFC000-FFFFEFFF

//-------------------------------------------------------------------------
//      End of File
//-------------------------------------------------------------------------