Wednesday, April 23, 2008

Odyssey of a JTAG less debug!

Kinda perked by Dirk's interest in getting a simple blinking led working on beagle over usb/uart, i started off with bare minimum code.. but then, when u download an image and expect it to boot, and it does not, there are millions of places it can go wrong.. It was interesting to think back to the days when I wrote the first lines of sdp2430 u-boot port.. It used to be on Virtio then.. But, having faced similar issues while working in a certain module in CSST, I knew it was not something I would want to do every day - a good challenge though.

The fav trick of mine is to use hang code. usually on SDP, I'd add code to show something on 2 line char LCD.. but the entire idea was to get LED glowing.. getting thru the initial points of setting CPSR was standard omap boot process.. WDT was also easy to think out on.. the ones that did stump me were:
a) LED lines shorted on the board for me: I tried GPIO5 out bits 19->22 and i kept seeing the LED glow for 21 and 22 -> bad part -> both leds were glowing together.. at 1 in the morning no one to shout to.. though the answer was obvious.. i was suspecting strh or str issues in the assembly i wrote.. or mebbe i was not understanding GPIO module well enough or even possibly pulling the pin mux the wrong way.. schematics i did doubt.. but from experience, usually h/w guys dont mess things up as much as I(S/w guy) do. Long story short: i was stumped till GColey explained... JTAG would have allowed me to set the bit in the register and figure it out in a jiffy!!!

b) Timing.. with a while(count--); equivalent code, there was no way i can keep it predictable, so i had written code for using sync32.. only i messed up CMP+BLT,BHT instructions' register sequences.. in short my code never got thru.. for a time I was thinking mebbe i did miss the interface clock to func32 clk.. bah!!! had to give up on this and did dig a xds-560+CCS to look at the assembly code flow instead of spending another 3 hrs on thinking it through... Total time taken = 1 hr or so.

Complete thread of this odyssey is here. You can even find the integrated code in the thread here

I cant use XDS and CCS to debug u-boot or anything.. but nice to go thru plain assembly and touch registers than play around with head in a bucket.. I love JTAG debuging.. probably though I'd even settle for gdb hooks at the earliest possible moment..flyswatter is also a nice idea - if it works on Cortex-A8, I might even buy one for use at home..

No comments: