/*
* Define the memory layout, specifying the start address and size of the
* different memory regions.
*/

_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 4k;
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 4k;

MEMORY
{
  LMB : ORIGIN = 0x0, LENGTH = 0x10000
  DDR : ORIGIN = 0x10000000, LENGTH = 0x10000000
  ZBT : ORIGIN = 0x20000000, LENGTH = 0x100000
}

/*
* Specify the default entry point to the program
*/
ENTRY(_start)

/*
* Define the sections, and where they are mapped in memory
*/
SECTIONS
{
/*
* Specify that the .text section from all input object files will be
* placed in LMB memory into the output file section .text Note that
* mb-gdb expects the executable to have a section called .text
*/

.text : {
/* Uncomment the following line to add specific files in the opb_text */
/* region */
/* *(EXCLUDE_FILE(file1.o).text) */
/* Comment out the following line to have multiple text sections */
*(.text)
} >LMB

/* Define space for the stack and heap */
/* Note that variables _heap must be set to the beginning of this area
*/

/* and _stack set to the end of this area */
. = ALIGN(4);
_heap = .;

.bss : {
. += _STACK_SIZE;
. = ALIGN(4);
} >LMB

_stack = .;

/* */
/* Start of ZBT memory */
/* */
.zbt_text : {
/* Uncomment the following line to add an executable section into */
/* opb memory */
/* file1.o(.text) */
} >ZBT

. = ALIGN(4);
.rodata : {
*(.rodata)
} >ZBT

/* Alignments by 8 to ensure that _SDA2_BASE_ on a word boundary */
. = ALIGN(8);
_ssrw = .;
.sdata2 : {
*(.sdata2)
} >ZBT

. = ALIGN(8);
_essrw = .;
_ssrw_size = _essrw - _ssrw;
_SDA2_BASE_ = _ssrw + (_ssrw_size / 2 );
. = ALIGN(4);

.data : {
*(.data)
} >ZBT

/* Alignments by 8 to ensure that _SDA_BASE_ on a word boundary */
/* Note that .sdata and .sbss must be contiguous */
. = ALIGN(8);
_ssro = .;
.sdata : {
*(.sdata)
} >ZBT

. = ALIGN(4);
.sbss : {
__sbss_start = .;
*(.sbss)
__sbss_end = .;
} >ZBT

. = ALIGN(8);
_essro = .;
_ssro_size = _essro - _ssro;
_SDA_BASE_ = _ssro + (_ssro_size / 2 );

. = ALIGN(4);
.opb_bss : {
__bss_start = .;
*(.bss) *(COMMON)
. = ALIGN(4);
__bss_end = .;
} > ZBT

_end = .;

}

