Keil Logo

Debug session ending unexpectedly

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Caleb George
Posted
9-Aug-2018 16:09 GMT
Toolset
ARM
New! Debug session ending unexpectedly

I am programming a TM4C123GH6PM EVB for the Cortex-M4 using mVision5 and the Stellaris ICIDI debugger. The project builds without error and I can flash the project to the board but when I start a debug session, the session is ended almost immediately without any kind of error message. It appears to run to "LDR R0, =SystemInit" before crashing. I have not modified the device startup code at all. What do I need to do to stop the debug session from crashing? I had no problem with this until I made some minor changes in my main method.

My main() method, which is the only code in the project besides the header file:

int main(void)
{
        uint32_t ui32Input;
        bool res;
        SysCtlClockSet(SYSCTL_SYSDIV_10|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
        SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOB|SYSCTL_RCGC2_GPIOC|SYSCTL_RCGC2_GPIOD;
        GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_3);
        GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_4); //Speaker
        GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_3);      //DIP Switch 1
        res = SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOB|SYSCTL_PERIPH_GPIOC|SYSCTL_PERIPH_GPIOD);
        if (res)
        {
                while (1)
                {
                        ui32Input = GPIO_PORTD_DATA_R;
                        if ((ui32Input & 0x8) == 0x8)
                        {
                                GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_3, 0x8);
                                GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_4, 0x10);
                                SysCtlDelay(500000);
                                GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_3, 0x0);
                                GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_4, 0x0);
                                SysCtlDelay(500000);
                        }
                }
        }
}


P.S. The program is taken from Practical Microcontroller Engineering by Ying Bai.

Read-Only
Author
Caleb George
Posted
9-Aug-2018 16:25 GMT
Toolset
ARM
New! RE: Debug session ending unexpectedly

By the way, when I erase the flash memory and re-download the project to the board, the Build Output says that it works. However, when I try to interact with the program by flipping a switch on the board, nothing happens until I enter a debug session. Even though the debug session crashes, it does something because afterward I can flip the switch and the expected LED lights up and the speaker makes the expected racket.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.