2018-07-17 09:37:14 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011-2014, Wind River Systems, Inc.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Linker command/script file
|
|
|
|
*
|
|
|
|
* This is the linker script for both standard images and XIP images.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <autoconf.h>
|
2020-01-16 20:29:53 +08:00
|
|
|
#include <devicetree.h>
|
2018-07-17 09:37:14 +08:00
|
|
|
|
2020-04-29 10:55:44 +08:00
|
|
|
|
|
|
|
/* physical address where the kernel is loaded */
|
2018-07-17 09:37:14 +08:00
|
|
|
/* physical address of RAM */
|
2020-04-29 23:11:28 +08:00
|
|
|
#define PHYS_RAM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_sram))
|
|
|
|
#define PHYS_RAM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_sram))
|
|
|
|
|
2020-06-18 03:20:17 +08:00
|
|
|
#define KERNEL_BASE_ADDR (PHYS_RAM_ADDR + CONFIG_X86_KERNEL_OFFSET)
|
|
|
|
#define KERNEL_RAM_SIZE (PHYS_RAM_SIZE - CONFIG_X86_KERNEL_OFFSET)
|
|
|
|
|
2018-07-17 09:37:14 +08:00
|
|
|
#ifdef CONFIG_XIP
|
2020-04-29 23:11:28 +08:00
|
|
|
#define PHYS_LOAD_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_flash))
|
2018-07-17 09:37:14 +08:00
|
|
|
#else /* !CONFIG_XIP */
|
2020-06-18 03:20:17 +08:00
|
|
|
#define PHYS_LOAD_ADDR KERNEL_BASE_ADDR
|
2018-07-17 09:37:14 +08:00
|
|
|
#endif /* CONFIG_XIP */
|
|
|
|
|
|
|
|
MEMORY
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_XIP
|
2020-04-29 23:11:28 +08:00
|
|
|
ROM (rx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = DT_REG_SIZE(DT_CHOSEN(zephyr_flash))
|
2018-07-17 09:37:14 +08:00
|
|
|
#endif /* CONFIG_XIP */
|
2020-06-18 03:20:17 +08:00
|
|
|
RAM (wx) : ORIGIN = KERNEL_BASE_ADDR, LENGTH = KERNEL_RAM_SIZE
|
2018-07-17 09:37:14 +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
|
|
|
|
}
|
|
|
|
|
2019-06-29 00:41:39 +08:00
|
|
|
#include <arch/x86/ia32/linker.ld>
|