something wrong in compiling lpcopen on lpc4357

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

something wrong in compiling lpcopen on lpc4357

450 Views
lpcware
NXP Employee
NXP Employee
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

Labels (1)
0 Kudos
2 Replies

367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DONGKU on Sat Apr 04 22:41:27 MST 2015
thank you for your solution. but my project need to support several platform, lpc4357 is one of them. the IDE should support to call different compiler. so that project could be moved into LPCXpresso IDE.
0 Kudos

367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Sat Apr 04 10:03:32 MST 2015
This code was written to work with the automated managed linker script mechanism within the LPCXpresso IDE (which CodeRed were originally behind).

The most likely issue is that you have your own linker script which don't match what LPCXpresso IDE would produce. The simplest approach here would probably be to just use the LPCXpresso IDE rather than the Sourcery tools, certainly until you get things working.

Regards,
LPCXpresso Support.

0 Kudos