Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013-2014, Wind River Systems, Inc. |
| 3 | * |
Javier B Perez Hernandez | f7fffae | 2015-10-06 11:00:37 -0500 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 7 | * |
Javier B Perez Hernandez | f7fffae | 2015-10-06 11:00:37 -0500 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 9 | * |
Javier B Perez Hernandez | f7fffae | 2015-10-06 11:00:37 -0500 | [diff] [blame] | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
Anas Nashif | 275ca60 | 2015-12-04 10:09:39 -0500 | [diff] [blame^] | 17 | /** |
| 18 | * @file |
| 19 | * @brief GCC toolchain linker defs |
| 20 | * |
Dan Kalowsky | da67b29 | 2015-10-20 09:42:33 -0700 | [diff] [blame] | 21 | * This header file defines the necessary macros used by the linker script for |
| 22 | * use with the GCC linker. |
Anas Nashif | ea0d0b2 | 2015-07-01 17:22:39 -0400 | [diff] [blame] | 23 | */ |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 24 | |
| 25 | #ifndef __LINKER_TOOL_GCC_H |
| 26 | #define __LINKER_TOOL_GCC_H |
| 27 | |
Peter Mitsis | 25fd37d | 2015-06-17 11:16:57 -0400 | [diff] [blame] | 28 | #if defined(CONFIG_CPU_CORTEX_M) |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 29 | OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 30 | #elif defined(CONFIG_ARC) |
| 31 | OUTPUT_FORMAT("elf32-littlearc", "elf32-bigarc", "elf32-littlearc") |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 32 | #else |
Anas Nashif | 9aeb082 | 2015-06-19 23:37:23 -0400 | [diff] [blame] | 33 | #if defined(__IAMCU) |
| 34 | OUTPUT_FORMAT("elf32-iamcu") |
| 35 | OUTPUT_ARCH(iamcu:intel) |
| 36 | #else |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 37 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") |
| 38 | OUTPUT_ARCH(i386) |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 39 | #endif |
Anas Nashif | 9aeb082 | 2015-06-19 23:37:23 -0400 | [diff] [blame] | 40 | #endif |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 41 | |
| 42 | /* |
| 43 | * The GROUP_START() and GROUP_END() macros are used to define a group |
| 44 | * of sections located in one memory area, such as RAM, ROM, etc. |
| 45 | * The <where> parameter is the name of the memory area. |
| 46 | */ |
| 47 | #define GROUP_START(where) |
| 48 | #define GROUP_END(where) |
| 49 | |
| 50 | /* |
| 51 | * The GROUP_LINK_IN() macro is located at the end of the section |
| 52 | * description and tells the linker that this section is located in |
| 53 | * the memory area specified by <where> argument. |
| 54 | */ |
| 55 | #define GROUP_LINK_IN(where) > where |
| 56 | |
| 57 | /* |
| 58 | * The GROUP_FOLLOWS_AT() macro is located at the end of the section |
| 59 | * and indicates that the section does not specify an address at which |
| 60 | * it is to be loaded, but that it follows a section which did specify |
| 61 | * such an address |
| 62 | */ |
| 63 | #define GROUP_FOLLOWS_AT(where) AT > where |
| 64 | |
| 65 | /* |
| 66 | * The SECTION_PROLOGUE() macro is used to define the beginning of a section. |
| 67 | * The <name> parameter is the name of the section, and the <option> parameter |
| 68 | * is to include any special options such as (NOLOAD). Page alignment has its |
| 69 | * own parameter since it needs abstraction across the different toolchains. |
| 70 | * If not required, the <options> and <align> parameters should be left blank. |
| 71 | */ |
| 72 | |
| 73 | #define SECTION_PROLOGUE(name, options, align) name options : align |
| 74 | |
| 75 | /* |
| 76 | * The SECTION_AT_PROLOGUE() macro is similar to SECTION_PROLOGUE() except |
| 77 | * that, in addition, the address at which the section is to be loaded is |
| 78 | * specified. |
| 79 | */ |
| 80 | |
| 81 | #define SECTION_AT_PROLOGUE(name, options, align, addr) \ |
| 82 | name options : align AT(addr) |
| 83 | |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 84 | #define SORT_BY_NAME(x) SORT(x) |
| 85 | #define OPTIONAL |
| 86 | |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 87 | #define COMMON_SYMBOLS *(COMMON) |
| 88 | |
| 89 | #endif /* !__LINKER_TOOL_GCC_H */ |