At 16:15 04-04-08 +0000, Grant Edwards wrote: >On 2008-04-04, N. Coesel <[email protected]> wrote: > >> If you write you code portable, you can use and CPU you want. >> Besides, debugging on an embedded device is not the fastest >> way to debug. Just write for Windows/Linux first and then port >> your code to the embedded device. > >That only works for code that's not real-time and doesn't use >any of the peripherals -- and that's never where the problems >are.
You can't set breakpoints in real-time code and interrupt routines without disturbing the process. So the use of JTAG debugging is very limited. I use counters to monitor real-time processes non intrusively. The counters come in handy in the production device as well. I usually implement a command that shows how many bytes and interrupts where processed by a UART. Saving the stack pointer every timer interrupt in a special place tells me exactly where code got stuck (and tripped the watch-dog). The interface for the pheripherals is usually a really thin layer so the upper layers can be tested in a test environment which also allows for testing limits the hardware may never reach. Nico Coesel
