Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 1 | /* |
Bin Meng | a187559 | 2016-02-05 19:30:11 -0800 | [diff] [blame] | 2 | * U-Boot - u-boot.lds.S |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 3 | * |
Mike Frysinger | a3c0836 | 2010-03-23 16:23:39 -0400 | [diff] [blame] | 4 | * Copyright (c) 2005-2010 Analog Device Inc. |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 5 | * |
| 6 | * (C) Copyright 2000-2004 |
| 7 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 8 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 9 | * SPDX-License-Identifier: GPL-2.0+ |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <config.h> |
| 13 | #include <asm/blackfin.h> |
| 14 | #undef ALIGN |
| 15 | #undef ENTRY |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 16 | |
Mike Frysinger | 9ff67e5 | 2009-06-14 06:29:07 -0400 | [diff] [blame] | 17 | #ifndef LDS_BOARD_TEXT |
| 18 | # define LDS_BOARD_TEXT |
| 19 | #endif |
| 20 | |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 21 | /* If we don't actually load anything into L1 data, this will avoid |
| 22 | * a syntax error. If we do actually load something into L1 data, |
| 23 | * we'll get a linker memory load error (which is what we'd want). |
| 24 | * This is here in the first place so we can quickly test building |
| 25 | * for different CPU's which may lack non-cache L1 data. |
| 26 | */ |
Mike Frysinger | 105be90 | 2010-12-24 19:31:55 -0500 | [diff] [blame] | 27 | #ifndef L1_DATA_A_SRAM |
| 28 | # define L1_DATA_A_SRAM 0 |
| 29 | # define L1_DATA_A_SRAM_SIZE 0 |
| 30 | #endif |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 31 | #ifndef L1_DATA_B_SRAM |
Mike Frysinger | 105be90 | 2010-12-24 19:31:55 -0500 | [diff] [blame] | 32 | # define L1_DATA_B_SRAM L1_DATA_A_SRAM |
| 33 | # define L1_DATA_B_SRAM_SIZE L1_DATA_A_SRAM_SIZE |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 34 | #endif |
| 35 | |
Mike Frysinger | f51e001 | 2009-07-23 16:26:58 -0400 | [diff] [blame] | 36 | /* The 0xC offset is so we don't clobber the tiny LDR jump block. */ |
| 37 | #ifdef CONFIG_BFIN_BOOTROM_USES_EVT1 |
| 38 | # define L1_CODE_ORIGIN L1_INST_SRAM |
| 39 | #else |
| 40 | # define L1_CODE_ORIGIN L1_INST_SRAM + 0xC |
| 41 | #endif |
| 42 | |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 43 | OUTPUT_ARCH(bfin) |
| 44 | |
| 45 | MEMORY |
| 46 | { |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 47 | #if CONFIG_MEM_SIZE |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 48 | ram : ORIGIN = CONFIG_SYS_MONITOR_BASE, LENGTH = CONFIG_SYS_MONITOR_LEN |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 49 | # define ram_code ram |
| 50 | # define ram_data ram |
| 51 | #else |
| 52 | # define ram_code l1_code |
| 53 | # define ram_data l1_data |
| 54 | #endif |
Mike Frysinger | f51e001 | 2009-07-23 16:26:58 -0400 | [diff] [blame] | 55 | l1_code : ORIGIN = L1_CODE_ORIGIN, LENGTH = L1_INST_SRAM_SIZE |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 56 | l1_data : ORIGIN = L1_DATA_B_SRAM, LENGTH = L1_DATA_B_SRAM_SIZE |
| 57 | } |
| 58 | |
| 59 | ENTRY(_start) |
| 60 | SECTIONS |
| 61 | { |
Mike Frysinger | b1e2c55 | 2009-11-03 06:11:31 -0500 | [diff] [blame] | 62 | .text.pre : |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 63 | { |
Peter Tyser | c6fb83d | 2010-04-12 22:28:13 -0500 | [diff] [blame] | 64 | arch/blackfin/cpu/start.o (.text .text.*) |
Mike Frysinger | 9ff67e5 | 2009-06-14 06:29:07 -0400 | [diff] [blame] | 65 | |
| 66 | LDS_BOARD_TEXT |
Mike Frysinger | b1e2c55 | 2009-11-03 06:11:31 -0500 | [diff] [blame] | 67 | } >ram_code |
Mike Frysinger | 9ff67e5 | 2009-06-14 06:29:07 -0400 | [diff] [blame] | 68 | |
Mike Frysinger | b1e2c55 | 2009-11-03 06:11:31 -0500 | [diff] [blame] | 69 | .text.init : |
| 70 | { |
Peter Tyser | c6fb83d | 2010-04-12 22:28:13 -0500 | [diff] [blame] | 71 | arch/blackfin/cpu/initcode.o (.text .text.*) |
Mike Frysinger | b1e2c55 | 2009-11-03 06:11:31 -0500 | [diff] [blame] | 72 | } >ram_code |
| 73 | __initcode_lma = LOADADDR(.text.init); |
| 74 | __initcode_len = SIZEOF(.text.init); |
Mike Frysinger | 9ff67e5 | 2009-06-14 06:29:07 -0400 | [diff] [blame] | 75 | |
Mike Frysinger | b1e2c55 | 2009-11-03 06:11:31 -0500 | [diff] [blame] | 76 | .text : |
| 77 | { |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 78 | *(.text .text.*) |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 79 | } >ram_code |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 80 | |
| 81 | .rodata : |
| 82 | { |
| 83 | . = ALIGN(4); |
Mike Frysinger | ed912d4 | 2010-01-15 04:47:06 -0500 | [diff] [blame] | 84 | *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 85 | . = ALIGN(4); |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 86 | } >ram_data |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 87 | |
| 88 | .data : |
| 89 | { |
Mike Frysinger | 38b9b74 | 2010-01-19 21:02:00 -0500 | [diff] [blame] | 90 | . = ALIGN(4); |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 91 | *(.data .data.*) |
| 92 | *(.data1) |
| 93 | *(.sdata) |
| 94 | *(.sdata2) |
| 95 | *(.dynamic) |
| 96 | CONSTRUCTORS |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 97 | } >ram_data |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 98 | |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 99 | |
Marek Vasut | 5567514 | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 100 | .u_boot_list : { |
Albert ARIBAUD | ef123c5 | 2013-02-25 00:59:00 +0000 | [diff] [blame] | 101 | KEEP(*(SORT(.u_boot_list*))); |
Marek Vasut | 5567514 | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 102 | } >ram_data |
| 103 | |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 104 | .text_l1 : |
| 105 | { |
| 106 | . = ALIGN(4); |
| 107 | __stext_l1 = .; |
| 108 | *(.l1.text) |
| 109 | . = ALIGN(4); |
| 110 | __etext_l1 = .; |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 111 | } >l1_code AT>ram_code |
Mike Frysinger | b1e2c55 | 2009-11-03 06:11:31 -0500 | [diff] [blame] | 112 | __text_l1_lma = LOADADDR(.text_l1); |
| 113 | __text_l1_len = SIZEOF(.text_l1); |
| 114 | ASSERT (__text_l1_len <= L1_INST_SRAM_SIZE, "L1 text overflow!") |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 115 | |
| 116 | .data_l1 : |
| 117 | { |
| 118 | . = ALIGN(4); |
| 119 | __sdata_l1 = .; |
| 120 | *(.l1.data) |
| 121 | *(.l1.bss) |
| 122 | . = ALIGN(4); |
| 123 | __edata_l1 = .; |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 124 | } >l1_data AT>ram_data |
Mike Frysinger | b1e2c55 | 2009-11-03 06:11:31 -0500 | [diff] [blame] | 125 | __data_l1_lma = LOADADDR(.data_l1); |
| 126 | __data_l1_len = SIZEOF(.data_l1); |
Mike Frysinger | 105be90 | 2010-12-24 19:31:55 -0500 | [diff] [blame] | 127 | ASSERT (__data_l1_len <= L1_DATA_B_SRAM_SIZE, "L1 data overflow!") |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 128 | |
| 129 | .bss : |
| 130 | { |
| 131 | . = ALIGN(4); |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 132 | *(.sbss) *(.scommon) |
| 133 | *(.dynbss) |
| 134 | *(.bss .bss.*) |
| 135 | *(COMMON) |
Mike Frysinger | 49508d4 | 2010-11-15 08:16:19 -0500 | [diff] [blame] | 136 | . = ALIGN(4); |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 137 | } >ram_data |
Sonic Zhang | c49eabe | 2014-07-17 19:00:29 +0800 | [diff] [blame] | 138 | __bss_end = .; |
| 139 | __bss_start = ADDR(.bss); |
Mike Frysinger | b1e2c55 | 2009-11-03 06:11:31 -0500 | [diff] [blame] | 140 | __bss_len = SIZEOF(.bss); |
Sonic Zhang | c49eabe | 2014-07-17 19:00:29 +0800 | [diff] [blame] | 141 | __init_end = .; |
Mike Frysinger | 84a9dda | 2008-10-12 21:32:52 -0400 | [diff] [blame] | 142 | } |