Skip to contentSkip to conversation

spl: armv7m: keep ARM v7M in thumb mode while jumping to entry point

PATCH In review Vikas Manocha 3 participants 3 messages Mar 31, 2017 – Apr 9, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: armv7m: keep ARM v7M in thumb mode while jumping to entry point

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 <[email protected]>
Date: Tue May 5 15:00:23 2015 -0400
common/cmd_boot: keep ARM v7M in thumb mode during do_go_exec()

---
 common/spl/spl.c | 3 +++
 1 file changed, 3 insertions(+)
common/spl/spl.c +3 -0
index 2bc8b42..54897e7 100644
@@ -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";
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 spl: armv7m: keep ARM v7M in thumb mode while jumping to entry point

Quoted 11 lines · Vikas Manocha

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 <[email protected]>
Date: Tue May 5 15:00:23 2015 -0400
common/cmd_boot: keep ARM v7M in thumb mode during do_go_exec()

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

Quoted 19 lines
---
 common/spl/spl.c | 3 +++
 1 file changed, 3 insertions(+)
common/spl/spl.c +3 -0
index 2bc8b42..54897e7 100644
@@ -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";
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw
In reply to Vikas Manocha
Quoted 11 lines · Vikas Manocha

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 <[email protected]>
Date: Tue May 5 15:00:23 2015 -0400
common/cmd_boot: keep ARM v7M in thumb mode during do_go_exec()

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170408/d32ae799/attachment.sig>