lpcware

something wrong in compiling lpcopen on 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 Fri Apr 03 07:08:53 MST 2015
in cr_start_up_lpc43xx.c
there is the interrupt vector table
extern void (* const g_pfnVectors[])(void);
__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) = {
    // Core Level - CM4
    &_vStackTop,                    // The initial stack pointer
    ResetISR,                       // The reset handler
    NMI_Handler,                    // The NMI handler
    HardFault_Handler,              // The hard fault handler
    MemManage_Handler,              // The MPU fault handler
    BusFault_Handler,               // The bus fault handler
    UsageFault_Handler,             // The usage fault handler
    0,                              // Reserved
    0,                              // Reserved
    0,                              // Reserved
    0,                              // Reserved
    SVC_Handler,                    // SVCall handler
    DebugMon_Handler,               // Debug monitor handler
    0,                              // Reserved
    PendSV_Handler,                 // The PendSV handler
    SysTick_Handler,                // The SysTick handler 
    ............};
in sysinit.c  there is some statement used to set interrupt vector table base address in lpc4357
void SystemInit(void)
{
unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;
extern void *g_pfnVectors;

*pSCB_VTOR = (unsigned int)g_pfnVectors;
......}   this three statement is the key to set the base address.
here is the problem, according to the statement the vectortable base address is t g_pfnVectors and it should be stored in address 0xE000ED08 register.
when I finish compiling the code, downloading that via JLINK .  bypass in my code the interrupt vector table is loaded in 0x1a000000.so g_pfnVectors  is
0x1a000000, and the stacktop pointer is 0x10000800, in other words  &_vStackTop is 0x10000800. because  _vStackTop is defined in linkscript.
I debug it , I find that the value stored in address 0xE000ED08 is 0x10000800, but  is not 0x1a000000.  I try to find it out by debug it  in step, at last the
assembly code is working as the resault. the value is 0x10000800. what happened !  there is something with the compiler. I can not execute into the interrupt function now.
I use  eclipse IDE ,and the compiler is Sourcery_CodeBench_Lite_for_ARM_EABI arm-none-eabi-gcc.

thank you for your reply .

Original Attachment has been moved to: sysinit_0.c.zip

Outcomes