samples: code_relocation: An example for code relocation feature.
This sample provides an example for using the code relocation feature. This example will place text,data,bss from 3 files to various parts in the SRAM. For this a custom linker file is used which is derived from include/arch/arm/cortex_m/scripts/linker.ld. Signed-off-by: Varun Sharma <varun.sharma@intel.com> Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
parent
aa2890e267
commit
21fa43387e
9 changed files with 207 additions and 0 deletions
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Linker command/script file
|
||||
*
|
||||
* Linker script for the Cortex-M platforms.
|
||||
*/
|
||||
|
||||
#define _LINKER
|
||||
#define _ASMLANGUAGE
|
||||
|
||||
#include <autoconf.h>
|
||||
#include <linker/sections.h>
|
||||
#include <generated_dts_board.h>
|
||||
|
||||
#include <linker/linker-defs.h>
|
||||
#include <linker/linker-tool.h>
|
||||
|
||||
/** enable CONFIG_SRAM2 or any other partition in soc Kconfig,
|
||||
* this is just an example to show relocation of code/data/bss script
|
||||
*/
|
||||
#if defined CONFIG_ARM
|
||||
#define CONFIG_SRAM2 1
|
||||
#define _SRAM2_DATA_SECTION_NAME .sram2_data
|
||||
#define _SRAM2_BSS_SECTION_NAME .sram2_bss
|
||||
#define _SRAM2_TEXT_SECTION_NAME .sram2_text
|
||||
#endif
|
||||
|
||||
#define RAM_SIZE2 (CONFIG_SRAM_SIZE * 512)
|
||||
MEMORY
|
||||
{
|
||||
#ifdef CONFIG_SRAM2
|
||||
SRAM2 (wx) : ORIGIN = (CONFIG_SRAM_BASE_ADDRESS + RAM_SIZE2), LENGTH = RAM_SIZE2
|
||||
#endif
|
||||
}
|
||||
|
||||
#include <arch/arm/cortex_m/scripts/linker.ld>
|
Loading…
Add table
Add a link
Reference in a new issue