summaryrefslogtreecommitdiff
path: root/core/cortex-m
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2019-01-23 15:13:01 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-18 08:51:20 -0800
commit0528c46598c8c89f04b7129722de50e178b62aa2 (patch)
tree9afe729c302f433174b1f8bcecfeaf206d5cb554 /core/cortex-m
parent80020d90d17ac1507abcefe9004ed6ae8cb9728d (diff)
downloadchrome-ec-0528c46598c8c89f04b7129722de50e178b62aa2.tar.gz
core: Allow .bss and .data sections in DRAM
We manually copy other .data from the original section on boot, and clear DRAM .bss. This way, a single object file (or archive) can be moved fully to DRAM. BRANCH=none BUG=b:122058243 TEST=With next CL, dram_test works Change-Id: I1a434bbd8a4135d16b3f49b0d1b75b96506e3e24 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1445652 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'core/cortex-m')
-rw-r--r--core/cortex-m/ec.lds.S27
1 files changed, 27 insertions, 0 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index 06bd83a30d..28c3e691cd 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -444,7 +444,34 @@ SECTIONS
#endif /* CONFIG_CHIP_MEMORY_REGIONS */
#ifdef CONFIG_DRAM_BASE
+ /* Allocate space for original copy of .data.dram (see .data_lma above). */
+ .dram.data_lma : {
+ __dram_data_lma_start = .;
+ . += __dram_data_end - __dram_data_start;
+ } > DRAM
+
+ /*
+ * TODO(b:122058243): Both .dram.data and .dram.bss do not actually
+ * need to be in the final image, as we have a second copy of the data
+ * (just above), and dram.bss is zeroed anyway.
+ */
+ .dram.data : AT(ADDR(.dram.data_lma)) {
+ . = ALIGN(4);
+ __dram_data_start = .;
+ *(.dram.data*)
+ __dram_data_end = .;
+ } > DRAM
+
+ .dram.bss : {
+ . = ALIGN(4);
+ __dram_bss_start = .;
+ *(SORT(.dram.bss*))
+ __dram_bss_end = .;
+ } > DRAM
+
+ /* Rest of DRAM sections, e.g. text. */
.dram : {
+ . = ALIGN(4);
KEEP(*(SORT(.dram.keep.*)))
*(SORT(.dram.*))
} > DRAM