lpcware

why it be that  in compiling LPCopen library for lpc4357.

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by DONGKU on Sat Apr 04 04:37:55 MST 2015
in Sysinit.c there is SystemInit() function.
void SystemInit(void)
{
#if defined(CORE_M3) || defined(CORE_M4)
unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;

#if defined(__IAR_SYSTEMS_ICC__)
extern void *__vector_table;

*pSCB_VTOR = (unsigned int) &__vector_table;
#elif defined(__CODE_RED)
extern void *g_pfnVectors;

*pSCB_VTOR = (unsigned int)g_pfnVectors;
#elif defined(__ARMCC_VERSION)
extern void *__Vectors;

*pSCB_VTOR = (unsigned int) &__Vectors;
#endif

#if defined(__FPU_PRESENT) && __FPU_PRESENT == 1
//fpuInit();
#endif

#if defined(NO_BOARD_LIB)
/* Chip specific SystemInit */
Chip_SystemInit();
#else
/* Board specific SystemInit */
Board_SystemInit();
#endif

#endif /* defined(CORE_M3) || defined(CORE_M4) */
}
I used __CODE_RED define
the assembly code is that
1a000608 <SystemInit>:
1a000608:4a02      ldrr2, [pc, #8]; (1a000614 <SystemInit+0xc>)
1a00060a:4b03      ldrr3, [pc, #12]; (1a000618 <SystemInit+0x10>)
1a00060c:6812      ldrr2, [r2, #0]
1a00060e:601a      strr2, [r3, #0]
1a000610:f7ff bf7a b.w1a000508 <Chip_SystemInit>
1a000614:1a000000 bne1a00061c <write_str>
1a000618:e000ed08 andlr, r0, r8, lsl #26
I found that  there is something wrong with it,
extern void *g_pfnVectors;
*pSCB_VTOR = (unsigned int)g_pfnVectors;
it should not have the ldr  r2,[r2 ,#0] ,
what happened !  the compiler work wrongly?
thak you for reply.
bypass :I use Sourcery_CodeBench_Lite_for_ARM_EABI  arm-none-eabi-gcc series tools.

Outcomes