小弟想把keil mdk下的LPC1114工程移植到IAR for ARM下,目前来说已经成了一个半成品,在keil下工程调试时可以在IDE中复位MCU,然后从头开始运行。但这个功能在IAR下不知道为何就是无法正常使用,如果点击回到程序开头那个按钮,程序依然不会回去到main函数开始处,而是继续保留在当前执行的地方。我怀疑我的启动文件有问题,大家知道在IAR下可以使用c文件编写启动文件也可以使用汇编文件编写启动文件,我自己参照其他的厂商的芯片编写了一个c语言版本的启动文件,如下,可能存在问题。但是不知道问题在哪?哪位大侠知道LPC11xx系列片子的IAR启动文件(.s 或.c都可以,只要能正常使用)能不能帮我贴一份出来,感激不尽!
- //*****************************************************************************
//
// Enable the IAR extensions for this source file.
//
//*****************************************************************************
#pragma language=extended
//*****************************************************************************
//
// Forward declaration of the default fault handlers.
//
//*****************************************************************************
static void NmiSR(void);
static void FaultISR(void);
static void IntDefaultHandler(void);
//*****************************************************************************
//
// The entry point for the application.
//
//*****************************************************************************
extern void __iar_program_start(void);
//*****************************************************************************
//
// Reserve space for the system stack.
//
//*****************************************************************************
#ifndef STACK_SIZE
#define STACK_SIZE 120
#endif
static unsigned long pulStack[STACK_SIZE] @ ".noinit";
//*****************************************************************************
//
// A union that describes the entries of the vector table. The union is needed
// since the first entry is the stack pointer and the remainder are function
// pointers.
//
//*****************************************************************************
typedef union
{
void (*pfnHandler)(void);
unsigned long ulPtr;
}
uVectorEntry;
//*****************************************************************************
//
// The minimal vector table for a Cortex-M0. Note that the proper constructs
// must be placed on this to ensure that it ends up at physical address
// 0x0000.0000.
//
//*****************************************************************************
__root const uVectorEntry __vector_table[] @ ".intvec" =
{
{ .ulPtr = (unsigned long)pulStack + sizeof(pulStack) },
// The initial stack pointer
__iar_program_start, // The reset handler
NmiSR, // The NMI handler
FaultISR, // The hard fault handler
0, // The MPU fault handler
0, // The bus fault handler
0, // The usage fault handler
0, // Reserved
0, // Reserved
0, // Reserved
0, // Reserved
IntDefaultHandler, // SVCall handler
IntDefaultHandler, // Debug monitor handler
0, // Reserved
IntDefaultHandler, // The PendSV handler
IntDefaultHandler, // The SysTick handler
IntDefaultHandler, // 16+ 0: Wakeup PIO0.0
IntDefaultHandler, // 16+ 1: Wakeup PIO0.1
IntDefaultHandler, // 16+ 2: Wakeup PIO0.2
IntDefaultHandler, // 16+ 3: Wakeup PIO0.3
IntDefaultHandler, // 16+ 4: Wakeup PIO0.4
IntDefaultHandler, // 16+ 5: Wakeup PIO0.5
IntDefaultHandler, // 16+ 6: Wakeup PIO0.6
IntDefaultHandler, // 16+ 7: Wakeup PIO0.7
IntDefaultHandler, // 16+ 8: Wakeup PIO0.8
IntDefaultHandler, // 16+ 9: Wakeup PIO0.9
IntDefaultHandler, // 16+ 10: Wakeup PIO0.10
IntDefaultHandler, // 16+ 11: Wakeup PIO0.11
IntDefaultHandler, // 16+12: Wakeup PIO1.0
IntDefaultHandler, // 16+13: Reserved
IntDefaultHandler, // 16+14: SSP1
IntDefaultHandler, // 16+15: I2C
IntDefaultHandler, // 16+16: 16-bit Counter-Timer 0
IntDefaultHandler, // 16+17: 16-bit Counter-Timer 1
IntDefaultHandler, // 16+18: 32-bit Counter-Timer 0
IntDefaultHandler, // 16+19: 32-bit Counter-Timer 1
IntDefaultHandler, // 16+20: SSP0
IntDefaultHandler, // 16+21: UART
IntDefaultHandler, // 16+22: Reserved
IntDefaultHandler, // 16+23: Reserved
IntDefaultHandler, // 16+24: A/D Converter
IntDefaultHandler, // 16+25: Watchdog Timer
IntDefaultHandler, // 16+26: Brown Out Detect
IntDefaultHandler, // 16+27: Reserved
IntDefaultHandler, // 16+28: PIO INT3
IntDefaultHandler, // 16+29: PIO INT2
IntDefaultHandler, // 16+30: PIO INT1
};
volatile unsigned long* g_vector_table_address = (volatile unsigned long*)__vector_table;
//*****************************************************************************
//
// This is the code that gets called when the processor receives a NMI. This
// simply enters an infinite loop, preserving the system state for examination
// by a debugger.
//
//*****************************************************************************
static void
NmiSR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives a fault
// interrupt. This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
FaultISR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives an unexpected
// interrupt. This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
IntDefaultHandler(void)
{
//
// Go into an infinite loop.
//
while(1)
{
}
}
复制代码
此帖出自
小平头技术问答
一周热门 更多>