/**********************************************************
	File : ldscript 
	Author : Alain Greiner
	Date : January 2014
**********************************************************/

/* definition of the base address for all segments 
The peripherals base addresses are referenced by the
software drivers and must be defined, even if the 
peripherals are not present in the architecture */

seg_reset_base   = 0xBFC00000;       /* boot code                   */

seg_kcode_base   = 0x00010000;       /* kernel code                 */
seg_kdata_base   = 0x00020000;       /* kernel cacheable data       */
seg_kunc_base    = 0x00030000;       /* kernel uncacheable data     */

seg_code_base    = 0x00040000;       /* application code            */ 
seg_data_base    = 0x00050000;       /* application data            */

seg_heap_base    = 0x00100000;       /* heaps for applications      */
seg_stack_base   = 0x00300000;       /* stacks for applications     */

seg_ramdisk_base = 0xFFFFFFFF;       /* virtual disk                */

seg_xcu_base     = 0xB0000000;       /* XCU controller              */
seg_dma_base     = 0xB1000000;       /* DMA controller              */
seg_mmc_base     = 0xB2000000;       /* config    MMC               */
seg_ioc_base     = 0xB3000000;       /* IOC controller              */
seg_tty_base     = 0xB4000000;       /* TTY controller              */
seg_nic_base     = 0xB5000000;       /* NIC controller              */
seg_cma_base     = 0xB6000000;       /* CMA controller              */
seg_fbf_base     = 0xB7000000;       /* FBF controller              */
seg_pic_base     = 0xB8000000;       /* PIC controller              */

ENTRY(reset)

/* Grouping sections into segments */

SECTIONS
{
   . = seg_kcode_base;
   seg_kcode : {
      *(.giet)
      *(.switch)
      *(.drivers)
      *(.isr)
   } 
   . = seg_kdata_base;
   seg_kdata : {
      *(.kdata)
   } 
   . = seg_kunc_base;
   seg_kunc : {
      *(.unckdata)
   } 
   . = seg_kdata_base;
   seg_kdata : {
      *(.ksave)
   } 
   . = seg_code_base;
   seg_code : {
      *(.text)
      *(.text.*)
   } 
   . = seg_reset_base;
   seg_reset : {
      *(.reset)
   } 
   . = seg_data_base;
   seg_data : {
      *(.rodata)
      . = ALIGN(4);
      *(.rodata.*)
      . = ALIGN(4);
      *(.data)
      . = ALIGN(4);
      *(.sdata)
      . = ALIGN(4);
      *(.bss)
      *(COMMON)
      *(.sbss)
   } 
}

