blob: d918b4395bf41e13810bcd51e0f44b84077bec7e [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Scott Woodc97cd1b2012-09-20 19:02:18 -05002/*
3 * (C) Copyright 2006
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de
5 *
6 * Copyright 2009 Freescale Semiconductor, Inc.
Scott Woodc97cd1b2012-09-20 19:02:18 -05007 */
8
Masahiro Yamada6f2ed0e2014-04-28 10:17:10 +09009#include "config.h"
Scott Woodc97cd1b2012-09-20 19:02:18 -050010
11OUTPUT_ARCH(powerpc)
Pali Rohárc0f47562022-06-16 14:19:44 +020012
Scott Woodc97cd1b2012-09-20 19:02:18 -050013SECTIONS
14{
Pali Rohár786d9f12022-05-11 20:57:31 +020015/* Optional boot sector */
16#if defined(CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR)
17 .bootsect IMAGE_TEXT_BASE - CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR_DATA * 512 : {
18 KEEP(*(.bootsect))
19 . = CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR_DATA * 512;
20 }
21#endif
22
Tom Rini2f41ade2019-01-22 17:09:26 -050023 . = IMAGE_TEXT_BASE;
Scott Woodc97cd1b2012-09-20 19:02:18 -050024 .text : {
Pali Rohárc0f47562022-06-16 14:19:44 +020025/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
Tom Rinide47ff52022-06-10 22:59:37 -040026#if CONFIG_IS_ENABLED(SYS_MPC85XX_NO_RESETVEC)
Pali Rohárc0f47562022-06-16 14:19:44 +020027 KEEP(*(.bootpg))
28#endif
Scott Woodc97cd1b2012-09-20 19:02:18 -050029 *(.text*)
30 }
31 _etext = .;
32
33 .reloc : {
34 _GOT2_TABLE_ = .;
35 KEEP(*(.got2))
36 KEEP(*(.got))
Scott Woodc97cd1b2012-09-20 19:02:18 -050037 _FIXUP_TABLE_ = .;
38 KEEP(*(.fixup))
39 }
40 __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
41 __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
42
43 . = ALIGN(8);
44 .data : {
45 *(.rodata*)
46 *(.data*)
47 *(.sdata*)
48 }
49 _edata = .;
50
Ying Zhang81b867a2013-09-04 17:03:45 +080051 . = ALIGN(4);
Andrew Scull99e2fbc2022-05-30 10:00:04 +000052 __u_boot_list : {
53 KEEP(*(SORT(__u_boot_list*)));
Ying Zhang81b867a2013-09-04 17:03:45 +080054 }
55
Ying Zhangbb0dc102013-08-16 15:16:11 +080056 . = .;
57 __start___ex_table = .;
58 __ex_table : { *(__ex_table) }
59 __stop___ex_table = .;
60
Pali Rohár7696b802022-08-05 22:09:40 +020061 . = ALIGN(4);
Scott Woodc97cd1b2012-09-20 19:02:18 -050062 __init_begin = .;
63 __init_end = .;
Jagdish Gediya4d3294b2018-09-03 21:35:05 +053064 _end = .;
Pali Rohár5a428e72022-08-05 22:09:41 +020065
Marek Behúna0759682022-09-19 11:32:08 +020066#if CONFIG_IS_ENABLED(SYS_MPC85XX_NO_RESETVEC)
Tom Rini65cc0e22022-11-16 13:10:41 -050067#if defined(CONFIG_SDCARD) && !defined(CFG_SYS_MMC_U_BOOT_OFFS)
Pali Rohár5a428e72022-08-05 22:09:41 +020068 mmc_u_boot_offs = .;
69#endif
70#endif
71
Prabhakar Kushwaha651fcf62014-04-08 19:12:31 +053072#ifdef CONFIG_SPL_SKIP_RELOCATE
73 . = ALIGN(4);
74 __bss_start = .;
75 .bss : {
76 *(.sbss*)
77 *(.bss*)
78 }
79 . = ALIGN(4);
80 __bss_end = .;
81#endif
Po Liu66099162014-01-10 10:10:58 +080082
Pali Rohár1245c6e2022-04-05 15:12:35 +020083/* For nor and nand is needed the SPL with section .resetvec */
Tom Rinide47ff52022-06-10 22:59:37 -040084#if !CONFIG_IS_ENABLED(SYS_MPC85XX_NO_RESETVEC)
Scott Woodc97cd1b2012-09-20 19:02:18 -050085#if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
Prabhakar Kushwaha49efe85b2014-04-08 19:12:19 +053086#ifndef BOOT_PAGE_OFFSET
87#define BOOT_PAGE_OFFSET 0x1000
88#endif
Pali Rohár1245c6e2022-04-05 15:12:35 +020089 .bootpg IMAGE_TEXT_BASE + BOOT_PAGE_OFFSET :
Scott Woodc97cd1b2012-09-20 19:02:18 -050090 {
Prabhakar Kushwaha3a881792013-04-16 13:27:59 +053091 arch/powerpc/cpu/mpc85xx/start.o (.bootpg)
Scott Woodc97cd1b2012-09-20 19:02:18 -050092 }
Prabhakar Kushwaha49efe85b2014-04-08 19:12:19 +053093#ifndef RESET_VECTOR_OFFSET
Scott Woodc97cd1b2012-09-20 19:02:18 -050094#define RESET_VECTOR_OFFSET 0x1ffc /* IFC has 8K sram */
Prabhakar Kushwaha49efe85b2014-04-08 19:12:19 +053095#endif
Scott Woodc97cd1b2012-09-20 19:02:18 -050096#elif defined(CONFIG_FSL_ELBC)
97#define RESET_VECTOR_OFFSET 0xffc /* LBC has 4k sram */
98#else
99#error unknown NAND controller
100#endif
Pali Rohár1245c6e2022-04-05 15:12:35 +0200101 .resetvec IMAGE_TEXT_BASE + RESET_VECTOR_OFFSET : {
Scott Woodc97cd1b2012-09-20 19:02:18 -0500102 KEEP(*(.resetvec))
103 } = 0xffff
Tom Rini65cc0e22022-11-16 13:10:41 -0500104#if defined(CONFIG_SDCARD) && !defined(CFG_SYS_MMC_U_BOOT_OFFS)
Pali Rohár5a428e72022-08-05 22:09:41 +0200105 mmc_u_boot_offs = .;
106#endif
Ying Zhang5df572f2013-05-20 14:07:23 +0800107#endif
Scott Woodc97cd1b2012-09-20 19:02:18 -0500108
Prabhakar Kushwaha651fcf62014-04-08 19:12:31 +0530109#ifndef CONFIG_SPL_SKIP_RELOCATE
Scott Woodc97cd1b2012-09-20 19:02:18 -0500110 /*
111 * Make sure that the bss segment isn't linked at 0x0, otherwise its
112 * address won't be updated during relocation fixups.
113 */
114 . |= 0x10;
115
Ying Zhang67ad0d52013-06-07 17:25:16 +0800116 . = ALIGN(4);
Scott Woodc97cd1b2012-09-20 19:02:18 -0500117 __bss_start = .;
118 .bss : {
119 *(.sbss*)
120 *(.bss*)
121 }
Ying Zhang67ad0d52013-06-07 17:25:16 +0800122 . = ALIGN(4);
Simon Glass3929fb02013-03-14 06:54:53 +0000123 __bss_end = .;
Prabhakar Kushwaha651fcf62014-04-08 19:12:31 +0530124#endif
Scott Woodc97cd1b2012-09-20 19:02:18 -0500125}