diff mbox

[U-Boot] spl: armv7m: keep ARM v7M in thumb mode while jumping to entry point

Message ID 1491003284-20830-1-git-send-email-vikas.manocha@st.com
State Accepted
Commit 634fcf084875674d86c303e630f83b2017e7e07f
Delegated to: Tom Rini
Headers show

Commit Message

Vikas MANOCHA March 31, 2017, 11:34 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.

Similar commit:
f99993c10882f7dc8ec35993d5febe59aac01e6a
Author: Matt Porter <mporter@konsulko.com>
Date:   Tue May 5 15:00:23 2015 -0400
common/cmd_boot: keep ARM v7M in thumb mode during do_go_exec()

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
 common/spl/spl.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Marek Vasut April 1, 2017, 8:33 a.m. UTC | #1
On 04/01/2017 01:34 AM, 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.
> 
> Similar commit:
> f99993c10882f7dc8ec35993d5febe59aac01e6a
> Author: Matt Porter <mporter@konsulko.com>
> Date:   Tue May 5 15:00:23 2015 -0400
> common/cmd_boot: keep ARM v7M in thumb mode during do_go_exec()
> 
> Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

NAK, don't pollute common code with CPU-specific stuff.

> ---
>  common/spl/spl.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 2bc8b42..54897e7 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -85,6 +85,9 @@ 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";
>
Tom Rini April 9, 2017, 1:15 a.m. UTC | #2
On Fri, Mar 31, 2017 at 04:34:39PM -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.
> 
> Similar commit:
> f99993c10882f7dc8ec35993d5febe59aac01e6a
> Author: Matt Porter <mporter@konsulko.com>
> Date:   Tue May 5 15:00:23 2015 -0400
> common/cmd_boot: keep ARM v7M in thumb mode during do_go_exec()
> 
> Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 2bc8b42..54897e7 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -85,6 +85,9 @@  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";