diff options
author | Yilun Lin <yllin@google.com> | 2019-03-18 16:36:48 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-27 05:57:29 -0700 |
commit | 4a2a450ca48278b9f701461799df54faa6c4c395 (patch) | |
tree | fa9a65559f4ba47a45d146bbada669c567fea0d5 | |
parent | 6a144d98d3d09c2beea3ae5002a371a4f71a23f0 (diff) | |
download | chrome-ec-4a2a450ca48278b9f701461799df54faa6c4c395.tar.gz |
mt_scp: Support ROM section on internal SRAM.
Currently, kukui_scp's memory layout interleaves with RO and RW
sections. This complicates the MPU region configuration, and it
even unconfigurable.
This CL propose to simplify the layout and configuration by introducing
an IROM region, and re-layout the memory.
New layout would be:
---------------------------- 0x0
RO| .stepping_stone
| .text .rodata .data LMA
---------------------------- 0x100000
RW| .bss .data stack
| ipi shared buffer
---------------------------- 0x7C0000
BRANCH=None
BUG=b:123269246
TEST=1. w/o this CL: make buildall -j; mv build build.old
2. w/ this CL: make buildall -j;
3. compare smap by: ls build/*/*/ec.*.smap | \
sed -e 's|build/||' | \
xargs -I{} diff build/{} build.old/{}
and sees that only kukui_scp's smap changed.
Change-Id: I875a28c6b325ba66afe0387d3ea244190ddccde8
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1530263
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | board/kukui_scp/board.h | 23 | ||||
-rw-r--r-- | core/cortex-m/ec.lds.S | 24 | ||||
-rw-r--r-- | include/config.h | 11 |
3 files changed, 28 insertions, 30 deletions
diff --git a/board/kukui_scp/board.h b/board/kukui_scp/board.h index 7bd60c306a..85dbd49c66 100644 --- a/board/kukui_scp/board.h +++ b/board/kukui_scp/board.h @@ -20,20 +20,23 @@ * +-------------------- 0x0 * | ptr to stack_top 0x0 * | ptr to reset func 0x04 - * |-------------------- 0x08 - * | free shared space with AP - * +-------------------- 0x005B0 - * | IPI shared buffer with AP (288 + 8) * 2 * +-------------------- 0x00800 - * | scp.img, exception vectors starting location. - * +-------------------- 0x7B800 - * | free shared space with AP 2KB + * | ROM vectortable, .text, .rodata, .data LMA + * +-------------------- 0x10000 + * | RAM .bss, .data + * +-------------------- 0x7BDB0 + * | IPI shared buffer with AP (288 + 8) * 2 * +-------------------- 0x7C000 * | 8KB I-CACHE * +-------------------- 0x7E000 + * | 8KB D-CACHE + * +-------------------- 0x80000 */ -#define CONFIG_RAM_BASE 0x00800 -#define CONFIG_RAM_SIZE 0x7B000 +#define ICACHE_BASE 0x7C000 +#define CONFIG_ROM_BASE 0x00800 +#define CONFIG_RAM_BASE 0x10000 +#define CONFIG_ROM_SIZE (CONFIG_RAM_BASE - CONFIG_ROM_BASE) +#define CONFIG_RAM_SIZE (CONFIG_IPC_SHARED_OBJ_ADDR - CONFIG_RAM_BASE) #define CONFIG_RO_MEM_OFF 0 /* Access DRAM through cached access */ @@ -45,7 +48,7 @@ /* IPI configs */ #define CONFIG_IPC_SHARED_OBJ_BUF_SIZE 288 #define CONFIG_IPC_SHARED_OBJ_ADDR \ - (CONFIG_RAM_BASE - \ + (ICACHE_BASE - \ (CONFIG_IPC_SHARED_OBJ_BUF_SIZE + 2 * 4 /* int32_t */) * 2) #define CONFIG_IPI #define CONFIG_RPMSG_NAME_SERVICE diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index 8a20fe931a..bb6b5ed84a 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -25,7 +25,7 @@ ENTRY(reset) MEMORY { #if !defined(CONFIG_FLASH_PHYSICAL) - IRAM (rwx) : ORIGIN = CONFIG_RAM_BASE, LENGTH = CONFIG_RAM_SIZE + IROM (rx) : ORIGIN = CONFIG_ROM_BASE, LENGTH = CONFIG_ROM_SIZE #else #if defined(SECTION_IS_RO) && defined(NPCX_RO_HEADER) /* @@ -43,8 +43,8 @@ MEMORY #ifdef CONFIG_SHAREDLIB SHARED_LIB (rx) : ORIGIN = FW_OFF(SHAREDLIB), LENGTH = FW_SIZE(SHAREDLIB) #endif - IRAM (rw) : ORIGIN = CONFIG_RAM_BASE, LENGTH = CONFIG_RAM_SIZE #endif /* !CONFIG_FLASH_PHYSICAL */ + IRAM (rw) : ORIGIN = CONFIG_RAM_BASE, LENGTH = CONFIG_RAM_SIZE #ifdef CONFIG_EXTERNAL_STORAGE #ifdef CONFIG_REPLACE_LOADER_WITH_BSS_SLOW @@ -120,7 +120,7 @@ SECTIONS } > CDRAM AT > FLASH #else #if !defined(CONFIG_FLASH_PHYSICAL) - } > IRAM + } > IROM #else } > FLASH #endif /* !CONFIG_FLASH_PHYSICAL */ @@ -265,7 +265,7 @@ SECTIONS #endif . = ALIGN(4); #if !defined(CONFIG_FLASH_PHYSICAL) - } > IRAM + } > IROM #elif defined(CONFIG_EXTERNAL_STORAGE) } > CDRAM AT > FLASH #else @@ -274,23 +274,7 @@ SECTIONS __data_lma_start = .; -#if !defined(CONFIG_FLASH_PHYSICAL) - /* - * Make a space for .data section's LMA. Otherwise, ld won't preserve - * a space for .data if .rodata and .bss sections are both in IRAM. - */ -#if defined(__clang__) - /* - * The lazy evaluation timing of symbols and builtin functions of ld and - * lld are different. - */ - .bss __data_lma_start + SIZEOF(.data) : { -#else - .bss __data_lma_start + __data_end - __data_start : { -#endif /* __clang__ */ -#else .bss : { -#endif /* !CONFIG_FLASH_PHYSICAL */ /* * Align to 512 bytes. This is convenient when some memory block * needs big alignment. This is the beginning of the RAM, so there diff --git a/include/config.h b/include/config.h index 8f39c41621..ae0c86f1cf 100644 --- a/include/config.h +++ b/include/config.h @@ -2707,14 +2707,25 @@ #undef CONFIG_RAM_BASE /* + * Base address of ROM for the chip. Only used in no physical flash case ( + * !CONFIG_FLASH_PHYSICAL). + */ +#undef CONFIG_ROM_BASE + +/* * CONFIG_DATA_RAM_SIZE and CONFIG_RAM_SIZE indicate size of all data RAM * available on the chip in bytes and size of data RAM available for EC in * bytes, respectively. * Usually, CONFIG_DATA_RAM_SIZE = CONFIG_RAM_SIZE but some chips need to * allocate RAM for the mask ROM. Then CONFIG_DATA_RAM_SIZE > CONFIG_RAM_SIZE. + * + * CONFIG_ROM_SIZE indicates the size of ROM allocated by a linker script. This + * is only needed when no physical flash present (!CONFIG_FLASH_PHYSICAL). The + * ROM region will place common RO setions, e.g. .text, .rodata, .data LMA etc. */ #undef CONFIG_DATA_RAM_SIZE #undef CONFIG_RAM_SIZE +#undef CONFIG_ROM_SIZE /* Enable rbox peripheral */ #undef CONFIG_RBOX |