Dear all,
I'm currently evaluating uVision4.74 as a preparation for a course in embedded systems, so we would like to test the simulation capabilities of this IDE for the TM4C123GH6PM microcontroller. So far the debugging tools are great, however when I try to step over an empty FOR loop to insert a delay in a typical Blink LED's program every attempt to single step the loop fails. The loop is entered but it won't stop after all the iterations are completed, at this point all the debugging options are greyed out and the only possible option is the STOP button in red. The only fix I have found to this is by inserting a dummy instruction like a NOP or a simple value assignation, this will allow me to single step the loop and watch the counter values. Attached you will find the empty for loop and the for loop with one instruction inside. During all these tests the optimization was set to Level 0.
Empty FOR loop
#include <stdint.h> #include "tm4c123gh6pm.h" int main(void){ uint32_t i,k; SYSCTL_RCGCGPIO_R |= SYSCTL_RCGCGPIO_R5; while( (SYSCTL_PRGPIO_R & SYSCTL_PRGPIO_R5)==0) { } GPIO_PORTF_DIR_R |= 0x02; GPIO_PORTF_DR8R_R |=0x02; GPIO_PORTF_DEN_R |=0x02; while(1){ GPIO_PORTF_DATA_R ^=0x02; for(i=0;i<=800000;i++) {} } }
FOR loop with one instruction
#include <stdint.h> #include "tm4c123gh6pm.h" int main(void){ uint32_t i,k; SYSCTL_RCGCGPIO_R |= SYSCTL_RCGCGPIO_R5; while( (SYSCTL_PRGPIO_R & SYSCTL_PRGPIO_R5)==0) {} GPIO_PORTF_DIR_R |= 0x02; GPIO_PORTF_DR8R_R |=0x02; GPIO_PORTF_DEN_R |=0x02; while(1){ GPIO_PORTF_DATA_R ^=0x02; for(i=0;i<=800000;i++){ k=0; } } }
In the forum I have came around a similar problem but I can not figure out what was the solution to that case, here is the link to that post (https://community.arm.com/developer/tools-software/graphics/f/discussions/7548/arguably-missed-optimization-empty-loop-causes-rendering-to-miss-deadline).
We would like to work with Keil4.74 due to some compatibility issues with DLL's that have already been implemented and tested for this version of Keil. We haven't test however if the problem still occurs in Keil5.
Thank you very much.
David