在当前 PC 0x0 上找不到源代码行 [英] No source code lines were found at current PC 0x0

查看:131
本文介绍了在当前 PC 0x0 上找不到源代码行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 MPLAB X IDE 时遇到问题.我有一个带有主要部分的 main.c.

I am having issues using MPLAB X IDE. I have a main.c with a main section.

当我尝试调试时,我不能.它说没有找到源代码行.我已经编译了软件并在 MPLAB IDE 中进行了调试,没有出现问题.我觉得 MPLAB X 中好像有一个设置或其他一些我缺少的基本设置.

When I try to debug, I can't. It says no source code lines were found. I have compiled the software and debugged in MPLAB IDE without issue. I feel as though there is a setting in MPLAB X or something else basic that I am missing.

虽然我不确定它是否有用,但为了提供信息,我使用 PICKit2 进行调试,MPLAB X IDE v1.51,PIC16F876 uC.

Though I am not sure it is useful, for the sake of information, I am using a PICKit2 for debugging, MPLAB X IDE v1.51, PIC16F876 uC.

main.c 中的主要代码:

main code in main.c:

int main(int argc, char** argv) {

    busyDelay(10000);
    port_init(); //Initialize GPIO, Timers & Interrupts

    TUBE_ON = 0x1;
    while (1) {
            asm("nop");
    }
    return (EXIT_SUCCESS);
}

当我尝试调试时,我在调试器控制台中得到以下信息:

When I try to debug I get the following in the Debugger Console:

Launching
Programming target
No source code lines were found at current PC 0x0
User program stopped
User program finished

推荐答案

这是由错误的初始化指针引起的运行时问题.

This is a run time problem caused by bad initialized pointers.

您的代码执行试图在地址 0x00 处执行代码.当您调用指向未初始化函数的指针时会发生这种情况,这意味着它的值为 0.如果不是,您可能正在尝试向未初始化的指针读取或写入数据.

Your code execution is trying to execute code at address 0x00. It happens when you call a pointer to a function that was not initialized, which means, it holds the value 0. If not, you may be trying to read or write data to a pointer that was not initialized as well.

或者,通常地址 0x00,在微控制器上,是代码的开头.必须有从地址 0x00 开始运行的启动代码,以执行 C 代码所需的初始化.所以,您还没有将启动文件添加到项目中.

Or, usually the address 0x00, on micro controllers, is the beginning of the code. There must be and startup code that runs from the address 0x00 to perform the initializations required by the C code. So, you haven't added the startup file to the project.

这篇关于在当前 PC 0x0 上找不到源代码行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆