Debugging: Am I a dreamer. . . ?

Are you objecting to the use of the C function printf() within a embedded environment for debugging or are you objecting to the use of serial port output as a debugging tool ?

In AVR land, I don't use printf as it's bloated (by embedded standards), but I do have my own interrupt based UART I/O routines that I use for normal communication with other serial devices as well as debugging.

The routines implement a tty for the hardware UART as well as a Tx-only software UART for debugging output. As both UART's are interrupt based, and the output can be optionally buffered in an application specified buffer, I see very little overhead in using the software UART for outputting debug information.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980's technology to a 21st century world
Reply to
Simon Clubley
Loading thread data ...

And it's been extinct for years (none of the processors I've used in the past decade have had bond out parts or real in-circuit-emulators available.

That's about as good as it gets these days.

--
Grant Edwards                   grante             Yow! My polyvinyl cowboy
                                  at               wallet was made in Hong
 Click to see the full signature
Reply to
Grant Edwards

Several of them: Theresa of Avila is most famous. Freud would have been interested in her case. But I looked on the other siide of your email, expecting some hot totty, and all it said was something in Russian ending with H sirhC.

JS

Reply to
sprocket

Then you are looking an a small market. Many parts still have ICE.

Not exactly that is about to change.

If you like a Second generation JTAG+ Trace that is closer to ICe functionality.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
 Click to see the full signature
Reply to
Chris H

I meant the Theresa I knew was more sinful :-))))

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
 Click to see the full signature
Reply to
Chris H

I said if you don't know about the basic tools you shouldn't be programming embedded systems. You do need to learn.

To many get a couple of MCU and a small tool set and stay on that for years. The rest of the world passes them by.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
 Click to see the full signature
Reply to
Chris H

Obviously, since I doubt it's possible for anybody to use a significant portion of the parts on the market.

Right, but it sure seems to be getting pretty rare.

At the last embedded systems conference I went to, a lot of vendors were flogging the JTAG-based trace stuff, and it sure would be nice. I've got a real-time state-machine problem I'm trying to fix right now and if I could get a timestamped trace of writes to a couple addresses, it probably would have been fixed a week ago. :/

But, none of the parts I've ever used supported anything other than the basic "halt the processor and examine the state" JTAG interfaces. Maybe I'm just not spending enough money on processors.

--
Grant Edwards                   grante             Yow! Everybody is going
                                  at               somewhere!!  It's probably
 Click to see the full signature
Reply to
Grant Edwards

Lot of it about.

You need an ICE :-) What is the MCU?

What is the processor. AFAIK there are Ice for PIC, and 51 up. It is the bigger parts that don't have ICE.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
 Click to see the full signature
Reply to
Chris H

I know. :)

Texas Instruments MSP430F2330

The parts I've used recently are ARM (Samsung), H8, AVR, and MSP430. All are plain JTAG except the H8 which I don't remember having any debugging support (except for a GDB stub that I ported to it).

I think there might be real ICE for some AVR parts, but I haven't spent much time on that one yet.

--
Grant Edwards                   grante             Yow! Should I get locked
                                  at               in the PRINCICAL'S
 Click to see the full signature
Reply to
Grant Edwards

Yes, there are Jtag Ice for some of the bigger AVR. There are cool when working; unfortunately, not always reliable.

Reply to
linnix

In which case, you are not going to get much argument from me when the embedded devices that we are talking about are at about the AVR level.

This is in an hobbyist environment, but yes the UART driver code is included as part of a finished project.

As for the debug code, it's added and removed as required during debugging, but I do find it useful to output high level statistical data on the debug port in some projects, which I can then look at if needed.

In that case, I still need to be able to output the statistical data without causing the rest of the code, including any I/O on the hardware UART, to stall, so I still need the current low overhead approach which works just fine for me.

Once again, no argument here about the extra ICE functionality, but I've not yet encountered a situation here where I _absolutely needed_ those extra capabilities, which given that I'm in an hobbyist environment is probably not a great surprise, especially when the time versus cost tradeoffs are different in that environment.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980's technology to a 21st century world
Reply to
Simon Clubley

Grant,

Full ICE is available for all the H8 (and almost all MCU) Renesas devices But, of course, it requires lots of money. Which makes the GDB stub (o JTAG) the best bet for on-chip debug on the cheap.

--CG

Reply to
vinnie

I stand corrected. I guess I never needed it badly enough to track down ICE for the H8 (and spend the money). IIRC, the last ICE I bought was for the M16C, and the price tag on that was somewhere close to $10K. That project got cancelled before I even got the boxes unpacked...

--
Grant Edwards                   grante             Yow!  Yow! Are we in the
                                  at               perfect mood?
 Click to see the full signature
Reply to
Grant Edwards

I've worked on a arm7 design with etm, don't know if it ever got build. coprocessor 14 is a communication register you can read and write via jtag without halting the processor.

with lots of embedded stuff not halting the processor can be a very important feature, with comms that need to keep syncronization or hardware run in closed loop it is often impossible to halt the processor without breaking something....

-Lasse

Reply to
langwadt

It called the PIC16F684. Just get the ICD2 $169 USD or an emulator for $2000 If you need a printf the PICs do have a serial port. printf is kind of big so that that into account

Reply to
Neil

The ICE 2000 does not require you to loose any pins. The ICD2 uses the same 3 to 4 pins as the programmer.

Reply to
Neil

One thing that often seems to get overlooked is assert(). It shouldn't be because it is really your friend. I've often seen people using things like "printf("Value of n is %d\n", n)" when all they are really worried about is that n always fulfils some condition, whether it be never going negative, or exceeding a certain value, or whatever. That is precisely where assert() is useful.

Having said this I have my own set of macros that I like to use for things like this, primarily for hosted stuff. They provide a slightly more comprehensive and robust framework for these kinds of diagnostic. ASAS_TAUT() is roughly equivalent to the standard assert() and ASAS_CONT() is the same only with an inverted trigger sense.

The nearest to a printf equivalent is ASAS_DIAG(n, mesg) which is non-fatal and prints mesg (to stderr) if n >= ASAS_DBG. There is also ASAS_NOTREACHED() and a few other macros for particular situations. They all have functionality on a par with the standard assert() giving file and line number, but with a couple of extra refinements.

Firstly the inclusion sense if the opposite to assert() in that they expand to nothing unless ASAS_DBG is defined - in my book assert() does this the wrong way around. Also one particularly neat trick is the trigger behaviour. On x86 at least they don't call _exit() or some other nonsense, they do an asm("int3"). In a debugger they function as handy built in breakpoints that are waiting to be triggered when needed.

--
Andrew Smallshaw
andrews@sdf.lonestar.org
Reply to
Andrew Smallshaw

You can often use a bigger version of the same chip with extra ports.

Reply to
cbarn24050

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.