From bc04edecc1f7347d91772d112d1f644ffaf474ce Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 4 Nov 2022 23:20:52 +0800 Subject: [PATCH] Fix undefined reference to `tmp' in function `load_kernel.constprop.0': Signed-off-by: Xiang Xiao --- arch/arm/src/lc823450/lc823450_ipl2.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/arm/src/lc823450/lc823450_ipl2.c b/arch/arm/src/lc823450/lc823450_ipl2.c index 8dbd1635d4..e32c6d9951 100644 --- a/arch/arm/src/lc823450/lc823450_ipl2.c +++ b/arch/arm/src/lc823450/lc823450_ipl2.c @@ -109,7 +109,6 @@ static struct ****************************************************************************/ static char copybuf[512]; -static void *tmp; /**************************************************************************** * Private Functions @@ -265,8 +264,7 @@ err: static void load_kernel(const char *name, const char *devname) { int i; - - tmp = (void *)0x02040000; + void *tmp = (void *)0x02040000; blk_read(tmp, 512 * 1024, devname, 0); @@ -287,10 +285,9 @@ static void load_kernel(const char *name, const char *devname) __asm__ __volatile__ ( - "ldr r0, =tmp\n" - "ldr r1, [r0, #0]\n" /* r1 = 0x02040000 */ - "ldr sp, [r1, #0]\n" /* set sp */ - "ldr pc, [r1, #4]" /* set pc, start nuttx */ + "ldr sp, [%0, #0]\n" /* set sp */ + "ldr pc, [%0, #4]" /* set pc, start nuttx */ + : : "r"(tmp) ); }