rockchip: rk3288: Add TPL_LDSCRIPT
Subsystems (3)
PATCH 1/2 rockchip: rk3288: Add TPL_LDSCRIPT
Due to size limitations in SPL by adding falcon mode, rk3288 support TPL. In order to not overlap SPL_TEXT_BASE add TPL_TEXT_BASE with u-boot-tpl.lds that intern call u-boot-spl.lds with proper TEXT_BASE values.
--- arch/arm/mach-rockchip/Kconfig | 7 +++++++ arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds | 10 ++++++++++ 2 files changed, 17 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds
arch/arm/mach-rockchip/Kconfig +7 -0
@@ -72,6 +72,13 @@ config ROCKCHIP_RK3288 and video codec support. Peripherals include Gigabit Ethernet, USB2 host and OTG, SDIO, I2S, UARTs, SPI, I2C and PWMs. +if ROCKCHIP_RK3288 + +config TPL_LDSCRIPT + default "arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds" + +endif + config ROCKCHIP_RK3328 bool "Support Rockchip RK3328" select ARM64
arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds new file +10 -0
@@ -0,0 +1,10 @@ +/* + * Copyright (C) 2018 Jagan Teki <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#undef CONFIG_SPL_TEXT_BASE +#define CONFIG_SPL_TEXT_BASE CONFIG_TPL_TEXT_BASE + +#include "../../cpu/u-boot-spl.lds"
Signature · 1 line
2.7.4
PATCH 2/2 rockchip: rk3288: Fix TPL_TEXT_BASE
rockchip boot0 add 4 bytes data (0xeaffffff) at beginning of executable(0x800) in order to make generic and compatible boot0 for all platforms and the resulting executable will be input to mkimage and the output of mkimage with initial 4 bytes will overwritten by 'spl_hdr'
Since the TPL_TEXT_BASE in rk3288 is 0xff704004 which is improper align to branch-to-next-instruction-word, so the resulting 4 bytes are written at ff704020 of executable instead of beginning ff704000
Hexdump with overlaped bytes:
-----------------------------
0000000 0000 0000 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 ffff eaff
So, fix this improper TEXT_BASE which is wrong even before and update it to 0xff704000 so-that the boot0 will add 4 bytes at beginning.
Disassembly:
-----------
with 0xff704020 TEXT_BASE:
ff704004 <__image_copy_start>:
b 1f /* if overwritten, entry-address is at the next word */ff704020: eaffffff b ff704024 <__image_copy_start+0x20>
with 0xff704000 TEXT_BASE:
ff704000 <__image_copy_start>:
b 1f /* if overwritten, entry-address is at the next word */ff704000: eaffffff b ff704004 <__image_copy_start+0x4>
This patch will also move TPL_TEXT_BASE into kconfig.
--- arch/arm/mach-rockchip/Kconfig | 3 +++ configs/vyasa-rk3288_defconfig | 1 - 2 files changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +3 -0
@@ -77,6 +77,9 @@ if ROCKCHIP_RK3288 config TPL_LDSCRIPT default "arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds" +config TPL_TEXT_BASE + default 0xff704000 + endif config ROCKCHIP_RK3328
configs/vyasa-rk3288_defconfig +0 -1
@@ -5,7 +5,6 @@ CONFIG_ARCH_ROCKCHIP=y CONFIG_SYS_TEXT_BASE=0x00100000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ROCKCHIP_RK3288=y -CONFIG_TPL_TEXT_BASE=0xff704004 CONFIG_TARGET_VYASA_RK3288=y CONFIG_SPL_STACK_R_ADDR=0x80000 CONFIG_DEFAULT_DEVICE_TREE="rk3288-vyasa"
Signature · 1 line
2.7.4
PATCH 2/2 rockchip: rk3288: Fix TPL_TEXT_BASE
Quoted 33 lines
rockchip boot0 add 4 bytes data (
0xeaffffff) at beginning of executable(0x800) in order to make generic and compatible boot0 for all platforms and the resulting executable will be input to mkimage and the output of mkimage with initial 4 bytes will overwritten by 'spl_hdr'Since the
TPL_TEXT_BASEin rk3288 is0xff704004which is improper align to branch-to-next-instruction-word, so the resulting 4 bytes are written atff704020of executable instead of beginningff704000Hexdump with overlaped bytes:
-----------------------------
0000000 0000 0000 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 ffff eaffSo, fix this improper
TEXT_BASEwhich is wrong even before and update it to0xff704000so-that the boot0 will add 4 bytes at beginning.Disassembly:
-----------
with0xff704020TEXT_BASE:
ff704004<__image_copy_start>:
b 1f /* if overwritten, entry-address is at the next word */ff704020: eaffffff bff704024<__image_copy_start+0x20>with
0xff704000TEXT_BASE:
ff704000<__image_copy_start>:
b 1f /* if overwritten, entry-address is at the next word */ff704000: eaffffff bff704004<__image_copy_start+0x4>
Quoted 8 lines
This patch will also move
TPL_TEXT_BASEinto kconfig.Signed-off-by Jagan Teki <[email protected]>--- arch/arm/mach-rockchip/Kconfig | 3 +++ configs/vyasa-rk3288_defconfig | 1 - 2 files changed, 3 insertions(+), 1 deletion(-)
PATCH 2/2 rockchip: rk3288: Fix TPL_TEXT_BASE
In reply to Jagan TekiQuoted 5 lines · Jagan Teki
rockchip boot0 add 4 bytes data (
0xeaffffff) at beginning of executable(0x800) in order to make generic and compatible boot0 for all platforms and the resulting executable will be input to mkimage and the output of mkimage with initial 4 bytes will overwritten by 'spl_hdr'
This is factually wrong (the beginning of the executable is neither at 0x800 nor are 4 bytes of data inserted by boot0 ... boot0 inserts a branch-instruction w/ an immediate offset). Please rewrite.
Quoted 22 lines
Since the
TPL_TEXT_BASEin rk3288 is0xff704004which is improper align to branch-to-next-instruction-word, so the resulting 4 bytes are written atff704020of executable instead of beginningff704000Hexdump with overlaped bytes:
-----------------------------
0000000 0000 0000 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 ffff eaffSo, fix this improper
TEXT_BASEwhich is wrong even before and update it to0xff704000so-that the boot0 will add 4 bytes at beginning.Disassembly:
-----------
with0xff704020TEXT_BASE:
ff704004<__image_copy_start>:
b 1f /* if overwritten, entry-address is at the next word */ff704020: eaffffff bff704024<__image_copy_start+0x20>
Quoted 5 lines
with
0xff704000TEXT_BASE:
ff704000<__image_copy_start>:
b 1f /* if overwritten, entry-address is at the next word */ff704000: eaffffff bff704004<__image_copy_start+0x4>
This is confusing. Please rewrite so it is clear what the problem is and why the wrong TEXT_BASE is causing these effects.
Quoted 36 lines
This patch will also move
TPL_TEXT_BASEinto kconfig.Signed-off-by Jagan Teki <[email protected]>Acked-by Philipp Tomsich <[email protected]>---
arch/arm/mach-rockchip/Kconfig| 3 +++
configs/vyasa-rk3288_defconfig | 1 -2 files changed, 3 insertions(+), 1 deletion(-)arch/arm/mach-rockchip/Kconfig +0
-0@@ -77,6 +77,9 @@ if ROCKCHIP_RK3288config
TPL_LDSCRIPTdefault "arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds"arch/arm/mach-rockchip/Kconfig +3
-0+config TPL_TEXT_BASE + default 0xff704000 +endif
config
ROCKCHIP_RK3328configs/vyasa-rk3288_defconfig +0
-0@@ -5,7 +5,6 @@ CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00100000CONFIG_SYS_MALLOC_F_LEN=0x2000CONFIG_ROCKCHIP_RK3288=y
-CONFIG_TPL_TEXT_BASE=0xff704004CONFIG_TARGET_VYASA_RK3288=yCONFIG_SPL_STACK_R_ADDR=0x80000CONFIG_DEFAULT_DEVICE_TREE="rk3288-vyasa"
PATCH 1/2 rockchip: rk3288: Add TPL_LDSCRIPT
In reply to Jagan TekiQuoted 5 lines
Due to size limitations in SPL by adding falcon mode, rk3288 support TPL. In order to not overlap
SPL_TEXT_BASEaddTPL_TEXT_BASEwithu-boot-tpl.ldsthat intern callu-boot-spl.ldswith properTEXT_BASEvalues.
Quoted 7 lines
Signed-off-by Jagan Teki <[email protected]>--- arch/arm/mach-rockchip/Kconfig | 7 +++++++ arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds | 10 ++++++++++ 2 files changed, 17 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds
PATCH 1/2 rockchip: rk3288: Add TPL_LDSCRIPT
In reply to Jagan TekiQuoted 4 lines · Jagan Teki
Due to size limitations in SPL by adding falcon mode, rk3288 support TPL. In order to not overlap
SPL_TEXT_BASEaddTPL_TEXT_BASEwithu-boot-tpl.ldsthat intern callu-boot-spl.ldswith properTEXT_BASEvalues.
A separate TPL_LDSCRIPT is needed only, if the SPL and TPL text base are to be different... is this the case (from include/configs/rk3288_common.h it seems that both SPL and TPL are starting in SRAM)?
Quoted 44 lines
Signed-off-by Jagan Teki <[email protected]>Acked-by Philipp Tomsich <[email protected]>---
arch/arm/mach-rockchip/Kconfig| 7 +++++++arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds| 10 ++++++++++2 files changed, 17 insertions(+)create mode 100644
arch/arm/mach-rockchip/rk3288/u-boot-tpl.ldsarch/arm/mach-rockchip/Kconfig +7
-0@@ -72,6 +72,13 @@ config ROCKCHIP_RK3288 and video codec support. Peripherals include Gigabit Ethernet, USB2 host and OTG, SDIO, I2S, UARTs, SPI, I2C and PWMs. +if ROCKCHIP_RK3288 + +config TPL_LDSCRIPT + default "arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds" + +endif +config
ROCKCHIP_RK3328
bool "Support Rockchip RK3328"
select ARM64arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds new file +10
-0@@ -0,0 +1,10 @@ +/* + * Copyright (C) 2018 Jagan Teki <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#undef CONFIG_SPL_TEXT_BASE +#define CONFIG_SPL_TEXT_BASE CONFIG_TPL_TEXT_BASE + +#include "../../cpu/u-boot-spl.lds"
PATCH 1/2 rockchip: rk3288: Add TPL_LDSCRIPT
Quoted 10 lines · Philipp Tomsich
Quoted 4 lines · Jagan Teki
Due to size limitations in SPL by adding falcon mode, rk3288 support TPL. In order to not overlap
SPL_TEXT_BASEaddTPL_TEXT_BASEwithu-boot-tpl.ldsthat intern callu-boot-spl.ldswith properTEXT_BASEvalues.
Quoted 3 lines
A separate
TPL_LDSCRIPTis needed only, if the SPL and TPL text base are to be different... is this the case (frominclude/configs/rk3288_common.hit seems that both SPL and TPL are starting in SRAM)?
Yes, with TPL_BOOTROM
TPL_TEXT is 0xff704000SPL_TEXT is 0x0