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.