Skip to contentSkip to conversation

arm/lib/bootm.c: keep ARM v7M in thumb mode during boot_jump_linux()

PATCH New patrice.chotard at st.com 2 participants 2 messages Apr 25, 2017 – Apr 28, 2017 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/lib/bootm.c: keep ARM v7M in thumb mode during boot_jump_linux()

From: Patrice Chotard <[email protected]>

On ARM v7M, the processor will return to ARM mode when executing a blx instruction with bit 0 of the address == 0. Always set it to 1 to stay in thumb mode.

Tested on STM32f746-disco board

Similar commit:
f99993c10882f7dc8ec35993d5febe59aac01e6a
Author: Matt Porter <[email protected]>

---
 arch/arm/lib/bootm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/lib/bootm.c +4 -1
index 8125cf0..6b1d3ae 100644
@@ -347,7 +347,10 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
 	int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
 
 	kernel_entry = (void (*)(int, int, uint))images->ep;
-
+#ifdef CONFIG_CPU_V7M
+	ulong addr = (ulong)kernel_entry | 1;
+	kernel_entry = (void *)addr;
+#endif
 	s = getenv("machid");
 	if (s) {
 		if (strict_strtoul(s, 16, &machid) < 0) {
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 arm/lib/bootm.c: keep ARM v7M in thumb mode during boot_jump_linux()

Quoted 6 lines · Patrice Chotard

From: Patrice Chotard <[email protected]>

On ARM v7M, the processor will return to ARM mode when executing a blx instruction with bit 0 of the address == 0. Always set it to 1 to stay in thumb mode.

Quoted 7 lines

Tested on STM32f746-disco board

Similar commit:
f99993c10882f7dc8ec35993d5febe59aac01e6a
Author: Matt Porter <[email protected]>

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/20170428/bbee3de2/attachment.sig>