diff options
-rw-r--r-- | Makefile.rules | 4 | ||||
-rw-r--r-- | common/main.c | 10 | ||||
-rw-r--r-- | core/cortex-m/ec.lds.S | 71 | ||||
-rw-r--r-- | include/link_defs.h | 7 |
4 files changed, 5 insertions, 87 deletions
diff --git a/Makefile.rules b/Makefile.rules index d5ccb70824..47c1e1955f 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -63,9 +63,9 @@ cmd_obj_to_bin ?= $(OBJCOPY) --gap-fill=0xff -O binary $^ $(out)/$*.bin.tmp cmd_flat_to_obj = $(CC) -Wl,-T $(out)/firmware_image.lds -nostdlib $(CFLAGS) \ -Wl,--build-id=none -o $@ $< # Allow the .roshared section to overlap other sections (itself) -cmd_ec_elf_to_flat ?= $(OBJCOPY) --set-section-flags .roshared=share -R .dram* \ +cmd_ec_elf_to_flat ?= $(OBJCOPY) --set-section-flags .roshared=share -R .dram \ -O binary $< $@ -cmd_ec_elf_to_flat_dram ?= $(OBJCOPY) -j .dram* -O binary $< $@ +cmd_ec_elf_to_flat_dram ?= $(OBJCOPY) -j .dram -O binary $< $@ cmd_elf_to_signed ?= $(SIGNER) --key=util/signer/$(3) \ --b --input=$< --format=bin --output=$@.signed $(SIGNER_EXTRAS) \ && sudo chown $(shell whoami) $@.signed && mv $@.signed $@ diff --git a/common/main.c b/common/main.c index deaa635694..4637662220 100644 --- a/common/main.c +++ b/common/main.c @@ -19,8 +19,6 @@ #include "hooks.h" #include "i2c.h" #include "keyboard_scan.h" -#include "link_defs.h" -#include "lpc.h" #ifdef CONFIG_MPU #include "mpu.h" #endif @@ -77,14 +75,6 @@ test_mockable __keep int main(void) system_pre_init(); system_common_pre_init(); -#ifdef CONFIG_DRAM_BASE - /* Now that DRAM is initialized, clear up DRAM .bss, copy .data over. */ - memset(&__dram_bss_start, 0, - (uintptr_t)(&__dram_bss_end) - (uintptr_t)(&__dram_bss_start)); - memcpy(&__dram_data_start, &__dram_data_lma_start, - (uintptr_t)(&__dram_data_end) - (uintptr_t)(&__dram_data_start)); -#endif - #if defined(CONFIG_FLASH_PHYSICAL) /* * Initialize flash and apply write protect if necessary. Requires diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index 0e712f7e9c..b00c538552 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -475,74 +475,9 @@ SECTIONS #endif /* CONFIG_CHIP_MEMORY_REGIONS */ #ifdef CONFIG_DRAM_BASE - - /* - * Sections in DRAM region are constructed as like in non-DRAM regions: - * .dram.data LMA is for preserving initialized data across resets. - * The only difference is that they are all in the DRAM region: - * .dram.text | LOAD - * .dram.rodata | LOAD - * .dram.data LMA | LOAD - * .dram.data VMA | - * .dram.bss | NOLOAD - * TODO(b:123269246): Enable MPU protectable DRAM section. This might - * introduce a RO-DRAM section for .dram.text, .dram.rodata and - * .dram.data LMA. - */ - - .dram.text : { - . = ALIGN(4); - KEEP(*(SORT(.dram.text.keep.*))) - *(SORT(.dram.text.*)) - . = ALIGN(4); - } > DRAM - - .dram.rodata : { - . = ALIGN(4); - KEEP(*(SORT(.dram.rodata.keep.*))) - *(SORT(.dram.rodata.*)) - . = ALIGN(4); - } > DRAM - - __dram_data_lma_start = ADDR(.dram.rodata) + SIZEOF(.dram.rodata); - - /* Place .dram.data LMA in between .dram.rodata and .dram.data VMA. */ -#ifdef __clang__ - /* - * The evaluation timing for SIZEOF() and symbols are different in - * ld and lld. - */ - .dram.data __dram_data_lma_start + SIZEOF(.dram.data) : { -#else - .dram.data __dram_data_lma_start + - (__dram_data_end - __dram_data_start) : { -#endif /* __clang__ */ - . = ALIGN(4); - __dram_data_start = .; - *(.dram.data*) - . = ALIGN(4); - __dram_data_end = .; - - /* - * Normally, '> DRAM AT > DRAM' should be the same as '> DRAM', - * and they will be at the same address. However, if the address - * of VMA specified, LMA and VMA might have different addresses: - * '> DRAM' places VMA at the address where section declaration - * specified. - * 'AT > DRAM' places LMA at the location counter's address. - */ - } > DRAM AT > DRAM - - /* - * ld assigns correct attribute for .bss, but not for other .*.bss, - * we need an explicltly NOLOAD. - */ - .dram.bss(NOLOAD) : { - . = ALIGN(4); - __dram_bss_start = .; - *(SORT(.dram.bss*)) - . = ALIGN(4); - __dram_bss_end = .; + .dram : { + KEEP(*(SORT(.dram.keep.*))) + *(SORT(.dram.*)) } > DRAM #endif diff --git a/include/link_defs.h b/include/link_defs.h index 28ea0113e1..b8b04348bf 100644 --- a/include/link_defs.h +++ b/include/link_defs.h @@ -111,13 +111,6 @@ extern const void *__data_lma_start; extern const void *__data_start; extern const void *__data_end; -/* DRAM image sections. */ -extern const void *__dram_data_lma_start; -extern void *__dram_data_start; -extern void *__dram_data_end; -extern void *__dram_bss_start; -extern void *__dram_bss_end; - /* Helper for special chip-specific memory sections */ #if defined(CONFIG_CHIP_MEMORY_REGIONS) || defined(CONFIG_DRAM_BASE) #define __SECTION(name) __attribute__((section("." STRINGIFY(name) ".50_auto"))) |