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.

Tiva tm4c123gh6pm头文件错误

Other Parts Discussed in Thread: TM4C123GH6PM

Tiva tm4c123gh6pm的工程,使用MDK编写,在编译的时候全部通过,但是在链接的时候库文件都显示undefined symbol 。如SysCtlClockGet显示为Error:L6218:Undefined symbol SysCtlClockGet(referred from main.o)头文件路径也定义了。但是比较奇怪的是在rom.h里面的函数就没有报错。

  • 左面的东西截图不全,看不到你所有包含的文档,不外乎有两个原因

    1。你的这个库函数所在的.c文件没有包含

    2.你包含的路径没有设置好

    3.芯片的宏定义没有做好

    你仔细对比下你的MDK配置和官方的例程配置,就知道错误在哪了。

  • 嗯,确实是有漏掉了一部分的C文件,但是有一个IntRegister的函数始终没办法解决。然后现在是暂时先屏蔽掉使用

  • IntRegister的话,需要在启动文件中添加中断向量表的。

  • 我并没有使用到,只是把所有库里面的C添加进去的时候报错了。

  • 贴出IntRegister部分的代码和报错的信息看看。这个函数看名字像是中断函数的。

  • interrupt.c中

    void
    IntRegister(uint32_t ui32Interrupt, void (*pfnHandler)(void))
    {
        uint32_t ui32Idx, ui32Value;

        //
        // Check the arguments.
        //
        ASSERT(ui32Interrupt < NUM_INTERRUPTS);

        //
        // Make sure that the RAM vector table is correctly aligned.
        //
        ASSERT(((uint32_t)g_pfnRAMVectors & 0x000003ff) == 0);

        //
        // See if the RAM vector table has been initialized.
        //
        if(HWREG(NVIC_VTABLE) != (uint32_t)g_pfnRAMVectors)
        {
            //
            // Copy the vector table from the beginning of FLASH to the RAM vector
            // table.
            //
            ui32Value = HWREG(NVIC_VTABLE);
            for(ui32Idx = 0; ui32Idx < NUM_INTERRUPTS; ui32Idx++)
            {
                g_pfnRAMVectors[ui32Idx] = (void (*)(void))HWREG((ui32Idx * 4) +
                                                                 ui32Value);
            }

            //
            // Point the NVIC at the RAM vector table.
            //
            HWREG(NVIC_VTABLE) = (uint32_t)g_pfnRAMVectors;
        }

        //
        // Save the interrupt handler.
        //
        g_pfnRAMVectors[ui32Interrupt] = pfnHandler;
    }

  • 1.你中断表中有滴答定时器中断,而实际没有定义这个。

    2.你实际用的是IntRegister,函数原型的定义是SystickIntRegister,所以报错的吧。