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

A question about in circuit debugging

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



Joined: 31 May 2009
Posts: 79

View user's profile Send private message

A question about in circuit debugging
PostPosted: Tue Jul 27, 2010 4:41 am     Reply with quote

How can I use ICD(in circuit debugging) without special hardware at CCS-C?(via RS232 serial communication)(like pic basic pro)
theasus



Joined: 31 May 2009
Posts: 79

View user's profile Send private message

PostPosted: Wed Jul 28, 2010 1:05 am     Reply with quote

Don't you have any suggestion?
Ttelmah



Joined: 11 Mar 2010
Posts: 19346

View user's profile Send private message

PostPosted: Wed Jul 28, 2010 3:08 am     Reply with quote

The simple answer, is 'no'.
It is important to understand the big difference between a Basic, and C in this regard. In Basic, you are running an interpretive language. The chip is programmed with the interpreter, not your program, and then your program is added, as a sequence of numbers stored in either an EEPROM, or a reserved area of the main chip's memory. When you 'run' a Basic program, it is the interpreter that 'runs', stepping through the sequence of commands you have stored. It is relatively easy to add a 'debugger' type output/input to this, which usually slows execution a little, but as each instruction is loaded, can send a 'this is what I am doing' message out of the serial port, or receive a command to change a variable. Downside to this approach is speed. Loss is not too great when doing something like complex arithmetic, since the time overhead of the interpreter is then only a few instructions on a bit of code running to thousands of instructions, but if doing something like a simple 'loop', the loss is enormous...
C, generates code that directly runs on the chip. There is therefore no interpreter sitting there running, to send or receive RS232 messages.
You then have two choices:
1) You can generate debug _output_, by adding debug printf statements to your code.
2) Or you debug the chip using a hardware debug connection. This still has some overhead, adding a small extra section of code at the top of memory, and using internal hardware features to call this when required. This can't be done by simple RS232, without the extra hardware though...

Best Wishes
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Jul 28, 2010 5:45 am     Reply with quote

Some uC manufacturers or tool vendors are providing debug support similar to the ICD "hardware debug" connection through a standard UART. This is done e.g. for the Renessas M16 family. As one obvious prerequisite, debug instructions, e.g. for hardware breakpoints or single stepping must be included in the general instruction set, so they can be utilized by a debug monitor.

As far as I see, the nature of the Microchip debug support is partially undocumented, please correct me, if I'm wrong. I don't know, if the respective debug resources are hardwired to ICD or could be possibly accessed by a custom debug monitor.

In any case, it would be difficult for any alternative difficult to compete with the MPLAB debug support, I think.
lokken



Joined: 21 Feb 2010
Posts: 17

View user's profile Send private message

PostPosted: Sat Jul 31, 2010 5:02 am     Reply with quote

Why does CCSC add this function as a software like other compiler?? Actually I couldn't understand If other compiler can do this operation. Why doesn't CCSC do it?????
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jul 31, 2010 5:30 am     Reply with quote

As to why CCSC doesn't have this 'ICD' feature or option, it probably amounts to time, money and resources. Creating ANY product requires a LOT of R&D time which of course costs money (wages) and materials (test equipment, chips, etc.). The bottom line is the bottom line. They may have looked at it and decided it would not be a good investment.
Now if you want to design, develop and test an 'ICD code module' that can be added as an option at build/compile time, I'm sure CCSC might be interested.
Personally I've never used the ICD. Being 'old school', I tend to 'program on paper', read the databooks, flowchart, etc. before I cut code. Flash devices are nice as they allow fast 'reprogram-try again' cycles. Papertape was another story!
Today's tools (simulators, IDEs, ICDs, etc) allow anyone to design, test and manufacture a product without using a soldering iron! What would have cost $100,000 just 15 years ago can be done on ONE PC ! A few button presses and you can have your finished board delivered in less than a week. To me, that takes the 'fun' ( and education) out of it.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Jul 31, 2010 8:41 am     Reply with quote

jbmiller wrote:

Today's tools(simulators,IDEs,ICDs,etc) allow anyone to design,test and manufacture a product without using a soldering iron! What would have cost $100,000 just 15 years ago can be done on ONE PC ! A few button presses and you can have your finished board delivered in less than a week. To me, that takes the 'fun' ( and education) out of it.


And they're cheap...

I have ICD2's and an ICD3. They've been fabulous... Most of the time, I'm using the debugger to figure out what broke in a library or compiler...

and sometimes I need to step through some of my more complex code.

For what they cost (The ICD's), they are well worth it.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
lokken



Joined: 21 Feb 2010
Posts: 17

View user's profile Send private message

PostPosted: Sat Jul 31, 2010 9:04 am     Reply with quote

bkamen wrote:
jbmiller wrote:

Today's tools(simulators,IDEs,ICDs,etc) allow anyone to design,test and manufacture a product without using a soldering iron! What would have cost $100,000 just 15 years ago can be done on ONE PC ! A few button presses and you can have your finished board delivered in less than a week. To me, that takes the 'fun' ( and education) out of it.


And they're cheap...

I have ICD2's and an ICD3. They've been fabulous... Most of the time, I'm using the debugger to figure out what broke in a library or compiler...

and sometimes I need to step through some of my more complex code.

For what they cost (The ICD's), they are well worth it.

-Ben


Why should I have this module? Why don't my compiler supply this property just like other program? (Of course not with special hardware. I know CCSC sell this module but I want to use this properties via serial port not special module. I think this is CCSC's work.)
Ttelmah



Joined: 11 Mar 2010
Posts: 19346

View user's profile Send private message

PostPosted: Sat Jul 31, 2010 9:21 am     Reply with quote

If you add serial port hardware to allow direct connection to a chip, into the chip die, this is unwanted cost on every chip. Not a good idea. You have to remember that a serial port, needs good ICD protection, if it is not to die in many environments, and the serial port itself is not present on most modern computers. Making this 'wasted space'. The 'best' system at present, in terms of the cost in the processor, and useability, is a simple USB 'dongle' connecting directly to a limited number of pins on the chip. Guess what .... this is what is available in the latest ICD modules.
Older debuggers have got serial interfaces.
You need to remember that debugging, is a feature only used in perhaps one in ten thousand chips (the initial prototypes). Far better to put the hardware in a module that is bought 'once' for the debugging process, than to put it into the chip.
The CCS ICD-S40, is a serial debugger module.
You also have to remember that CCS have nothing to do with the chip. The chip is a Microchip product.

Best Wishes
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Jul 31, 2010 11:16 am     Reply with quote

lokken wrote:

Why should I have this module? Why don't my compiler supply this property just like other program? (Of course not with special hardware. I know CCSC sell this module but I want to use this properties via serial port not special module. I think this is CCSC's work.)



Well, no. In addition to what TTelmah says, let me add:


Microchip HAS put some neat debugging features into most PIC's that with a little firmware (only needed when debugging), something like an ICD can more easily control the CPU. Something that wasn't always available at such a lot cost. (as others have mentioned).

Now ask yourself this:

You have a PIC with 2K of PROM and 1 UART... you need the UART to hook up to something else... but you also want to use the UART for debugging.. Now what? Mux the task?

There's an easier way. Make the MCU run in some debug mode and communicate back with the debugger through something else than the UART.

This is exactly what PIC's do and it works quite well.

Now I've freed up my UART to do what I wanted it to do... the debugger is only needed for development time (no extra component cost for production runs) and the single debugger tool.

CCS does have a debugger just as does Microchip. But remember Microchip makes the PIC, not CCS. So CCS must conform to the standards put forth by Microchip.

Blaming CCS for a bad debugger or for not making tools you don't like isn't CCS's fault. Go talk to Microchip. Make sure you're ready to tell them how they should do it instead.

-Ben

p.s. some of the newer high-end PIC's (like the newer PIC32's) actually do have a debug "COMM" channel back through the ICD. It's pretty cool and sounds a lot like what you'd want (you printf back through the debug channel just like any other UART and view the output in a little terminal window in MPLAB). However, this functionality is only (that I know of) available through MPLAB via an ICD using C32 (Microchip's GCC based PIC32 compiler).
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
theasus



Joined: 31 May 2009
Posts: 79

View user's profile Send private message

PostPosted: Sat Jul 31, 2010 11:39 am     Reply with quote

I think as lokken said CCSC should add this application to their program because it is very useful properties for developer. It isn't related with Microchip as shown below. (From a basic compiler)(no external devices needs for basic compiler in this operation)


Finally your simple answer 'NO' is not enough for customer....If one company can do this, another company should do this useful operation for customer.....
dyeatman



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

View user's profile Send private message

PostPosted: Sat Jul 31, 2010 3:07 pm     Reply with quote

Theasus,
You are aware that you are NOT talking to CCS in this forum right?
Whether we agree or disagree we are powerless to do anything about it...
If you have a beef with them about what they sell then send them an email
(support@ccsinfo.com) rather than getting upset with us for stating facts.
If you don't like the PIC programming setup then tell Microchip...
_________________
Google and Forum Search are some of your best tools!!!!
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Jul 31, 2010 6:08 pm     Reply with quote

I think I'm going to gracefully discontinue monitoring this topic before what I really want to say escapes my fingers.

(shaking head)

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Ttelmah



Joined: 11 Mar 2010
Posts: 19346

View user's profile Send private message

PostPosted: Sun Aug 01, 2010 1:31 am     Reply with quote

I presume the original poster, is aware, that with a compatible ICD module, the windows versions of CCSC, can step through the code in the debugger?.

Best Wishes
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