diff mbox

[U-Boot,v2,1/7] spl: armv7m: to keep ARM v7M in thumb mode before booting next image

Message ID 1496001329-30038-2-git-send-email-vikas.manocha@st.com
State Accepted
Commit 6bcdd66d1c3766a970e06a61a7233daacb5045db
Delegated to: Tom Rini
Headers show

Commit Message

Vikas MANOCHA May 28, 2017, 7:55 p.m. UTC
On ARM v7M, the processor will return to ARM mode when executing blx
instruction with bit 0 of the address == 0. Always set it to 1 to stay in thumb
mode.

At present, it is applied only for raw U-Boot. This patch moves it to just
before booting next image. This way armv7m will be in thumb mode for any image
like raw or image with header like zImage or standard U-Boot.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---

Changed in v2: Added this patch in v2

 common/spl/spl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Tom Rini June 10, 2017, 1:45 p.m. UTC | #1
On Sun, May 28, 2017 at 12:55:08PM -0700, Vikas Manocha wrote:

> On ARM v7M, the processor will return to ARM mode when executing blx
> instruction with bit 0 of the address == 0. Always set it to 1 to stay in thumb
> mode.
> 
> At present, it is applied only for raw U-Boot. This patch moves it to just
> before booting next image. This way armv7m will be in thumb mode for any image
> like raw or image with header like zImage or standard U-Boot.
> 
> Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox

Patch

diff --git a/common/spl/spl.c b/common/spl/spl.c
index df984b8..1bdae3e 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -121,9 +121,6 @@  void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
 {
 	spl_image->size = CONFIG_SYS_MONITOR_LEN;
 	spl_image->entry_point = CONFIG_SYS_UBOOT_START;
-#ifdef CONFIG_CPU_V7M
-	spl_image->entry_point |= 0x1;
-#endif
 	spl_image->load_addr = CONFIG_SYS_TEXT_BASE;
 	spl_image->os = IH_OS_U_BOOT;
 	spl_image->name = "U-Boot";
@@ -396,6 +393,9 @@  void board_init_r(gd_t *dummy1, ulong dummy2)
 		hang();
 	}
 
+#ifdef CONFIG_CPU_V7M
+	spl_image.entry_point |= 0x1;
+#endif
 	switch (spl_image.os) {
 	case IH_OS_U_BOOT:
 		debug("Jumping to U-Boot\n");