Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
linker-tool-mwdt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020, Synopsys, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
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#define ASSERT(x, y)
22#define SUBALIGN(x) ALIGN(x)
23
24#define LOG2CEIL(x) ((((x) <= 2048) ? 11 : (((x) <= 4096)?12:(((x) <= 8192) ? \
25 13 : (((x) <= 16384) ? 14 : (((x) <= 32768) ? 15:(((x) <= 65536) ? \
26 16 : (((x) <= 131072) ? 17 : (((x) <= 262144) ? 18:(((x) <= 524288) ? \
27 19 : (((x) <= 1048576) ? 20 : (((x) <= 2097152) ? \
28 21 : (((x) <= 4194304) ? 22 : (((x) <= 8388608) ? \
29 23 : (((x) <= 16777216) ? 24 : (((x) <= 33554432) ? \
30 25 : (((x) <= 67108864) ? 26 : (((x) <= 134217728) ? \
31 27 : (((x) <= 268435456) ? 28 : (((x) <= 536870912) ? \
32 29 : (((x) <= 1073741824) ? 30 : (((x) <= 2147483648) ? \
33 31 : 32))))))))))))))))))))))
34/*
35 * The GROUP_START() and GROUP_END() macros are used to define a group
36 * of sections located in one memory area, such as RAM, ROM, etc.
37 * The <where> parameter is the name of the memory area.
38 */
39#define GROUP_START(where)
40#define GROUP_END(where)
41
42/*
43 * The GROUP_LINK_IN() macro is located at the end of the section
44 * description and tells the linker that this section is located in
45 * the memory area specified by <where> argument.
46 */
47#define GROUP_LINK_IN(where) > where
48
55#define GROUP_ROM_LINK_IN(vregion, lregion) > lregion
56
57/*
58 * As GROUP_LINK_IN(), but takes a second argument indicating the
59 * memory region (e.g. "ROM") for the load address. Used for
60 * initialized data sections that on XIP platforms must be copied at
61 * startup.
62 *
63 * And, because output directives in GNU ld are "sticky", this must
64 * also be used on the first section *after* such an initialized data
65 * section, specifying the same memory region (e.g. "RAM") for both
66 * vregion and lregion.
67 */
68#ifdef CONFIG_XIP
69#define GROUP_DATA_LINK_IN(vregion, lregion) > vregion AT > lregion
70#else
71#define GROUP_DATA_LINK_IN(vregion, lregion) > vregion
72#endif
73
78#ifdef CONFIG_XIP
79#define GROUP_NOLOAD_LINK_IN(vregion, lregion) > vregion AT > vregion
80#else
81#define GROUP_NOLOAD_LINK_IN(vregion, lregion) > vregion
82#endif
83
84/*
85 * The SECTION_PROLOGUE() macro is used to define the beginning of a section.
86 * The <name> parameter is the name of the section, and the <option> parameter
87 * is to include any special options such as (NOLOAD). Page alignment has its
88 * own parameter since it needs abstraction across the different toolchains.
89 * If not required, the <options> and <align> parameters should be left blank.
90 */
91
92#define SECTION_PROLOGUE(name, options, align) name options align :
93
94/*
95 * As for SECTION_PROLOGUE(), except that this one must (!) be used
96 * for data sections which on XIP platforms will have differing
97 * virtual and load addresses (i.e. they'll be copied into RAM at
98 * program startup). Such a section must (!) also use
99 * GROUP_LINK_IN_LMA to specify the correct output load address.
100 */
101#ifdef CONFIG_XIP
102#define SECTION_DATA_PROLOGUE(name, options, align) \
103 name options ALIGN_WITH_INPUT align :
104#else
105#define SECTION_DATA_PROLOGUE(name, options, align) name options align :
106#endif
107
108#define SORT_BY_NAME(x) SORT(x)
109
110#endif /* ZEPHYR_INCLUDE_LINKER_LINKER_TOOL_MWDT_H_ */