CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Using "step over" in MPLAB sim with CCS compiler

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jeremiah



Joined: 20 Jul 2010
Posts: 1322

View user's profile Send private message

Using "step over" in MPLAB sim with CCS compiler
PostPosted: Fri Jan 21, 2011 1:53 pm     Reply with quote

So I have run into an interesting problem that I have yet to find any info on, though I am still going through google results.

On some of my programs, when I hit the Step Over button, it runs all the code from that point until the end of the program. I am used to the step over button simply moving to the next line rather than going into a function or something. And indeed the button does function like this until a certain point (usually delay_ms() or printf()).

I was hoping someone with more mplab sim experience might have seen this and can give me a couple of tips.

My ccs compiler is 4.114 and I am using the lastest MPLAB ide. I am just quickly fishing to see if this is a known issue with a work around or possible just me setting up mplab sim incorrectly.

any thoughts?

Thanks!
Code:

//Include file that comes with the compiler
#include <24FJ64GA004.h>

//16 bit pointers
#device *=16
#device ADC=10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOJTAG                   //JTAG disabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES ICSP1                    //ICD uses PGC1/PGD1 pins
#FUSES NOIOL1WAY                //Allows multiple reconfigurations of peripheral pins
#FUSES WINDIS                   //Watch Dog Timer in non-Window mode
#FUSES WDT128                   //Watch Dog Timer PreScalar 1:128
#FUSES WPOSTS16                 //Watch Dog Timer PostScalar 1:32768
#FUSES NOIESO                     //Internal External Switch Over mode enabled
#FUSES PR                     //Pimary oscillaotr enabled
#FUSES NOCKSFSM                 //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES NOOSCIO                  //OSC2 is clock output
#FUSES HS
#FUSES I2C1SELD   

//Pin Selects for remappable pins
#pin_select U1TX = PIN_C1  //C1  //C7
#pin_select U1RX = PIN_B3  //B3  //C6

// #use statements for delays, rs232, and i2c
#use delay(clock=22118400)
#use rs232(UART1,baud=9600,parity=N,bits=8,DISABLE_INTS)


///////////////////////////////////////////////////////////////////////////////
//  NAME:  main()
//  DESC:  This is the main entry for the program.  The PIC is setup and then
//         set to sleep.
//  IN:    NONE -- only globals are used
//  OUT:   NONE
///////////////////////////////////////////////////////////////////////////////
void main()


   
   //This line serves no function other than to remove an annoying warning.
   rs232_errors = 0; 
   
   //Turn off SPI, ADC, and unneccessary timers
   SPI1STAT = 0;
   SPI1_EN = 0;
   SPI2STAT = 0;
   SPI2_EN = 0;
   setup_wdt(WDT_OFF);
   setup_timer2(TMR_DISABLED);
   setup_timer3(TMR_DISABLED);
   setup_timer4(TMR_DISABLED);
   setup_timer5(TMR_DISABLED);
   //setup_adc(ADC_OFF);
   setup_vref(VREF_DISABLED);
   
   //ADC
   setup_adc_ports(sAN11 | sAN12,VSS_VDD);
   setup_adc(ADC_CLOCK_INTERNAL);
   
   //Turn off I2C general call
   I2C1_GCEN = 0;
   
   //Turn on SOSC.  Must be done in ASM due to timing
   #asm
      MOV #0x742, W0          //Address of clock control
      MOV.B #0x46, W1         //Unlock sequence 1 for lower byte
      MOV.B #0x57, W2         //Unlock sequence 2 for lower byte
      MOV.B #0x02, W3         //Enable for secondary oscillator
      MOV.B W1,[W0]
      MOV.B W2,[W0]
      MOV.B W3,[W0]
   #endasm
   
   output_high(UART_VCC);
   
   delay_ms(50);   //breakpoint set here.  Using step  over jumps to very end

   printf("\r\n#######################START#######################\r\n");
     
   //go to sleep
   delay_ms(50);
   while (TRUE) {sleep();}

}
Ttelmah



Joined: 11 Mar 2010
Posts: 19333

View user's profile Send private message

PostPosted: Fri Jan 21, 2011 3:07 pm     Reply with quote

Step over, _executes_ the line, without stopping to display what it is doing in the code inside. If the function is simple, quick, but remember that the emulator runs perhaps 1/1000th the speed of the real chip, so if you step over a delay, for say 1/10th second, expect it to take several seconds. Things like printf, wait to see the required hardware signals (use the UART emulation, in the simulator, if you don't want these to hang). Step over, _does not_ 'skip' code.

Best Wishes
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Jan 21, 2011 4:20 pm     Reply with quote

I can confirm, that step over often doesn't stop at the next instruction for some reason, at least with PIC24 and SIM. I mean to remember, that it also happened with hardware debugging I'm not sure if it's an issue related to the CCS C *.cof file or a general MPLAB issue.

But I ignored the problem up to now and used breakpoints to re-catch the code flow.
dyeatman



Joined: 06 Sep 2003
Posts: 1923
Location: Norman, OK

View user's profile Send private message

PostPosted: Fri Jan 21, 2011 4:23 pm     Reply with quote

The problem happens with hardware debugging using the CCS IDE,
ICD-U64/4.114 and the 18F46K22. Just like FVM I also use the breakpoints
to "catch" the code flow.
_________________
Google and Forum Search are some of your best tools!!!!
miro



Joined: 15 Jan 2011
Posts: 62

View user's profile Send private message

Re: Using "step over" in MPLAB sim with CCS compil
PostPosted: Fri Jan 21, 2011 4:30 pm     Reply with quote

I am running 4.114 and MPLAB 8.56. When "stepping over" with SIM it steps line by line as expected till the first printf:
...
printf ("\n\r################# THIS IS THE START \r\n\n");
..
and then it runs towards the end of the source _without_ stopping at the next line. It could be stopped with Halt. So it seems to me it is a bug Crying or Very sad . Miro
jeremiah



Joined: 20 Jul 2010
Posts: 1322

View user's profile Send private message

PostPosted: Wed Jan 26, 2011 11:41 am     Reply with quote

Well that confirms to me that it is a bug. I don't suppose someone would be willing to fire it up into the most recent CCS compiler but in MPLAB and see if it does the same? I can't upgrade atm due to work policy. I would like to be able to fire up a ticket at microchip to see if they can look into it.

thanks all for the input.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group