Skip to content

Commit d75c5db

Browse files
Archcady0xc0170
authored andcommitted
minor fixes
correct heap size in icf file; improve REALTEK_RTL8195AM.py
1 parent b20d635 commit d75c5db

File tree

2 files changed

+91
-13
lines changed

2 files changed

+91
-13
lines changed

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/TOOLCHAIN_IAR/rtl8195a.icf

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,55 @@
33
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
44
/*-Specials-*/
55

6+
7+
8+
69
/*-Memory Regions-*/
710
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
811
define symbol __ICFEDIT_region_ROM_end__ = 0x000FFFFF;
912
define symbol __ICFEDIT_region_TCM_start__ = 0x1FFF0000;
1013
define symbol __ICFEDIT_region_TCM_end__ = 0x1FFFFFFF;
1114
define symbol __ICFEDIT_region_ROM_USED_RAM_start__ = 0x10000000;
1215
define symbol __ICFEDIT_region_ROM_USED_RAM_end__ = 0x10005FFF;
16+
17+
18+
1319
define symbol __ICFEDIT_region_BD_RAM_start__ = 0x10006000;
20+
21+
1422
define symbol __ICFEDIT_region_BD_RAM_end__ = 0x1006FFFF;
23+
1524
define symbol __ICFEDIT_region_SDRAM_RAM_start__ = 0x30000000;
1625
define symbol __ICFEDIT_region_SDRAM_RAM_end__ = 0x301FFFFF;
1726

1827
/*-Sizes-*/
1928
define symbol __ICFEDIT_size_cstack__ = 0x2000; // 8K
20-
define symbol __ICFEDIT_size_heap__ = 0xF000; // 60K
29+
define symbol __ICFEDIT_size_heap__ = 0x8000; // 60K
2130
/**** End of ICF editor section. ###ICF###*/
2231

32+
2333
define memory mem with size = 4G;
2434
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
2535
define region TCM_region = mem:[from __ICFEDIT_region_TCM_start__ to __ICFEDIT_region_TCM_end__];
2636
define region ROM_USED_RAM_region = mem:[from __ICFEDIT_region_ROM_USED_RAM_start__ to __ICFEDIT_region_ROM_USED_RAM_end__];
37+
2738
define region BD_RAM_region = mem:[from __ICFEDIT_region_BD_RAM_start__ to __ICFEDIT_region_BD_RAM_end__];
2839

40+
2941
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
3042
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
3143

3244
//initialize by copy { readwrite };
45+
46+
3347
do not initialize { section .noinit };
3448

3549

50+
51+
52+
53+
54+
3655
/****************************************
3756
* ROM Section config *
3857
****************************************/
@@ -57,14 +76,20 @@ define block .rom.bss with fixed order{ section .hal.ram.bss* object hal_misc.o,
5776
section .hal.ram.bss* object diag.o,
5877
section .hal.ram.bss* object rtl8195a_ssi_rom.o,
5978
section .hal.ram.bss* object rtl8195a_gpio.o,
79+
6080
section .hal.ram.bss*,
6181
section .timer2_7_vector_table.data*,
82+
83+
6284
section .infra.ram.bss*,
6385
section .mon.ram.bss*,
6486
section .wlan_ram_map* object rom_wlan_ram_map.o,
87+
88+
6589
section .wlan_ram_map*,
6690
section .libc.ram.bss*,
6791
};
92+
6893
keep { section .start.ram.data* };
6994
define block .ram.start.table with fixed order{ section .start.ram.data* };
7095

@@ -74,17 +99,21 @@ keep { section .image1.validate.rodata* };
7499
keep { section .hal.ram.data* };
75100
define block .ram_image1.data with fixed order{ section .image1.validate.rodata*,
76101
section .infra.ram.data*,
102+
77103
//section .timer.ram.data*,
78104
section .cutb.ram.data*,
79105
section .hal.ram.data* object rom.o, // for standard libaray __impure_data_ptr
80106
section .cutc.ram.data*,
81107
section .hal.ram.data*
82108
};
83109
//define block .ram_image1.bss with fixed order{ //section .hal.flash.data*,
110+
111+
84112
// section .hal.sdrc.data*
85113
// };
86114

87115
define block .ram_image1.text with fixed order{ section .hal.ram.text*,
116+
88117
// //section .hal.sdrc.text*,
89118
// //section .text* object startup.o,
90119
section .infra.ram.text*,
@@ -103,6 +132,7 @@ place at start of ROM_USED_RAM_region { //readwrite,
103132
block .rom.bss,
104133
block IMAGE1
105134
};
135+
106136
/**
107137
IMAGE2
108138
**/
@@ -112,6 +142,7 @@ define block .image2.start.table1 with fixed order{ section .image2.ram.data* };
112142
keep { section .image2.validate.rodata*, section .custom.validate.rodata* };
113143
define block .image2.start.table2 with fixed order{ section .image2.validate.rodata*, section .custom.validate.rodata* };
114144

145+
115146
/*
116147
define block SHT$$PREINIT_ARRAY { preinit_array };
117148
define block SHT$$INIT_ARRAY { init_array };
@@ -126,9 +157,13 @@ define block .ram_image2.text with fixed order{ section .infra.ram.start*,
126157
section .hal.gpio.text*,
127158
section .text* object main.o,
128159
section .text*,
160+
129161
section CODE,
130162
section .otg.rom.text,
131163
section Veneer object startup.o,
164+
165+
166+
132167
section __DLIB_PERTHREAD
133168
};
134169

@@ -152,25 +187,71 @@ define block .ram.bss with fixed order{ section .bss*,
152187
};
153188

154189

190+
191+
192+
193+
194+
195+
196+
197+
198+
155199
place at start of BD_RAM_region {
156200
block IMAGE2,
157-
//readwrite,
201+
readwrite,
158202
block .ram.bss,
159203
};
160204
place at end of BD_RAM_region{
161205
block HEAP,
162206
//block CSTACK
163207
};
164208

209+
210+
211+
212+
213+
214+
215+
216+
217+
165218
/****************************************
166219
* BD RAM Section config *
167220
****************************************/
168221
define block .heap with fixed order{ section .heap* };
169222
define block .stack_dummy with fixed order { section .stack };
223+
224+
225+
226+
227+
228+
229+
230+
231+
232+
233+
234+
235+
236+
237+
238+
239+
240+
241+
242+
243+
244+
245+
246+
247+
248+
170249
/*TCM placement */
171250
define overlay TCM_overlay { //section .tcm.heap,
172251
//section .bss object mem.o,
173252
//section .bss object memp.o,
253+
254+
174255
block .heap,
175256
block .stack_dummy
176257
};
@@ -189,3 +270,5 @@ define exported symbol __ram_start_table_start__= 0x10000bc8; // use in rom
189270
define exported symbol __image1_validate_code__= 0x10000bdc; // needed by ram code
190271
define exported symbol _rtl_impure_ptr = 0x10001c60; // for standard library
191272

273+
274+

tools/REALTEK_RTL8195AM.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def prepend(image, image_prepend, toolchain, info):
6767

6868
def parse_section(toolchain, elf, section):
6969
info = {'addr':None, 'size':None};
70-
ret1 = ret2 = None
7170
if toolchain not in ["GCC_ARM", "ARM_STD", "ARM", "ARM_MICRO", "IAR"]:
7271
print "[ERROR] unsupported toolchain " + toolchain
7372
sys.exit(-1)
@@ -101,23 +100,19 @@ def parse_section(toolchain, elf, section):
101100
match = re.match(r'^\s+' + section + \
102101
r'\s+0x(?P<addr>[0-9A-Fa-f]{8})\s+0x(?P<size>[0-9A-Fa-f]+)\s+.*<Block>$', line)
103102
if match:
104-
ret1 = match.group("addr")
103+
info['addr'] = int(match.group("addr"), 16)
105104
try:
106-
ret2 = match.group("size")
105+
info['size'] = int(match.group("size"), 16)
107106
except IndexError:
108-
pass
109-
break
107+
info['size'] = 0x0
108+
return info
110109

111-
if not ret1:
110+
if not info['addr']:
112111
print "[ERROR] cannot find the address of section " + section
113-
return 0
114-
elif not ret2:
115-
ret2 = '0'
112+
elif not info['size']:
116113
if toolchain == "IAR":
117114
print "[WARNING] cannot find the size of section " + section
118115

119-
info['addr'] = int(ret1, 16)
120-
info['size'] = int(ret2, 16)
121116
return info
122117

123118
# ----------------------------

0 commit comments

Comments
 (0)