From 17652760001cec19cd25f48fa18d0c973f5ca345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 12 Sep 2018 09:43:14 +0200 Subject: [PATCH] arch: arm: Use BL instead of B to jump to _PrepC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The __reset vector is using the 'b' instruction to jump to _PrepC. 'b' can only jump 2KB on Cortex-M0 platforms so this causes build failures when _PrepC happens to be too far away from __reset. To resolve this we use 'bl' instead as it can jump two thousand times further[0]. This can also be resolved by porting the reset vector to C or by placing the _PrepC function in a dedicated section that the linker places next to __reset. [0] http://infocenter.arm.com/help/topic/com.arm.doc.dui0489e/Cihfddaf.html Signed-off-by: Sebastian Bøe --- arch/arm/core/cortex_m/reset.S | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/core/cortex_m/reset.S b/arch/arm/core/cortex_m/reset.S index 374efeb8878..84e27e575a7 100644 --- a/arch/arm/core/cortex_m/reset.S +++ b/arch/arm/core/cortex_m/reset.S @@ -102,4 +102,9 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) */ isb - b _PrepC + /* + * 'bl' jumps the furthest of the branch instructions that are + * supported on all platforms. So it is used when jumping to _PrepC + * (even though we do not intend to return). + */ + bl _PrepC