在线时间57 小时
UID3080775
注册时间2014-12-5
NXP金币0
该用户从未签到
中级会员
 
- 积分
- 357
- 最后登录
- 2015-12-1
|
本帖最后由 cjpx84 于 2015-3-26 10:38 编辑
最近参考freescale官网提供的bootlaoder1.1源代码,将其bootloader代码移植到MKL14上,发现在跳转到用户应用程序的时候,会进入到Default_Handler接口。
void Default_Handler()
{
__asm("bkpt");
}
我初步定为到已进入MAIN函数就会发生异常。代码设置如下所示:
1)跳转代码如下所示:
void jump_to_application(uint32_t applicationAddress, uint32_t stackPointer)
{
// Create the function call to the user application.
// Static variables are needed since changed the stack pointer out from under the compiler
// we need to ensure the values we are using are not stored on the previous stack
static uint32_t s_stackPointer = 0;
s_stackPointer = stackPointer;
static void (*farewellBootloader)(void) = 0;
farewellBootloader = (void (*)(void))applicationAddress;
// Set the VTOR to the application vector table address.
SCB_VTOR = (uint32_t)APP_VECTOR_TABLE;
// Set stack pointers to the application stack pointer.
__set_MSP(s_stackPointer);
__set_PSP(s_stackPointer);
// Jump to the application.
farewellBootloader();
}
2)用户程序,我将连接文件做了修改,使其的起始地址从0x8000开始,代码如下所示:
MEMORY
{
m_interrupts (rx) : ORIGIN = 0x00008000, LENGTH = 0xC0
m_cfmprotrom (rx) : ORIGIN = 0x00008400, LENGTH = 0x10
m_text (rx) : ORIGIN = 0x00008800, LENGTH = 32K - 0x800
m_data (rwx) : ORIGIN = 0x1FFFF800, LENGTH = 8K
}
3)应用代码已经下载到MCU的0x8000开始的地址处。
请教下,这种问题我应该怎么去定位,或者这一般是怎引起的的?
|
|