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.

在tm4c123gh6pm上编写的BootLoader程序,在跳转到第二个程序时,第一个程序的配置输出并没有被重置复位

我在第一段程序中使能了GPIOF,使F1输出高驱动一个led亮,跳转到第二段程序时正常运行时,发现F1驱动的led灯仍为亮,但是如果在跳转前F1输出低关闭这个led灯,跳转后就不会亮,所以我想知道在跳转到第二段程序后,从开始执行ResetISR()这个函数到我的main函数这个期间,到底发生了什么, _c_int00()这个函数具体实现是在哪里定义的,他内部是执行了哪些操作,有没有对所有外设复位;如果系统没有自动复位外设的话,我应该如何解决这个问题,是不是要在第二段程序开始就调用SysCtlPeripheralReset(uint32_t ui32Peripheral)和SysCtlPeripheralDisable(uint32_t ui32Peripheral)将所有外设复位并禁能?

#pragma DATA_SECTION(g_pfnVectors, ".intvecs")
void (* const g_pfnVectors[])(void) =
{
(void (*)(void))((uint32_t)&__STACK_TOP),
// The initial stack pointer
ResetISR, // The reset handler
NmiSR, // The NMI handler
FaultISR, // The hard fault handler

......................

}

//*****************************************************************************
//
// This is the code that gets called when the processor first starts execution
// following a reset event. Only the absolutely necessary set is performed,
// after which the application supplied entry() routine is called. Any fancy
// actions (such as making decisions based on the reset cause register, and
// resetting the bits in that register) are left solely in the hands of the
// application.
//
//*****************************************************************************

void ResetISR(void)
{
//
// Jump to the CCS C initialization routine. This will enable the
// floating-point unit as well, so that does not need to be done here.
//
__asm(" .global _c_int00\n"
" b.w _c_int00");
}

//*****************************************************************************
//
// External declaration for the reset handler that is to be called when the
// processor is started
//
//*****************************************************************************
extern void _c_int00(void);

  • _c_int00()这个函数应该是在.lib文件中的,按照TI的说法,是不涉及到外设的操作的。你使能外设复位后,是否亮了呢?

    C程序开始运行时,必须首先初始化C运行环境,这是通过c_int0函数完成的,这个函数在运行支持库(rts,runtime-support library)中。连接器会将这个函数的入口地址放置在复位中断向量处,使其可以在初始化时被调用。c_int0函数进行以下工作以建立C运行环境:为系统堆栈产生.stack块,并初始化堆栈指针。从.cinit块将初始化数据拷贝到.bss块中相应的变量。调用main函数,开始运行C程序。用户可以对c_int0函数进行修改,但修改后的函数必须完成以上任务。