2015-11-22 11:25:41 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-11-22 11:25:41 +08:00
|
|
|
*/
|
|
|
|
|
2015-12-04 23:09:39 +08:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Linker command/script file
|
|
|
|
*
|
|
|
|
* This is the linker script for both standard images and XIP images.
|
|
|
|
*/
|
2015-11-22 11:25:41 +08:00
|
|
|
|
|
|
|
#include <autoconf.h>
|
|
|
|
|
2017-06-23 01:08:04 +08:00
|
|
|
#include <generated_dts_board.h>
|
2015-11-22 11:25:41 +08:00
|
|
|
/* physical address of RAM (needed for correct __ram_phys_end symbol) */
|
|
|
|
#define PHYS_RAM_ADDR CONFIG_PHYS_RAM_ADDR
|
|
|
|
|
|
|
|
/* physical address where the kernel is loaded */
|
|
|
|
#ifdef CONFIG_XIP
|
|
|
|
#define PHYS_LOAD_ADDR CONFIG_PHYS_LOAD_ADDR
|
|
|
|
#else /* !CONFIG_XIP */
|
|
|
|
#define PHYS_LOAD_ADDR CONFIG_PHYS_RAM_ADDR
|
|
|
|
#endif /* CONFIG_XIP */
|
|
|
|
|
2017-01-06 07:33:57 +08:00
|
|
|
/* total shared RAM size (restore info + gdt) */
|
|
|
|
#define BSP_SHARED_RAM_SIZE \
|
2017-12-30 23:49:10 +08:00
|
|
|
(CONFIG_SHARED_GDT_RAM_SIZE+CONFIG_BSP_SHARED_RESTORE_INFO_SIZE)
|
2017-01-06 07:33:57 +08:00
|
|
|
/*
|
|
|
|
* When DEEP_SLEEP is not enabled, the shared memory can be re-used after boot.
|
|
|
|
* Since the memory regions area are at fixed address locations, only the
|
|
|
|
* contiguous unused memory located at the end of RAM should be made available.
|
|
|
|
*/
|
2016-10-18 21:25:07 +08:00
|
|
|
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
|
2017-01-06 07:33:57 +08:00
|
|
|
#define PHYS_RAM_SIZE CONFIG_RAM_SIZE*1K - BSP_SHARED_RAM_SIZE
|
|
|
|
#else
|
|
|
|
#ifdef CONFIG_SET_GDT
|
2016-10-18 21:25:07 +08:00
|
|
|
#define PHYS_RAM_SIZE CONFIG_RAM_SIZE*1K
|
2017-01-06 07:33:57 +08:00
|
|
|
#else
|
2017-12-30 23:49:10 +08:00
|
|
|
#define PHYS_RAM_SIZE CONFIG_RAM_SIZE*1K - CONFIG_SHARED_GDT_RAM_SIZE
|
2017-01-06 07:33:57 +08:00
|
|
|
#endif
|
2016-10-18 21:25:07 +08:00
|
|
|
#endif
|
2015-11-22 11:25:41 +08:00
|
|
|
|
|
|
|
MEMORY
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_XIP
|
|
|
|
ROM (rx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = CONFIG_ROM_SIZE*1K
|
2016-10-18 21:25:07 +08:00
|
|
|
RAM (wx) : ORIGIN = PHYS_RAM_ADDR, LENGTH = PHYS_RAM_SIZE
|
2015-11-22 11:25:41 +08:00
|
|
|
#else /* !CONFIG_XIP */
|
2016-10-18 21:25:07 +08:00
|
|
|
RAM (wx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = PHYS_RAM_SIZE
|
2015-11-22 11:25:41 +08:00
|
|
|
#endif /* CONFIG_XIP */
|
2016-10-18 21:25:07 +08:00
|
|
|
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
|
2017-01-06 07:33:57 +08:00
|
|
|
BSP_SHARED_RAM (rw) : ORIGIN = CONFIG_BSP_SHARED_RESTORE_INFO_RAM_ADDR,
|
|
|
|
LENGTH = CONFIG_BSP_SHARED_RESTORE_INFO_SIZE
|
2016-10-18 21:25:07 +08:00
|
|
|
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP */
|
2017-01-06 07:33:57 +08:00
|
|
|
#ifndef CONFIG_SET_GDT
|
2017-12-30 23:49:10 +08:00
|
|
|
SHARED_GDT_RAM (rw) : ORIGIN = CONFIG_SHARED_GDT_RAM_ADDR,
|
|
|
|
LENGTH = CONFIG_SHARED_GDT_RAM_SIZE
|
2017-01-06 07:33:57 +08:00
|
|
|
#endif /* !CONFIG_SET_GDT */
|
2015-11-22 11:25:41 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* It doesn't matter where this region goes as it is stripped from the
|
|
|
|
* final ELF image. The address doesn't even have to be valid on the
|
|
|
|
* target. However, it shouldn't overlap any other regions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
IDT_LIST : ORIGIN = 2K, LENGTH = 2K
|
2017-06-05 19:19:56 +08:00
|
|
|
MMU_LIST : ORIGIN = 4k, LENGTH = 1K
|
2015-11-22 11:25:41 +08:00
|
|
|
}
|
|
|
|
|
2016-10-20 23:09:32 +08:00
|
|
|
#include <arch/x86/linker.ld>
|
2015-11-22 11:25:41 +08:00
|
|
|
|