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.
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.
I have the same problem, but I think is the newest version of Keil uVision. When I erase the flash memory and re-download de the project, the debug session stop immediately, the same problem. Any other solution that you ever found?
EDIT: Oops! I see the OP is over a year old - just been woken up by JZorro's hijack, duplicated here:
https://community.arm.com/developer/tools-software/tools/f/keil-forum/45279/who-can-help-me-with-debug-session-problem
Caleb George said:I had no problem with this until I made some minor changes in my main method.
So what, exactly, did you change?
Does it work again if you go back to the unmodified version?
View all questions in Keil forum