diff options
author | Yilun Lin <yllin@google.com> | 2019-06-06 16:22:27 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-17 05:13:31 +0000 |
commit | 7a1dfea02d3cb6ec16610ca284fbde2ab8145cea (patch) | |
tree | f08c4a88b20afe42d1585a22869f3a9f7c3dfe34 /power/mt8183.c | |
parent | 205c777b9f74667a6580d4c4d232417b92637eca (diff) | |
download | chrome-ec-7a1dfea02d3cb6ec16610ca284fbde2ab8145cea.tar.gz |
cortex-m/ec.ld.S: Fix DRAM section layout.
This CL fixes DRAM section loaded at the wrong location, and
also relayouts the DRAM section to have a smaller flat binary.
Current DRAM region layout is as below:
.dram.data LMA | LOAD
.dram.data VMA |
.dram.bss | NOLOAD
.dram.rodata | LOAD
.dram.text | LOAD
This will create a flat binary file as following layout:
.dram.data
.dram.bss
.dram.rodata
.dram.text
and loader will load .flat.dram to .dram.data LMA's starting section.
This leads to .dram.bss, .dram.rodata and .dram.text been loaded at
the wrong location, where .dram.data VMA resides.
This CL fixes the issue by reorganize the sections into:
.dram.text | LOAD
.dram.rodata | LOAD
.dram.data LMA | LOAD
.dram.data VMA |
.dram.bss | NOLOAD
and thus we have a flat binary as:
.dram.text
.dram.rodata
.dram.data
so that:
1. everything will be placed at the correct address.
2. have a smaller flat binary.
The CL also removes .dram.keep.* section, which is not used so far.
BUG=b:134079593
BRANCH=master
TEST=With crrev.com/c/1646691, check the output of object header:
1. SIZEOF(.dram.text + .dram.rodata + .dram.data) = SIZEOF(.image.RW.dram)
0x68 0x18 0x14 0x94
2. ADDR(.dram.data LMA) + SIZEOF(.dram.data) = ADDR(.dram.data VMA)
0x10000080 0x14 0x10000094
arm-none-eabi-objdump -h build/kukui_scp/RW/ec.RW.elf
Idx Name Size VMA LMA File off Algn
5 .dram.text 00000068 10000000 10000000 00030000 2**3
CONTENTS, ALLOC, LOAD, READONLY, CODE
6 .dram.rodata 00000018 10000068 10000068 00030068 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .dram.data 00000014 10000094 10000080 00030094 2**0
CONTENTS, ALLOC, LOAD, DATA
8 .dram.bss 00000004 100000a8 100000a8 000300a8 2**0
ALLOC
arm-none-eabi-objdump -h build/kukui_scp/ec.obj
Idx Name Size VMA LMA File off Algn
2 .image.RW.dram 00000094 50000000 50000000 00020000 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
TEST=With crrev.com/c/1646691, see the console has correct output:
dram_bss_val = 0
dram_data_val[0]= 1
dram_data_val[1]= 2
dram_data_val[2]= 3
dram_data_val[3]= 4
dram_data_val[4]= 5
dram_data_val[5]= 6
dram_data_val[6]= 7
dram_data_val[7]= 8
dram_data_val[8]= 9
dram_data_val[9]= 10
dram_data_val[10]= 11
dram_data_val[11]= 12
dram_data_val[12]= 13
dram_data_val[13]= 14
dram_data_val[14]= 15
dram_data_val[15]= 16
dram_data_val[16]= 17
dram_rodata_val[0]= 55
dram_rodata_val[1]= 56
dram_rodata_val[2]= 57
dram_rodata_val[3]= 58
dram_rodata_val[4]= 59
dram_rodata_val[5]= 60
Change-Id: Ic6836c6ad553d0ceae4d55df92caa1896fee905d
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1646690
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Yilun Lin <yllin@chromium.org>
Auto-Submit: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'power/mt8183.c')
0 files changed, 0 insertions, 0 deletions