blob: f407fb232752a92415d076b621c483f68da92dcb [file] [log] [blame]
Mike Frysinger4752c192008-10-12 21:32:52 -04001/*
Bin Meng75574052016-02-05 19:30:11 -08002 * U-Boot - u-boot.lds.S
Mike Frysinger4752c192008-10-12 21:32:52 -04003 *
Mike Frysinger8a351f62010-03-23 16:23:39 -04004 * Copyright (c) 2005-2010 Analog Device Inc.
Mike Frysinger4752c192008-10-12 21:32:52 -04005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
Mike Frysinger4752c192008-10-12 21:32:52 -040010 */
11
12#include <config.h>
13#include <asm/blackfin.h>
14#undef ALIGN
15#undef ENTRY
Mike Frysinger4752c192008-10-12 21:32:52 -040016
Mike Frysinger37f48702009-06-14 06:29:07 -040017#ifndef LDS_BOARD_TEXT
18# define LDS_BOARD_TEXT
19#endif
20
Mike Frysinger4752c192008-10-12 21:32:52 -040021/* 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 Frysingerdc029372010-12-24 19:31:55 -050027#ifndef L1_DATA_A_SRAM
28# define L1_DATA_A_SRAM 0
29# define L1_DATA_A_SRAM_SIZE 0
30#endif
Mike Frysinger4752c192008-10-12 21:32:52 -040031#ifndef L1_DATA_B_SRAM
Mike Frysingerdc029372010-12-24 19:31:55 -050032# define L1_DATA_B_SRAM L1_DATA_A_SRAM
33# define L1_DATA_B_SRAM_SIZE L1_DATA_A_SRAM_SIZE
Mike Frysinger4752c192008-10-12 21:32:52 -040034#endif
35
Mike Frysinger55daf842009-07-23 16:26:58 -040036/* 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 Frysinger4752c192008-10-12 21:32:52 -040043OUTPUT_ARCH(bfin)
44
45MEMORY
46{
Mike Frysinger4368ea22009-11-09 19:38:23 -050047#if CONFIG_MEM_SIZE
Mike Frysinger4752c192008-10-12 21:32:52 -040048 ram : ORIGIN = CONFIG_SYS_MONITOR_BASE, LENGTH = CONFIG_SYS_MONITOR_LEN
Mike Frysinger4368ea22009-11-09 19:38:23 -050049# 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 Frysinger55daf842009-07-23 16:26:58 -040055 l1_code : ORIGIN = L1_CODE_ORIGIN, LENGTH = L1_INST_SRAM_SIZE
Mike Frysinger4752c192008-10-12 21:32:52 -040056 l1_data : ORIGIN = L1_DATA_B_SRAM, LENGTH = L1_DATA_B_SRAM_SIZE
57}
58
59ENTRY(_start)
60SECTIONS
61{
Mike Frysinger685ec2c2009-11-03 06:11:31 -050062 .text.pre :
Mike Frysinger4752c192008-10-12 21:32:52 -040063 {
Peter Tyser12e57652010-04-12 22:28:13 -050064 arch/blackfin/cpu/start.o (.text .text.*)
Mike Frysinger37f48702009-06-14 06:29:07 -040065
66 LDS_BOARD_TEXT
Mike Frysinger685ec2c2009-11-03 06:11:31 -050067 } >ram_code
Mike Frysinger37f48702009-06-14 06:29:07 -040068
Mike Frysinger685ec2c2009-11-03 06:11:31 -050069 .text.init :
70 {
Peter Tyser12e57652010-04-12 22:28:13 -050071 arch/blackfin/cpu/initcode.o (.text .text.*)
Mike Frysinger685ec2c2009-11-03 06:11:31 -050072 } >ram_code
73 __initcode_lma = LOADADDR(.text.init);
74 __initcode_len = SIZEOF(.text.init);
Mike Frysinger37f48702009-06-14 06:29:07 -040075
Mike Frysinger685ec2c2009-11-03 06:11:31 -050076 .text :
77 {
Mike Frysinger4752c192008-10-12 21:32:52 -040078 *(.text .text.*)
Mike Frysinger4368ea22009-11-09 19:38:23 -050079 } >ram_code
Mike Frysinger4752c192008-10-12 21:32:52 -040080
81 .rodata :
82 {
83 . = ALIGN(4);
Mike Frysinger48fd4502010-01-15 04:47:06 -050084 *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
Mike Frysinger4752c192008-10-12 21:32:52 -040085 . = ALIGN(4);
Mike Frysinger4368ea22009-11-09 19:38:23 -050086 } >ram_data
Mike Frysinger4752c192008-10-12 21:32:52 -040087
88 .data :
89 {
Mike Frysinger120ad972010-01-19 21:02:00 -050090 . = ALIGN(4);
Mike Frysinger4752c192008-10-12 21:32:52 -040091 *(.data .data.*)
92 *(.data1)
93 *(.sdata)
94 *(.sdata2)
95 *(.dynamic)
96 CONSTRUCTORS
Mike Frysinger4368ea22009-11-09 19:38:23 -050097 } >ram_data
Mike Frysinger4752c192008-10-12 21:32:52 -040098
Mike Frysinger4752c192008-10-12 21:32:52 -040099
Marek Vasut607092a2012-10-12 10:27:03 +0000100 .u_boot_list : {
Albert ARIBAUDc24895e2013-02-25 00:59:00 +0000101 KEEP(*(SORT(.u_boot_list*)));
Marek Vasut607092a2012-10-12 10:27:03 +0000102 } >ram_data
103
Mike Frysinger4752c192008-10-12 21:32:52 -0400104 .text_l1 :
105 {
106 . = ALIGN(4);
107 __stext_l1 = .;
108 *(.l1.text)
109 . = ALIGN(4);
110 __etext_l1 = .;
Mike Frysinger4368ea22009-11-09 19:38:23 -0500111 } >l1_code AT>ram_code
Mike Frysinger685ec2c2009-11-03 06:11:31 -0500112 __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 Frysinger4752c192008-10-12 21:32:52 -0400115
116 .data_l1 :
117 {
118 . = ALIGN(4);
119 __sdata_l1 = .;
120 *(.l1.data)
121 *(.l1.bss)
122 . = ALIGN(4);
123 __edata_l1 = .;
Mike Frysinger4368ea22009-11-09 19:38:23 -0500124 } >l1_data AT>ram_data
Mike Frysinger685ec2c2009-11-03 06:11:31 -0500125 __data_l1_lma = LOADADDR(.data_l1);
126 __data_l1_len = SIZEOF(.data_l1);
Mike Frysingerdc029372010-12-24 19:31:55 -0500127 ASSERT (__data_l1_len <= L1_DATA_B_SRAM_SIZE, "L1 data overflow!")
Mike Frysinger4752c192008-10-12 21:32:52 -0400128
129 .bss :
130 {
131 . = ALIGN(4);
Mike Frysinger4752c192008-10-12 21:32:52 -0400132 *(.sbss) *(.scommon)
133 *(.dynbss)
134 *(.bss .bss.*)
135 *(COMMON)
Mike Frysingerd4fb2112010-11-15 08:16:19 -0500136 . = ALIGN(4);
Mike Frysinger4368ea22009-11-09 19:38:23 -0500137 } >ram_data
Sonic Zhang3fbfdd12014-07-17 19:00:29 +0800138 __bss_end = .;
139 __bss_start = ADDR(.bss);
Mike Frysinger685ec2c2009-11-03 06:11:31 -0500140 __bss_len = SIZEOF(.bss);
Sonic Zhang3fbfdd12014-07-17 19:00:29 +0800141 __init_end = .;
Mike Frysinger4752c192008-10-12 21:32:52 -0400142}