|
![]() Development Tools
![]() returning to the debugger
|
| next newest topic | next oldest topic |
| Author | Topic: returning to the debugger |
|
bpark1000 New Member |
I am using the C8051F310 with Keil tools (assembler). In the debugger there is no way explained to return to the debugger at the end of a program (for example, I want to write a code segment that calculates, and then return to the debugger to look at the results). I am forced to single-step my way through. Is there a vector I can jump to to return? Can I write a routine that starts up a periodic interrupt, and then returns to the debugger so I can monitor the interrupt routine in real time? IP: Logged |
|
erikm Member |
(assembler). here: nop jmp here set a breakpoint on the nop Erik IP: Logged |
|
bpark1000 New Member |
I tried that. The program stops all right at the breakpoint, but the interrupts are stopped! (I don't know if the timers are stopped, the interrupts, or both). If I resume at the NOP and allow the program to execute the ZOT: JMP ZOT, the interrupts start up. I want to have the debugger running while the interrupts are also running. (There is this thing the software engineers have about "freezing time" when the main returns. When that happens, I can't debug while the periodic interrupt is running. I'm forced into the antique method of stopping every time I want to change 1 byte of the input data, or look at the output data. I was hoping I would not have to totally re-engineer the development system, as I did for the 6808 and the 65816. Is the "freezing" of interrupts occur in the "2 wire interface" in the chip, (in that case I'm screwed) or can I hack it to allow running? IP: Logged |
|
erikm Member |
there are legio methods for things like this, but to help you you need to be waaaay more detailed/specific, NOT in what you want the emulator to do, BUT what you need to see. I want to write a code segment that calculates, and then return to the debugger to look at the results The program stops all right at the breakpoint, but the interrupts are stopped! (I don't know if the timers are stopped, the interrupts, or both). Is the "freezing" of interrupts occur in the "2 wire interface" in the chip, (in that case I'm screwed) or can I hack it to allow running? State what you want/need (NOT as "interrupts running while stopped at a breakpoint") and, most likely, one of the methods known to someone will work for you. Erik IP: Logged |
|
vanmierlo Member |
When the system is halted on a breakpoint or from the debugger the entire mcu stops including all timers. Only exception if I remember correctly: SPI master will run to completion. Unfortunately even the UART TX stops in mid-transmission. IP: Logged |
|
bpark1000 New Member |
What I want is exactly what I stated: to have a periodic interrupt running unmolested while the debugger is functional. Let me give you an example, I have a 6-legged robot (a Lynx kit) with 3 aircraft servos on each leg (18 total). Each servo is controlled with a PWM waveform at about 100Hz with the high time controlling the position (1 to 2 milli-seconds). Using a 6808 and the NoICE development system, I wrote an interrupt routine that is executed 100 times per second, and generated the PWM waveforms for all 18 servos. I tested this part of the routine by running it, and from the debugger, typed numbers into 18 memory locations, to test the leg movement. After I got this working, I added modules to do the trig calculations, and finally walking. To test the trig routines, I only needed to type numbers into the X, Y, Z fields, and watch the leg movement. With the Silicon Systems 8051F310 development system, I cannot do this. If the interrupt stops, the signals stop and the robot collapses! While it is running, I cannot enter values to test the routines. I am being tasked at work with building a system which analyzes vibrations with a digital filter. I need to be able to tune this filter while the signals are applied. (Included with the Lynx robot kit were 4 PIC processors, combined with a PC were required to get the robot to walk. I got 1 6808 8MHz processor to do all of that, with lots of pressing time left over.) The way my other 6808 debugger works, is that there a "kernel" that carries out the primitives of the debugger (running in the PC). The main is invoked by the debugger, and after it sets everything up, it returns to the debugger code. The interrupt is invoked from the timer. When an interrupt is running, the debugger kernel is running in the unused time slots between the interrupts, so it does everything it did before, only slower. Of course, I must not set a breakpoint that falls within the interrupt routine, or I crash. But I can single-step a main that is feeding data (by way of memory) to the interrupt routine, or I can type directly into memory, using the debugger memory edit. The interrupt routine is performing a "hardware function" (such as the PWM described, or a digital filter)that cannot be debugged unless it is running continuously at full speed. IP: Logged |
|
erikm Member |
I need to be able to tune this filter while the signals are applied. feed the values through the UART
IP: Logged |
|
worknhard9062 Member |
Your thought process seems to be stuck on the notion that "debugging" means stopping the program and looking at/ changing values. If what you need to do is examine and change data while the program is running, rather than halting everything, then expose the values through some user interface, like the UART as Erik suggested. What this means is that you need some additional interface software to expose the variables you want to examine. A simple communications protocol that allows a PC to poll the hardware for specific variables. It could be extended to allow writing to those values as well. An interface such as this for communicating critical data to and from a robot seems like a "really useful thing". Consider spending the time. You won't regret it. ------------------ IP: Logged |
|
bpark1000 New Member |
Yes, I can do that, by spending an inordinate amount of time to "build debugging tools". That's what I was hoping I had bought when I purchased the C8051F310 development system. Because of the imposed limitations, I am forced to use the "debugger" as a loader/launcher only, let the rest of its capabilities lie fallow, and write separate tools to do exactly what the debugger should be doing. The system configuration should allow removing these limitations to allow real-time code debugging. There needs to be more documentation on the "C2 interface". (I could find none on the internal hardware, only the interface, and how data are exchanged.) IP: Logged |
|
erikm Member |
What you want to do is NOT debugging, but "parameter shift effect checking" You do NOT have a bug, you are trying to find a value which has NOTHING to do with debugging. The system configuration should allow removing these limitations to allow real-time code debugging. Erik [This message has been edited by erikm (edited August 02, 2010).] IP: Logged |
|
bpark1000 New Member |
It is debugging. I have a left shift when I should have a right, or if i pick up the wrong element of an array, or if something overflows (when it shouldn't) that is a bug. One of the reasons it is so hard to find all the bugs, is that there are so many ways to screw up! Anything that speeds up the process, enabling me to test more possibilities in less time is better! Faster processors can be tested faster. Furthermore, it not more complicated to enable this feature. Somebody went to a lot of trouble to insert this limitation. IP: Logged |
|
erikm Member |
It is debugging. "running while changing values" is NOT debugging. Then you continue with a lot of examples that are debugging and do not require "running while changing values". It seems that you have locked yourself into a very nonstandard way of 'debugging' (note the quotes) and expecting the manufacturers to adapt to your way instead of the way of 99% of the population is not reasonable. Furthermore, it not more complicated to enable this feature. Somebody went to a lot of trouble to insert this limitation. Erik IP: Logged |
|
bpark1000 New Member |
Let me try to describe this another way. If I have hardware that is not working properly, I operate it, and feed in signals while monitoring with instruments. I do not stop the hardware to change an input (an example is adjusting the fuel/air mixture on a gasoline engine). While I could stop the engine, make an adjustment, then restart it, it would not be as efficient as keeping it running while adjusting. There are other reasons to do it this way. For example, the optimum mixture is a function of temperature, which rises differently when the engine is stopped repeatedly. Many modern processors are involved as a part of a system (such as a robot steering control, or part of a "software radio". Your argument for having a custom system for testing makes sense when you are building 1 million of them. The point I'm making is that a debugger without the running limitations can do that for many cases. Usually writing the test code is more elaborate than the code you are trying to write. Test equipment is made with the same philosophy: to be versatile, even if it means more expense and not as good for any one task. In 1980, custom software tools had to be written custom for every task. Then PCs came along. the easy "mass production" of software makes it inexpensive to buy development tools. the Windows operating system operates by multi-tasking the app with the operating system. many embedded controllers do the same. I would be interested if you represent Silicon labs or are a user of development systems, and what type of experience you have. If you are interested, I can show many systems which I have designed, eliminating a whole bunch of hardware with a single controller chip, and eliminating "cross-coupling effects" (such as a spurious lamp flikering on a lamp dimmer while signals are being sent to it). These systems were developed with simple DOS based tools. The tools did not have "arbitrary" limitations (and they also did not interfere with "conventional" debugging methods. I fear that the "limitations" are built into the "C2 interface" hardware (if not, I might write my own driver). My plan in the short term is to do what you say: use the parallel port, with a twist, a debugger called "NoICE" which converses with a small "kernel" in the 8051 which gets loaded by the Silicon Labs loader, and started with the "Go" command. Then I will debug with NoICE. IP: Logged |
|
erikm Member |
I would be interested if you represent Silicon labs I do not or are a user of development systems, and what type of experience you have. used them for 20+ years and, before the 'built-in debug' was often nicknamed the ICEman If you are interested, I can show many systems which I have designed, eliminating a whole bunch of hardware with a single controller chip, ONCE MORE: the patching values while running is NOT debugging, it is an optimization. Erik [This message has been edited by erikm (edited August 03, 2010).] IP: Logged |
|
worknhard9062 Member |
This discussion sounds like a debate of "this way" OR "that way" and seems poised to quickly become heated and polarized. If I may offer my perspective on this... bpark1000, Yes, you do not have to stop the engine to make an adjustment to the fuel/ air mixture but I don't agree that this example is applicable. Silabs C8051Fxxx do not. Hence my suggestion to roll your own interface via a comm channel. I don't buy the "I need to make a million of these for it to be worthwhile" argument either. I have never regretted taking the time to enable some form of user interface into my product designs regardless of the market demand/ projected sales quantities. The added value always paid for itself. You speak of designs you've worked on where the kind of interface you describe was made part of the product (non-flickering lamp dimmer). Reread what you wrote. You "designed" these things with that capability. The JTAG/ C2 interface into a '51 core is something fairly new to the 51 market and Silabs has done a good job with it. Historically one had to have an expensive ICE to enable breakpoints and expose internal states on demand. Even the ICE days didn't see the kind of non-intrusive on the fly access that you describe. That takes extra hardware which = $$$. Silabs designed the debug interface in such a way to enable many of the typical debug features commonly found on legacy equipment, namely breakpoints and internal register access read/ modify/ write. What we don't have is trace capability and more complex breakpoint triggers (Boolean logic). But somehow after 25 years of writing '51 code I've managed without. Probably due to those extra software interface routines I wrote. I just don't think leveling criticism at Silabs for design choices they made in the debug hardware interface is a productive effort. Neither do I think the design limitations are at all arbitrary, but that's just my opinion. Ahh, everything here is just my opinion and I don't want to start nor continue an argument. I would hope that comments on this forum can be classified as either useful or not. Nothing else. Ignore the ones that aren't. ------------------ IP: Logged |
|
erikm Member |
one addition to Steves excellent post: With an external ICE the opportunities for "fancy stuff" add cost to the hardware in the ICE (look at the price for the fancier ones). For SIlabs, however, whatever is inside the chip to allow emulation is an additional cost for each and every chip they make Thus I think that cudos to SIlabs are in order. Erik IP: Logged |
|
Tsuneo Member |
> as I did for the 6808 and the 65816. bpark1000 seems referring to debug monitor, like Keil MON51 or ISD51, whose code is integrated into the target source code, or FLASHed separately on the program ROM. Usually, debug monitor communicates with PC debugger application over serial line. Debug monitor regularly steals "CPU time" from the target application to communicate with PC debugger app. SiLabs MCU applies on-chip debug circuitry, which works as micro ICE. It is more recent technology than debug monitor. It has several benefits compared with debug monitor, but also some weakness, as discussed on this thread. He may be better to back to debug monitor for his purpose. Tsuneo IP: Logged |
|
erikm Member |
bpark1000 seems referring to debug monitor, like Keil MON51 or ISD51, if, indeed this is right, the comparison is apples and oranges. The only ralistic comparison to the SILabs is an ICE. just a note: a "debug monitor" is far more intrusive than an ICE. Erik IP: Logged |
|
bpark1000 New Member |
I want to clarify one point made by worknhard9062 in this thread concerning the lamp dimmer. I did not design or build a lamp dimmer, I bought an X10 dimmer. The lamp flickered every time I sent a code on the bus. This is an example of "trash code", poorly written. I define "poor code" as code that doesn't do what it should. All the lamps in the house flicker when the master sends out a command. The dimmer went in the can, and no more are going to be bought of that brand. If I were to design such a thing, I would run a periodic interrupt synced to a multiple of the line frequency, and generate the triac firing pulses. The only "error" would be the interrupt latency, which is a few microseconds at most, and independent of what is being received. Regarding "checking the rings of an engine while it is running", you don't do that because the laws of physics. If this limitation were "not necessary", it would certainly be better to be able to do it without a teardown. Regarding the adjustment of the mixture, it is adjustable because the engine maker would have to go to extra trouble (put in interlock, etc.) to prevent such an adjustment. Regarding the "expense" of providing the functionality I desire, extra circuitry had to be put in to cause the limitations (the clocks to the IRQ, timers, etc needed to be gated off). You are correct in stating that some manufacturers do not do this. IP: Logged |
|
picperson Member |
You want more C2 documentation? Have a look at:- AN117 http://www.silabs.com/Support Documents/TechnicalDocs/an117.pdf AN124 http://www.silabs.com/Support Documents/TechnicalDocs/an124.pdf AN127 http://www.silabs.com/Support Documents/TechnicalDocs/an127.pdf C2 spec http://www.silabs.com/Support Documents/TechnicalDocs/C2spec.pdf Mike IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
Have you seen our MCU Knowledge Base?