blob: cec50b0e16a03c835ad953c3dbb0eef1f3ae9898 [file] [log] [blame]
Adithya Baglodyff631012018-11-26 21:52:42 +05301#!/usr/bin/env python3
2#
3# Copyright (c) 2018 Intel Corporation.
4#
5# SPDX-License-Identifier: Apache-2.0
6#
7
David B. Kinder17299f02019-05-31 15:39:39 -07008"""
9This script will relocate .text, .rodata, .data and .bss sections from required files
10and places it in the required memory region. This memory region and file
11are given to this python script in the form of a string.
12
13Example of such a string would be::
14
15 SRAM2:/home/xyz/zephyr/samples/hello_world/src/main.c,\
16 SRAM1:/home/xyz/zephyr/samples/hello_world/src/main2.c
17
18To invoke this script::
19
20 python3 gen_relocate_app.py -i input_string -o generated_linker -c generated_code
21
22Configuration that needs to be sent to the python script.
23
24- If the memory is like SRAM1/SRAM2/CCD/AON then place full object in
25 the sections
26- If the memory type is appended with _DATA / _TEXT/ _RODATA/ _BSS only the
27 selected memory is placed in the required memory region. Others are
28 ignored.
29
30Multiple regions can be appended together like SRAM2_DATA_BSS
31this will place data and bss inside SRAM2.
32"""
33
Adithya Baglodyff631012018-11-26 21:52:42 +053034
35import sys
36import argparse
37import os
38import glob
39import warnings
40from elftools.elf.elffile import ELFFile
41
42# This script will create linker comands for text,rodata data, bss section relocation
43
44PRINT_TEMPLATE = """
45 KEEP(*({0}))
46"""
47
48SECTION_LOAD_MEMORY_SEQ = """
49 __{0}_{1}_rom_start = LOADADDR(_{2}_{3}_SECTION_NAME);
50"""
51
Wentong Wuc8f43b92019-05-14 01:04:06 +080052LOAD_ADDRESS_LOCATION_FLASH = """
53#ifdef CONFIG_XIP
54GROUP_DATA_LINK_IN({0}, FLASH)
55#else
56GROUP_DATA_LINK_IN({0}, {0})
57#endif
58"""
Adithya Baglodyff631012018-11-26 21:52:42 +053059LOAD_ADDRESS_LOCATION_BSS = "GROUP_LINK_IN({0})"
60
Wentong Wu743a1842019-05-14 00:30:52 +080061MPU_RO_REGION_START = """
62
63 _{0}_mpu_ro_region_start = {1}_ADDR;
64
65"""
66
67MPU_RO_REGION_END = """
68
Wentong Wu743a1842019-05-14 00:30:52 +080069 _{0}_mpu_ro_region_end = .;
70
71"""
72
Adithya Baglodyff631012018-11-26 21:52:42 +053073# generic section creation format
74LINKER_SECTION_SEQ = """
75
76/* Linker section for memory region {2} for {3} section */
77
Kumar Gala4da0f8b2019-03-14 18:39:36 -050078 SECTION_PROLOGUE(_{2}_{3}_SECTION_NAME,,)
Adithya Baglodyff631012018-11-26 21:52:42 +053079 {{
80 . = ALIGN(4);
81 {4}
82 . = ALIGN(4);
83 }} {5}
84 __{0}_{1}_end = .;
85 __{0}_{1}_start = ADDR(_{2}_{3}_SECTION_NAME);
86 __{0}_{1}_size = SIZEOF(_{2}_{3}_SECTION_NAME);
87"""
88
Wentong Wufa7ce3f2019-07-02 01:18:40 +080089LINKER_SECTION_SEQ_MPU = """
90
91/* Linker section for memory region {2} for {3} section */
92
93 SECTION_PROLOGUE(_{2}_{3}_SECTION_NAME,,)
94 {{
95 __{0}_{1}_start = .;
96 {4}
Wentong Wu09af98a2019-09-19 21:40:29 +080097#if {6}
98 . = ALIGN({6});
99#else
Wentong Wufa7ce3f2019-07-02 01:18:40 +0800100 MPU_ALIGN(__{0}_{1}_size);
Wentong Wu09af98a2019-09-19 21:40:29 +0800101#endif
Wentong Wufa7ce3f2019-07-02 01:18:40 +0800102 __{0}_{1}_end = .;
103 }} {5}
104 __{0}_{1}_size = __{0}_{1}_end - __{0}_{1}_start;
105"""
106
Adithya Baglodyff631012018-11-26 21:52:42 +0530107SOURCE_CODE_INCLUDES = """
108/* Auto generated code. Do not modify.*/
109#include <zephyr.h>
110#include <linker/linker-defs.h>
111#include <kernel_structs.h>
Stephanos Ioannidis2d746042019-10-25 00:08:21 +0900112#include <string.h>
Adithya Baglodyff631012018-11-26 21:52:42 +0530113"""
114
115EXTERN_LINKER_VAR_DECLARATION = """
116extern char __{0}_{1}_start[];
117extern char __{0}_{1}_rom_start[];
Adithya Baglody65f79cd2018-12-17 14:21:34 +0530118extern char __{0}_{1}_size[];
Adithya Baglodyff631012018-11-26 21:52:42 +0530119"""
120
121
122DATA_COPY_FUNCTION = """
123void data_copy_xip_relocation(void)
124{{
125{0}
126}}
127"""
128
129BSS_ZEROING_FUNCTION = """
130void bss_zeroing_relocation(void)
131{{
132{0}
133}}
134"""
135
136MEMCPY_TEMPLATE = """
137 (void)memcpy(&__{0}_{1}_start, &__{0}_{1}_rom_start,
Kumar Galaa1b77fd2020-05-27 11:26:57 -0500138 (uint32_t) &__{0}_{1}_size);
Adithya Baglody65f79cd2018-12-17 14:21:34 +0530139
Adithya Baglodyff631012018-11-26 21:52:42 +0530140"""
141
142MEMSET_TEMPLATE = """
143 (void)memset(&__{0}_bss_start, 0,
Kumar Galaa1b77fd2020-05-27 11:26:57 -0500144 (uint32_t) &__{0}_bss_size);
Adithya Baglodyff631012018-11-26 21:52:42 +0530145"""
146
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000147
Adithya Baglodyff631012018-11-26 21:52:42 +0530148def find_sections(filename, full_list_of_sections):
149 with open(filename, 'rb') as obj_file_desc:
150 full_lib = ELFFile(obj_file_desc)
151 if not full_lib:
Ulf Magnusson50b9b122019-09-07 14:41:01 +0200152 sys.exit("Error parsing file: " + filename)
Adithya Baglodyff631012018-11-26 21:52:42 +0530153
154 sections = [x for x in full_lib.iter_sections()]
155
Adithya Baglodyff631012018-11-26 21:52:42 +0530156 for section in sections:
157
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000158 if ".text." in section.name:
Adithya Baglodyff631012018-11-26 21:52:42 +0530159 full_list_of_sections["text"].append(section.name)
160
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000161 if ".rodata." in section.name:
Adithya Baglodyff631012018-11-26 21:52:42 +0530162 full_list_of_sections["rodata"].append(section.name)
163
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000164 if ".data." in section.name:
Adithya Baglodyff631012018-11-26 21:52:42 +0530165 full_list_of_sections["data"].append(section.name)
166
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000167 if ".bss." in section.name:
Adithya Baglodyff631012018-11-26 21:52:42 +0530168 full_list_of_sections["bss"].append(section.name)
169
170 # Common variables will be placed in the .bss section
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000171 # only after linking in the final executable. This "if" finds
Adithya Baglodyff631012018-11-26 21:52:42 +0530172 # common symbols and warns the user of the problem.
173 # The solution to which is simply assigning a 0 to
174 # bss variable and it will go to the required place.
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000175 if ".symtab" in section.name:
Adithya Baglodyff631012018-11-26 21:52:42 +0530176 symbols = [x for x in section.iter_symbols()]
177 for symbol in symbols:
178 if symbol.entry["st_shndx"] == 'SHN_COMMON':
179 warnings.warn("Common variable found. Move "+
180 symbol.name + " to bss by assigning it to 0/NULL")
181
182 return full_list_of_sections
183
184
185def assign_to_correct_mem_region(memory_type,
186 full_list_of_sections, complete_list_of_sections):
187 all_regions = False
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000188 iteration_sections = {"text": False, "rodata": False, "data": False, "bss": False}
Adithya Baglodyff631012018-11-26 21:52:42 +0530189 if "_TEXT" in memory_type:
190 iteration_sections["text"] = True
191 memory_type = memory_type.replace("_TEXT", "")
192 if "_RODATA" in memory_type:
193 iteration_sections["rodata"] = True
194 memory_type = memory_type.replace("_RODATA", "")
195 if "_DATA" in memory_type:
196 iteration_sections["data"] = True
197 memory_type = memory_type.replace("_DATA", "")
198 if "_BSS" in memory_type:
199 iteration_sections["bss"] = True
200 memory_type = memory_type.replace("_BSS", "")
201 if not (iteration_sections["data"] or iteration_sections["bss"] or
202 iteration_sections["text"] or iteration_sections["rodata"]):
203 all_regions = True
204
Wentong Wu09af98a2019-09-19 21:40:29 +0800205 pos = memory_type.find('_')
206 if pos in range(len(memory_type)):
207 align_size = int(memory_type[pos+1:])
208 memory_type = memory_type[:pos]
209 mpu_align[memory_type] = align_size
210
Adithya Baglodyff631012018-11-26 21:52:42 +0530211 if memory_type in complete_list_of_sections:
212 for iter_sec in ["text", "rodata", "data", "bss"]:
213 if ((iteration_sections[iter_sec] or all_regions) and
214 full_list_of_sections[iter_sec] != []):
215 complete_list_of_sections[memory_type][iter_sec] += (
216 full_list_of_sections[iter_sec])
217 else:
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000218 # new memory type was found. in which case just assign the
Adithya Baglodyff631012018-11-26 21:52:42 +0530219 # full_list_of_sections to the memorytype dict
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000220 tmp_list = {"text": [], "rodata": [], "data": [], "bss": []}
Adithya Baglodyff631012018-11-26 21:52:42 +0530221 for iter_sec in ["text", "rodata", "data", "bss"]:
222 if ((iteration_sections[iter_sec] or all_regions) and
223 full_list_of_sections[iter_sec] != []):
224 tmp_list[iter_sec] = full_list_of_sections[iter_sec]
225
226 complete_list_of_sections[memory_type] = tmp_list
227
228 return complete_list_of_sections
229
230
231def print_linker_sections(list_sections):
232 print_string = ''
Marc Herbert6ccd0262019-06-24 12:20:18 -0700233 for section in sorted(list_sections):
Adithya Baglodyff631012018-11-26 21:52:42 +0530234 print_string += PRINT_TEMPLATE.format(section)
235 return print_string
236
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000237
Adithya Baglodyff631012018-11-26 21:52:42 +0530238def string_create_helper(region, memory_type,
239 full_list_of_sections, load_address_in_flash):
240 linker_string = ''
241 if load_address_in_flash:
242 load_address_string = LOAD_ADDRESS_LOCATION_FLASH.format(memory_type)
243 else:
244 load_address_string = LOAD_ADDRESS_LOCATION_BSS.format(memory_type)
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000245 if full_list_of_sections[region]:
Adithya Baglodyff631012018-11-26 21:52:42 +0530246 # Create a complete list of funcs/ variables that goes in for this
247 # memory type
248 tmp = print_linker_sections(full_list_of_sections[region])
Ulf Magnusson11d98ae2019-09-03 14:29:31 +0200249 if memory_type == 'SRAM' and region in {'data', 'bss'}:
Wentong Wu743a1842019-05-14 00:30:52 +0800250 linker_string += tmp
251 else:
Wentong Wufa7ce3f2019-07-02 01:18:40 +0800252 if memory_type != 'SRAM' and region == 'rodata':
Wentong Wu09af98a2019-09-19 21:40:29 +0800253 align_size = 0
254 if memory_type in mpu_align.keys():
255 align_size = mpu_align[memory_type]
256
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000257 linker_string += LINKER_SECTION_SEQ_MPU.format(memory_type.lower(), region, memory_type.upper(),
Wentong Wu09af98a2019-09-19 21:40:29 +0800258 region.upper(), tmp, load_address_string, align_size)
Wentong Wufa7ce3f2019-07-02 01:18:40 +0800259 else:
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000260 linker_string += LINKER_SECTION_SEQ.format(memory_type.lower(), region, memory_type.upper(),
261 region.upper(), tmp, load_address_string)
Adithya Baglodyff631012018-11-26 21:52:42 +0530262
Wentong Wu743a1842019-05-14 00:30:52 +0800263 if load_address_in_flash:
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000264 linker_string += SECTION_LOAD_MEMORY_SEQ.format(memory_type.lower(), region, memory_type.upper(),
265 region.upper())
Adithya Baglodyff631012018-11-26 21:52:42 +0530266 return linker_string
267
268
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000269def generate_linker_script(linker_file, sram_data_linker_file, sram_bss_linker_file, complete_list_of_sections):
Adithya Baglodyff631012018-11-26 21:52:42 +0530270 gen_string = ''
Wentong Wu743a1842019-05-14 00:30:52 +0800271 gen_string_sram_data = ''
272 gen_string_sram_bss = ''
Marc Herbert6ccd0262019-06-24 12:20:18 -0700273
274 for memory_type, full_list_of_sections in \
275 sorted(complete_list_of_sections.items()):
Wentong Wu743a1842019-05-14 00:30:52 +0800276
277 if memory_type != "SRAM":
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000278 gen_string += MPU_RO_REGION_START.format(memory_type.lower(), memory_type.upper())
279 gen_string += string_create_helper("text", memory_type, full_list_of_sections, 1)
280 gen_string += string_create_helper("rodata", memory_type, full_list_of_sections, 1)
Wentong Wu743a1842019-05-14 00:30:52 +0800281 if memory_type != "SRAM":
282 gen_string += MPU_RO_REGION_END.format(memory_type.lower())
283
284 if memory_type == 'SRAM':
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000285 gen_string_sram_data += string_create_helper("data", memory_type, full_list_of_sections, 1)
286 gen_string_sram_bss += string_create_helper("bss", memory_type, full_list_of_sections, 0)
Wentong Wu743a1842019-05-14 00:30:52 +0800287 else:
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000288 gen_string += string_create_helper("data", memory_type, full_list_of_sections, 1)
289 gen_string += string_create_helper("bss", memory_type, full_list_of_sections, 0)
Adithya Baglodyff631012018-11-26 21:52:42 +0530290
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000291 # finally writing to the linker file
Adithya Baglodyff631012018-11-26 21:52:42 +0530292 with open(linker_file, "a+") as file_desc:
293 file_desc.write(gen_string)
294
Wentong Wu743a1842019-05-14 00:30:52 +0800295 with open(sram_data_linker_file, "a+") as file_desc:
296 file_desc.write(gen_string_sram_data)
297
298 with open(sram_bss_linker_file, "a+") as file_desc:
299 file_desc.write(gen_string_sram_bss)
300
Adithya Baglodyff631012018-11-26 21:52:42 +0530301
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000302def generate_memcpy_code(memory_type, full_list_of_sections, code_generation):
Adithya Baglodyff631012018-11-26 21:52:42 +0530303 all_sections = True
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000304 generate_section = {"text": False, "rodata": False, "data": False, "bss": False}
Adithya Baglodyff631012018-11-26 21:52:42 +0530305 for section_name in ["_TEXT", "_RODATA", "_DATA", "_BSS"]:
306 if section_name in memory_type:
307 generate_section[section_name.lower()[1:]] = True
308 memory_type = memory_type.replace(section_name, "")
309 all_sections = False
310
311 if all_sections:
312 generate_section["text"] = True
313 generate_section["rodata"] = True
314 generate_section["data"] = True
315 generate_section["bss"] = True
316
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000317 # add all the regions that needs to be copied on boot up
Adithya Baglodyff631012018-11-26 21:52:42 +0530318 for mtype in ["text", "rodata", "data"]:
Wentong Wu743a1842019-05-14 00:30:52 +0800319 if memory_type == "SRAM" and mtype == "data":
320 continue
321
Adithya Baglodyff631012018-11-26 21:52:42 +0530322 if full_list_of_sections[mtype] and generate_section[mtype]:
323 code_generation["copy_code"] += MEMCPY_TEMPLATE.format(memory_type.lower(), mtype)
324 code_generation["extern"] += EXTERN_LINKER_VAR_DECLARATION.format(
325 memory_type.lower(), mtype)
326
327 # add for all the bss data that needs to be zeored on boot up
Wentong Wu743a1842019-05-14 00:30:52 +0800328 if full_list_of_sections["bss"] and generate_section["bss"] and memory_type != "SRAM":
Adithya Baglodyff631012018-11-26 21:52:42 +0530329 code_generation["zero_code"] += MEMSET_TEMPLATE.format(memory_type.lower())
330 code_generation["extern"] += EXTERN_LINKER_VAR_DECLARATION.format(
331 memory_type.lower(), "bss")
332
333 return code_generation
334
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000335
Adithya Baglodyff631012018-11-26 21:52:42 +0530336def dump_header_file(header_file, code_generation):
337 code_string = ''
338 # create a dummy void function if there is no code to generate for
339 # bss/data/text regions
340
341 code_string += code_generation["extern"]
342
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000343 if code_generation["copy_code"]:
Adithya Baglodyff631012018-11-26 21:52:42 +0530344 code_string += DATA_COPY_FUNCTION.format(code_generation["copy_code"])
345 else:
346 code_string += DATA_COPY_FUNCTION.format("void;")
347 if code_generation["zero_code"]:
348 code_string += BSS_ZEROING_FUNCTION.format(code_generation["zero_code"])
349 else:
350 code_string += BSS_ZEROING_FUNCTION.format("return;")
351
Adithya Baglodyff631012018-11-26 21:52:42 +0530352 with open(header_file, "w") as header_file_desc:
353 header_file_desc.write(SOURCE_CODE_INCLUDES)
354 header_file_desc.write(code_string)
355
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000356
Adithya Baglodyff631012018-11-26 21:52:42 +0530357def parse_args():
358 global args
359 parser = argparse.ArgumentParser(
360 description=__doc__,
361 formatter_class=argparse.RawDescriptionHelpFormatter)
362 parser.add_argument("-d", "--directory", required=True,
363 help="obj file's directory")
364 parser.add_argument("-i", "--input_rel_dict", required=True,
365 help="input src:memory type(sram2 or ccm or aon etc) string")
366 parser.add_argument("-o", "--output", required=False, help="Output ld file")
Wentong Wu743a1842019-05-14 00:30:52 +0800367 parser.add_argument("-s", "--output_sram_data", required=False,
368 help="Output sram data ld file")
369 parser.add_argument("-b", "--output_sram_bss", required=False,
370 help="Output sram bss ld file")
Adithya Baglodyff631012018-11-26 21:52:42 +0530371 parser.add_argument("-c", "--output_code", required=False,
372 help="Output relocation code header file")
373 parser.add_argument("-v", "--verbose", action="count", default=0,
374 help="Verbose Output")
375 args = parser.parse_args()
376
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000377
378# return the absolute path for the object file.
Adithya Baglodyff631012018-11-26 21:52:42 +0530379def get_obj_filename(searchpath, filename):
380 # get the object file name which is almost always pended with .obj
381 obj_filename = filename.split("/")[-1] + ".obj"
382
Ulf Magnusson12ba9df2019-03-19 19:28:24 +0100383 for dirpath, _, files in os.walk(searchpath):
Adithya Baglodyff631012018-11-26 21:52:42 +0530384 for filename1 in files:
385 if filename1 == obj_filename:
386 if filename.split("/")[-2] in dirpath.split("/")[-1]:
387 fullname = os.path.join(dirpath, filename1)
388 return fullname
389
390
391# Create a dict with key as memory type and files as a list of values.
392def create_dict_wrt_mem():
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000393 # need to support wild card *
Adithya Baglodyff631012018-11-26 21:52:42 +0530394 rel_dict = dict()
395 if args.input_rel_dict == '':
Ulf Magnusson50b9b122019-09-07 14:41:01 +0200396 sys.exit("Disable CONFIG_CODE_DATA_RELOCATION if no file needs relocation")
Adithya Baglodyff631012018-11-26 21:52:42 +0530397 for line in args.input_rel_dict.split(';'):
398 mem_region, file_name = line.split(':')
399
400 file_name_list = glob.glob(file_name)
401 if not file_name_list:
402 warnings.warn("File: "+file_name+" Not found")
403 continue
404 if mem_region == '':
405 continue
406 if args.verbose:
407 print("Memory region ", mem_region, " Selected for file:", file_name_list)
408 if mem_region in rel_dict:
409 rel_dict[mem_region].extend(file_name_list)
410 else:
411 rel_dict[mem_region] = file_name_list
412
413 return rel_dict
414
415
416def main():
Wentong Wu09af98a2019-09-19 21:40:29 +0800417 global mpu_align
418 mpu_align = {}
Adithya Baglodyff631012018-11-26 21:52:42 +0530419 parse_args()
420 searchpath = args.directory
421 linker_file = args.output
Wentong Wu743a1842019-05-14 00:30:52 +0800422 sram_data_linker_file = args.output_sram_data
423 sram_bss_linker_file = args.output_sram_bss
Adithya Baglodyff631012018-11-26 21:52:42 +0530424 rel_dict = create_dict_wrt_mem()
425 complete_list_of_sections = {}
426
427 # Create/or trucate file contents if it already exists
428 # raw = open(linker_file, "w")
429
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000430 # for each memory_type, create text/rodata/data/bss sections for all obj files
431 for memory_type, files in rel_dict.items():
432 full_list_of_sections = {"text": [], "rodata": [], "data": [], "bss": []}
Adithya Baglodyff631012018-11-26 21:52:42 +0530433
434 for filename in files:
435 obj_filename = get_obj_filename(searchpath, filename)
436 # the obj file wasn't found. Probably not compiled.
437 if not obj_filename:
438 continue
439
440 full_list_of_sections = find_sections(obj_filename, full_list_of_sections)
441
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000442 # cleanup and attach the sections to the memory type after cleanup.
Adithya Baglodyff631012018-11-26 21:52:42 +0530443 complete_list_of_sections = assign_to_correct_mem_region(memory_type,
444 full_list_of_sections,
445 complete_list_of_sections)
446
Wentong Wu743a1842019-05-14 00:30:52 +0800447 generate_linker_script(linker_file, sram_data_linker_file,
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000448 sram_bss_linker_file, complete_list_of_sections)
Marc Herbert6ccd0262019-06-24 12:20:18 -0700449
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000450 code_generation = {"copy_code": '', "zero_code": '', "extern": ''}
451 for mem_type, list_of_sections in sorted(complete_list_of_sections.items()):
Adithya Baglodyff631012018-11-26 21:52:42 +0530452 code_generation = generate_memcpy_code(mem_type,
453 list_of_sections, code_generation)
454
455 dump_header_file(args.output_code, code_generation)
456
Håkon Øye Amundsen4e135012019-08-15 08:36:15 +0000457
Adithya Baglodyff631012018-11-26 21:52:42 +0530458if __name__ == '__main__':
459 main()