Open Letter to Chip Gracey
Lord Steve
Posts: 206
Dear Chip,
Could the Prop 2 please have hardware debug support?
All the best,
Steve
·
Could the Prop 2 please have hardware debug support?
All the best,
Steve
·
Comments
This would complicate the cogs somewhat. Even if we added minimal breakpoint hardware, there would still need to be some code executed within the cog to handle the higher-level breakpoint management. Maybe a shadow ROM debugger, plus some extra RAM·would be required for this to work adequately with a full-sized cog application. We put some of this stuff into the SX chip, and I'm sure once the features were documented, people started (ab)using the debugging circuitry, like the 8-byte FIFO, for their own applications, as it IS useful. In doing so, though, they forfeited·the debugging functionality. Basically, every documented resource is going to be used by application programmers, and this can undermine intended purposes of special debugging circuitry. Rather than add a real-time trace buffer to each cog, why not just give everyone more application memory? This is·the sort of dilemma we face.
I think I know what you want, though: Single-stepping, breakpoints, break on register contents, etc. A nice PC-side debugger with animated windows showing what's happening inside a cog would be ideal. Certainly, it would be a great learning tool. After that, it might become more trouble than it's worth. What I think works great is to set up application-specific mechanisms that toggle a pin or·write to a memory location. This can be a single PASM instruction which is fast and small.·A general-purpose debugger is a lot more complicated and must attempt to be a one-size-fits-all solution to what is usually an evolving time/memory-constrained problem.
Here is something that somebody could design today that could serve learning AND debugging·purposes adequately well:
Use a Propeller chip as an in-circuit dummy, while performing cog- or even chip-level simulation within the PC, while talking at 3Mpbs over the USB/serial link. Some cogs could run real applications at full speed, while others·can be simulated on the·PC, with their I/O updates coming over the USB/serial link. With the ROM code·now available, you could simulate everything, from the whole chip down to a single cog running Spin.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
I know it's work and I understand the engineering-driven approach with the Propeller (and I like it), but I see this as a cheap-in-terms-of-silicon thing and it would more quickly open the door up to a wider audience for your baby.· Maybe I'm way wrong (I've never designed a chip before) but I feel 2·pennies lighter!· [noparse]:D[/noparse]
Correct me if I'm way off on the silicon footprint issue.
--Steve
·
-- note: i do not make use of the services of "hackers", that was a joke.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
E3 = Thought
http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
1) I was wondering if ImageCraft is publicly traded?
Note:
http://money.cnn.com/2007/05/22/news/companies/pluggedin_birger_radioshack.fortune/index.htm, just as I predicted.
If ImageCraft isn't public, this could be a magic moment for you.
2) Somewhere down the road I fully expect to see a web-based debugger for the PropII... one that doesn't require any extra memory, is probably free (supported by advertising space) and is so slick it practically writes the code and designs the circuits for you[noparse]:)[/noparse]... that's another prediction[noparse]:)[/noparse]
Sorry for the interruption.
The answer is you have provided hooks for it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
No code would need to run in-cog.· Just a state machine to drive out a few scant different types of "packets" to the host.· The cost per-cog is small (in my mind).
I would really like to see this feature.· I use the ARM9 debugger at work almost daily and the usefulness of such capabilities increases as the complexity of the debugee (software + hardware).· Let's look beyond education to real-life usefulness.
Thanks for reading.
--Steve
·
Fabulous wealth is only provided to those who can serve a huge market. Of course big headaches will happen that will require the company to grow (Rocklin won't object). Something far better than the current model of "open sores support" would be required. Such are the choices we make. I expect Parallax has found their comfortable middle ground.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley
Traffic is slow at times, but Parallax orders·always get here fast 8)
The problem with debuggers is that you get so distracted by breakpoints, single-stepping, watch variables, and the like that it's easy to become a slave to their magic and to lose sight of the larger picture. They really do turn into a crutch after a while. For a time, I too was mesmerized by the debug feature of the SX Key. But the more I programmed the SX, the more it just got in the way. Eventually I quit using the debugger altogether and haven't looked back.
By not including hardware debug in the Propeller, I think Chip is doing us all a favor.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley
Traffic is slow at times, but Parallax orders·always get here fast 8)
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
SelmaWare Solutions - StampPlot GUI for controllers, XBee and Propeller Application Boards
Southern Illinois University Carbondale, Electronic Systems Technologies
American Technical Educator's Assoc. Conference·- April, Biloxi, MS. -- PROPELLER WORKSHOP!
One reason (out of 3 biggies) that large networking concerns with 20+ year old product implementation basis have so much India out sourcing is because new grads today are not designed to maintain old or non-mainstream Smile [noparse]:)[/noparse] because of lack of evolution (i don't blame anyone for this except managments too cheap to reinvest R&D dollars in a sustainable way as no one wants to maintain old Smile) There are literally millions of Indian engineers that you can hire and burn out on your old Smile and replace fairly easily. It's expensive and frustrating for many people in the industry to deal with such issues. Good judgment and understanding the legacy being built however helps to reduce problems and increase ROI.
The easier it is to use a design and maintain because of features implemented, the better; otherwise, you end up creating a place for yourself like a bad bathroom with a broken flusher, and when you're forced sell because you can't stand it anymore and you're lucky enough to have at least an attractive idea implemented, make sure you have a good lawyer to draw up your "closet skeleton warranty" so you don't end up on the other end of the big flush when it finally happens.
Serious products like Cavium's 16 core 800+ MHz Octeon Mips64 processor have ALL features that allows securing market share (that's THE reason Cavium is public and it's founders and principal employees are wealthy). However, it is unfair to compare Prop to Octeon because of function and target market which generally requires MSCS engineers. Seems those without such credentials, training, and proven experience would be better served better with ease of use more than OEM idealogical penny pinching.
Hardware emulators are useful for bringup. Interrupts could also be useful on propeller for asynchronous events, but not having interrupts is not a big loss unless you want use one to bring the device out of low power mode like the SX.
Prop has nice features, and the "promise" of more memory and cogs make staying with it attractive, but there are glaring ommissions such as little debug support and lack of register indirect data read/write asm instructions.
For the price and reasonable performance I'm still a fan. Whatever bigger Propeller Parallax can produce in a reasonable market window (which may close at any time) I will happily explore and may use on smaller projects where there is cost advantage and little maintenance requirement.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley
Traffic is slow at times, but Parallax orders·always get here fast 8)
The Propeller is an awesome MCU. Learning it and using it has been easy (for me). A debugger can help with learning, but so can a blinking LED and a serial link with messages. I recommend slowly building your code, piece by piece and testing as you go along. The Propeller architecture lends itself to building code piece by piece because the code is easily broken across cogs/objects. This process of building piece by piece is not always easy in other MCUs (I am sure that could be debated though).
Perhaps what we the community needs to create is a document (or add to the Propeller wiki) techniques for troubleshooting and debugging with the propeller. The document starts off with general tips on writing clean code, building piece by piece, narrowing down and isolating problems, etc. Then, the document expands on ways to test such as how to insert a minimal amount of code to check for a status of a variable or a pin. Perhaps the document moves on further to discuss debugging serial connections with an O-scope or with a PC. Then at the end the document helps to develop an object that runs in its own cog that communicates with a PC and dumps data to it. The other program/cogs then give data, variables, pins that it should be watching. (Doesn’t something like this Propeller monitoring exist already?)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter
www.brilldea.com·- check out the uOLED-IOC, an I/O expansion for the uOLED-96-PROP
www.tdswieter.com
One little spark of imagination is all it takes for an idea to explode
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 3/14/2008 6:25:41 PM GMT
· I agree 100%. What did people do before calculators ?
· I guess there was no such thing as math before calculators. Or maybe there was but nothing really important could have been done without them.
· I find it funny that mathematicians used to be called "computers" because they computed tables and stuff.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·
It was also easy to buy a house near Rocklin for ~$600K in the last few years. Hope none of you got hurt.
Lemmings are a curious bunch.
I've made my case as a 20 year industry veteran; you can hide your pain when it comes. I'll say no more.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley
Traffic is slow at times, but Parallax orders·always get here fast 8)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 3/14/2008 8:02:31 PM GMT
Sure, I learned math long-hand, then with a slide-rule and now with a calculator. I don't use the calculator because I'm incapable of doing it otherwise, it's not a crutch for my inabilities, it's the easiest and best tool to use for the job.
To discount something because it may have a bad aspect to it is to ignore what good it has. Debuggers can be a means to an end which is far less painful than the alternative and that's their merit. If someone wants to debug their code with a flashing LED that's fine by me, but I'd prefer to have something which helps me find the bug without all the pain it otherwise involves.
I've noticed that everyone seems to have ignored Chip's suggestion, why is a debugger any more powerful than his suggestion?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 3/14/2008 7:59:57 PM GMT
I should state instead that "Humans are a curious bunch." [noparse]:)[/noparse]
Cheers.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley
Traffic is slow at times, but Parallax orders·always get here fast 8)
[noparse]:)[/noparse]
I'd be quite happy with what Chip suggests; seems to be pretty much like an ICE to me, providing it can run full-speed and is non-intrusive, ie that the debugging mechanism doesn't interfere with the program being debugged itself and works.
Unfortunately we don't have that, it'd be great if we did.
The other alternative of flashing LED's, writing registers to memory locations works to an extent (I use those methods ), but it doesn't work well in all cases. Endlessly editing code, moving the hub writes around, downloading, checking what works and doesn't soon gets frustrating, when one finds where it's going wrong one still has to then find why it went wrong.
Debugging the Spin interpreter I wrote took hours to resolve some esoteric bugs with stack manipulation which would have been simple with a mechanism to step through the code and see what was happening. I've tried to use PASD and GEAR but it just didn't work for me.
I don't know exactly what debugging mechanisms are needed for the Propeller, but there has to be something better than what we have now.
I understand Chip and Paul's comments as follows: Parallax had to decide whether they should add debugging circuitry to the Prop or not. Besides technical feasibility, which seemed quite uncertain, there is also a commercial aspect. Adding debugging features must allow them to sell that many more Props so that the additional cost of developing them is covered. They seem to have come to the conclusion that the cost of implementing the debugging features is very high, and that the return would be low. Additionally, some already very useful debugging features can be implemented in software, at no additional cost.
IMHO, the decision is quite a simple one.
-- Remy
The propeller has the advantage of serial programming which means you always have a line of communication out of the chip which is very handy too, the fact that every chip has 8 processors is also a massive advantage, you can have fast core code running along side slow display code.
When it comes to anything real time where the prop interacts with other circuits or the physical world then stepping through has much less merit and you are back to flashing leds or sending pulses to a scope. So for me I would rather keep the chip real estate for RAM etc.
I don't think that Paul or Phil or even Chip are trying to put down debuggers or their users but rather say that they are not "all that". Sure if they exist a use can be found for them but there are advantages in not using them EVEN if it takes a little longer to find the bug. Sometimes working out a way in which to trap and reveal the bug is actually how you discover the bug in my experience.
hippy, what was it about PASD and GEAR that didn't work for you? I've not used them myself.
Cheers,
Graham
It isn't setup for LMM where code may be in Hub and it also didn't support "long value[noparse][[/noparse] count ]" which I was using within the Cog. The way it does break-point setting and the way I was doing LMM / self-modifying code was also in conflict somehow so during single stepping the debugger would simply 'disappear'.
I suspect, but never investigated, that there are problems executing 'jmp reg', and should 'reg' happen to point to somewhere it shouldn't, everything rapidly goes tits-up, PASD losing synch with what the Cog is actually doing. Similar with other self-modifying code.
Having forked my code off to a version which could potentially work with PASD ( hoping those changes did not obscure the bugs I was trying to track down ) it simply didn't work.
For GEAR I have even less recollection of what didn't work there.
This isn't to simply criticise either PASD or GEAR because I had a quite complex piece of code in the way it worked, and I cannot say how well they work with simpler code because I am also someone who doesn't believe in relying on debuggers and only use them when I need to.
The 'flaw' with PASD is that it is by necessity intrusive, needing to write breakpoints over code and unable to break on code which is self-modified. The idea is sound, it's standard background debugging fare, but what's really needed IMO is the hardware support which can make PASD work regardless of what the user's code is.
I've used the 'write breakpoints over code' method of debugging myself on other processors and this can work fine when there is no self-modifying code, but unfortunately the Propeller has self-modifying code as its backbone and self-modifying code cannot always be avoided. This can make such a debugging technique less useful and sometimes not useful at all. I'm really just asking Parallax to please provide some help to get round the problems their architecture poses.
The biggest problem is that a breakpoint on any self-modifying code has to currently be in the form 'call #label', thus a MOV, MOVI, MOVD, MOVS, CALL or JMPRET can corrupt that breakpoint. If only the opcode bits were used to indicate a breakpoint only MOVI and a MOV to set an entire instruction would remain problematic, those are likely only used in a minority of code, and single stepping should be able to see the overwrite coming and fix the situation up afterwards.
What this would then require is a specific opcode to be allocated as 'breakpoint'.
The most obvious interpretation of 'breakpoint' to me would be 'jmpret $000,#$000' which should be easy to implement in silicon. Using 'jmpret $1EF,#$1F0' would be preferable to me, after a 'jmp #breakpointhandler' has been written to $1F0.
Everything else necessary for actual debugging would be in software as with PASD.