blob: ab6e3a7dad3adb72f151278c75a35d3ad139a50a [file] [log] [blame] [edit]
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
TCM_LENGTH = DEFINED(__tcm_length__) ? __tcm_length__ : 4M;
WINDOW_LENGTH = 0x1000000;
MEMORY
{
TEXT (rx) : ORIGIN = 0x80000000, LENGTH = TCM_LENGTH
CONSTANT_DATA (r) : ORIGIN = 0x80000000 + WINDOW_LENGTH, LENGTH = TCM_LENGTH
MODEL_OUTPUT (rw) : ORIGIN = 0x80000000 + 2*WINDOW_LENGTH, LENGTH = TCM_LENGTH
STATIC_DATA (rw) : ORIGIN = 0x80000000 + 3*WINDOW_LENGTH, LENGTH = TCM_LENGTH
MODEL_INPUT (r) : ORIGIN = 0x80000000 + 4*WINDOW_LENGTH, LENGTH = TCM_LENGTH
TEMPORARY_DATA (rw) : ORIGIN = 0x80000000 + 5*WINDOW_LENGTH, LENGTH = TCM_LENGTH
}
HEAP_SIZE = DEFINED(HEADP_SIZE) ? HEAP_SIZE : DEFINED(__heap_size__) ? __heap_size__ : 1250K;
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(_start)
SECTIONS
{
.text :
{
_stext = .;
KEEP(*(.text._start))
*(.text*)
_etext = .;
} > TEXT
.rodata :
{
. = ALIGN(64);
_srodata = .;
*(.rodata*)
_erodata = .;
} > CONSTANT_DATA
.preinit_array :
{
PROVIDE(__preinit_array_start = .);
KEEP(*(.preinit_array))
PROVIDE(__preinit_array_end = .);
} > CONSTANT_DATA
.init_array :
{
PROVIDE(__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE(__init_array_end = .);
} > CONSTANT_DATA
.fini_array :
{
PROVIDE(__fini_array_start = .);
KEEP(*(SORT(.fini_array.*)))
KEEP(*(.fini_array))
PROVIDE(__fini_array_end = .);
} > CONSTANT_DATA
.model_output :
{
. = ALIGN(64);
_smodel_output = .;
_ret = .;
*(.model_output_header*)
*(.model_output*)
_emodel_output = .;
} > MODEL_OUTPUT
.data :
{
. = ALIGN(64);
_global_pointer = . + 0x800;
_sdata = .;
*(.data*)
_edata = .;
} > STATIC_DATA
.bss (NOLOAD) :
{
. = ALIGN(64);
_sbss = .;
*(.bss*)
*(COMMON)
_ebss = .;
} > TEMPORARY_DATA
.heap (NOLOAD) :
{
. = ALIGN(64);
_sheap = .;
. = . + HEAP_SIZE;
. = ALIGN(64);
_eheap = .;
} > TEMPORARY_DATA
.stack (NOLOAD) :
{
_sstack = .;
PROVIDE(_stack_start_sentinel = .);
. = . + STACK_SIZE;
PROVIDE(_stack_ptr = .);
PROVIDE(_stack_end_sentinel = .);
. = ALIGN(64);
. = . + 64;
_estack = .;
} > TEMPORARY_DATA
_end = .;
}