Line data Source code
1 1 : /*
2 : * Copyright (c) 2020, Synopsys, Inc.
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : /**
8 : * @file
9 : * @brief Metware toolchain linker defs
10 : *
11 : * This header file defines the necessary macros used by the linker script for
12 : * use with the metware linker.
13 : */
14 :
15 : #ifndef ZEPHYR_INCLUDE_LINKER_LINKER_TOOL_MWDT_H_
16 : #define ZEPHYR_INCLUDE_LINKER_LINKER_TOOL_MWDT_H_
17 :
18 : /*
19 : * mwdt linker doesn't have the following directives
20 : */
21 0 : #define ASSERT(x, y)
22 0 : #define SUBALIGN(x) ALIGN(x)
23 :
24 : /*
25 : * The GROUP_START() and GROUP_END() macros are used to define a group
26 : * of sections located in one memory area, such as RAM, ROM, etc.
27 : * The <where> parameter is the name of the memory area.
28 : */
29 0 : #define GROUP_START(where)
30 0 : #define GROUP_END(where)
31 :
32 : /*
33 : * The GROUP_LINK_IN() macro is located at the end of the section
34 : * description and tells the linker that this section is located in
35 : * the memory area specified by <where> argument.
36 : */
37 0 : #define GROUP_LINK_IN(where) > where
38 :
39 : /**
40 : * The GROUP_ROM_LINK_IN() macro is located at the end of the section
41 : * description and tells the linker that this a read-only section
42 : * that is physically placed at the 'lregion` argument.
43 : *
44 : */
45 1 : #define GROUP_ROM_LINK_IN(vregion, lregion) > lregion
46 :
47 : /*
48 : * As GROUP_LINK_IN(), but takes a second argument indicating the
49 : * memory region (e.g. "ROM") for the load address. Used for
50 : * initialized data sections that on XIP platforms must be copied at
51 : * startup.
52 : *
53 : * And, because output directives in GNU ld are "sticky", this must
54 : * also be used on the first section *after* such an initialized data
55 : * section, specifying the same memory region (e.g. "RAM") for both
56 : * vregion and lregion.
57 : */
58 : #ifdef CONFIG_XIP
59 : #define GROUP_DATA_LINK_IN(vregion, lregion) > vregion AT > lregion
60 : #else
61 0 : #define GROUP_DATA_LINK_IN(vregion, lregion) > vregion
62 : #endif
63 :
64 : /**
65 : * Route memory for read-write sections that are NOT loaded; typically this
66 : * is only used for 'BSS' and 'noinit'.
67 : */
68 : #ifdef CONFIG_XIP
69 : #define GROUP_NOLOAD_LINK_IN(vregion, lregion) > vregion AT > vregion
70 : #else
71 1 : #define GROUP_NOLOAD_LINK_IN(vregion, lregion) > vregion
72 : #endif
73 :
74 : /*
75 : * The SECTION_PROLOGUE() macro is used to define the beginning of a section.
76 : * The <name> parameter is the name of the section, and the <option> parameter
77 : * is to include any special options such as (NOLOAD). Page alignment has its
78 : * own parameter since it needs abstraction across the different toolchains.
79 : * If not required, the <options> and <align> parameters should be left blank.
80 : */
81 0 : #define SECTION_PROLOGUE(name, options, align) name options : align
82 :
83 : /*
84 : * As for SECTION_PROLOGUE(), except that this one must (!) be used
85 : * for data sections which on XIP platforms will have differing
86 : * virtual and load addresses (i.e. they'll be copied into RAM at
87 : * program startup). Such a section must (!) also use
88 : * GROUP_LINK_IN_LMA to specify the correct output load address.
89 : */
90 : #ifdef CONFIG_XIP
91 : #define SECTION_DATA_PROLOGUE(name, options, align) \
92 : name options ALIGN(8) : align
93 : #else
94 0 : #define SECTION_DATA_PROLOGUE(name, options, align) name options : align
95 :
96 : #endif
97 :
98 0 : #define SORT_BY_NAME(x) SORT(x)
99 :
100 : #endif /* ZEPHYR_INCLUDE_LINKER_LINKER_TOOL_MWDT_H_ */
|