This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: Bootloader下载程序后会触发错误中断
以下是我bootloader程序中,对memory的分配。应用程序下载的起始地址为0x00010020。
以下是我应用程序的cmd文件中,对memory的分配
此时在使用can口将程序下载进flash后,调用((void (*)(void))g_ulTransferAddress)()后,程序进入prefetchEntry。
以下是我改动应用程序的cmd文件后,对memory的分配。
此时在使用can口将程序下载进flash后,调用((void (*)(void))g_ulTransferAddress)()后,程序进入undefEntry。
请问我该如何修改应用程序的cmd文件?
我将Application的CMD文件按照您说的更改以后,运行到 ((void (*)(void))g_ulTransferAddress)()时,进入prefetchEntry中断,g_ulTransferAddress = 0x00010020。请问该问题是什么原因导致的?同时我将Application程序通过仿真器下载至0x10020后,又在0x00000000debug了bootloader程序,此时运行 ((void (*)(void))g_ulTransferAddress)()后,跳转至0x10020处的程序是可以正常运行的。请问一下我通过can传输下载至flash中的程序为何无法正常跳转?
在Application的sys_startup.c中,由于SYSESR寄存器在bootloader中被清零,getResetSource()的返回值为0x0。 请向默认部分添加一些代码,如下所示:
以下是我的application example中的代码(蓝色):
rstSrc = getResetSource();
switch(rstSrc)
{
case POWERON_RESET:
... ...
... ...
default:
/* USER CODE BEGIN (21) */
if(rstSrc != POWERON_RESET)
{
_memInit_();
}
_coreEnableEventBusExport_();
if ((esmREG->SR1[2]) != 0U)
{
esmGroup3Notification(esmREG,esmREG->SR1[2]);
}
systemInit();
_coreEnableIrqVicOffset_();
vimInit();
esmInit();
/* USER CODE END */
break;
}
代码执行不是跳转到 0x10020 处的 Application 吗?
运行到 ((void (*)(void))g_ulTransferAddress)()时,进入prefetchEntry中断
运行至((void (*)(void))g_ulTransferAddress)()后,程序又进入了undefEntry中断
您得到了哪个异常:prefetch 还是 undef?
您可以手动检查 0x10020 处的内容以确保其正确吗?
如果您使用 TI bootloader example,请使用以下方法为应用程序生成二进制文件:
Post-build steps
"${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/armofd" "${CG_TOOL_ROOT}/bin/armhex" "${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin"
bootloader example不支持其他二进制格式或十六进制格式。