No source code lines were found at current PC 0x0

旧巷老猫 提交于 2019-12-13 18:05:41

问题


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

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.

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 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

回答1:


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

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.

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.




回答2:


I was debugging on the Eb006 v9 using pickit2 and on MPLABx. Initially, the message was to turn off Low voltage programming and watchdog. Hence I added these lines

#pragma config   WDTE=OFF, LVP=OFF

However it was still giving me the same issue, after scratching my head around and by chance adding FOSC=XT, i.e. there is a crystal on the board suddenly it resolved the problem, hence for me, this config worked

#pragma config  FOSC=XT, WDTE=OFF, LVP=OFF

Hope this helps someone :)




回答3:


I've encountered this by selecting the wrong oscillator type. For example, with an external 20MHz crystal wired in my circuit, I inadvertently selected XT as the FOSC. I should have used HS thus:

#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator (HS))

This fixed my instance of the "No source code lines were found at current PC 0x0" error.




回答4:


It seems that it's some sort of MPLAB X bug. In order to make the debugger work you have to close first the PIC Memory view, in case you were previously looking at variables. Here's my answer's source.



来源:https://stackoverflow.com/questions/15490040/no-source-code-lines-were-found-at-current-pc-0x0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!