Monday, April 18, 2011

It's Moanday... Ugh.

Today started with being woken up WAY too early by the stupid cat, followed by not being able to get back to sleep, and feeling rather unwell for the next several hours. Finally was able to get myself together & out the door. Then followed a >$500 car repair payment (following an extended wait in line at the overworked mechanic's shop to pay for it & pick up my car). Finally, on the way to work from the shop my car started overheating, and so I had to stop & check the oil (which was not low), and then I had to turn off the A/C for the rest of the trip (which seemed to work around the problem, for now). Stereotypical Monday!

When I got in, I checked out the status of the XP machine, which Ray said was still stuck on update 26, which is where I think it was when I left on Friday. Apparently IE8 had a dialog open and was insisting on getting a definite answer to a stupid "want to participate in sending extra data to Microsoft" question before it finished installing itself. Got past that and the remainder of the 90-something updates are now installing. Hey Microsoft, how about making your software engineers use sound coding practices, so they don't create so many holes in the first place? Then maybe you wouldn't need quite as many "critical security updates."

As you can tell, I am in a rather foul mood today. Not unusual for the day after the kids go home, I suppose. On these days particularly, I despise my sociopathic ex-wife for manipulating me into marrying her, and then taking my only child away. It seems worse than usual today though. I suppose it's the stupid cat's fault - I'm grumpy because I didn't get enough sleep. After waking me up early for no reason, she jumped up onto my (bare) shoulders while I was at my desk checking my email, and I really wasn't in the mood for it, so I just shoved her off of me and let her fall to the floor - since I was already tired & grouchy and I REALLY didn't want to deal with her probably raking her claws into my unprotected skin, which is what usually happens when she is trying to get down safely from her perch on my shoulders. Maybe she'll think twice before the next time she jumps up there.

Anyway... When I left Monday, I was about to try running the DRAM demo under the Nios II IDE debugger. OK, it is running now (getting past where it was stuck on Friday), but the memory test failed!! Each time I tried it! First time at i=0, subsequent times at i=47.... Let's try rerunning it in RUN mode instead of DEBUG mode... Now it fails at i=94... Then i=47... repeatedly. OK, one more thing to try: Recompile in Quartus to pull latest compiled firmware into the FPGA bitstream, then monitor the output from nios2-terminal. Again, the test fails, this time with i=47 first, and then i=0 each time (but with different read vs. expected values).

Ah, OK, RTFM! When I started the demo by running the Demo Batch file (in "C:\LOCAL\DE3_demonstrations\150\DE3_DDR2\demo batch\de3_ddr2.bat"), instead of manually, it worked. I guess that means I need to figure out what's different about the way the demo is being run from within the batch file... Hm... Looking at it, there seems to be nothing unusual. Let's dissect it piece by piece:

First line:

%QUARTUS_ROOTDIR%\\bin\\quartus_pgm.exe -z -m JTAG -c USB-Blaster[USB-0] -o "p;DE3_DDR2_Q8.sof"

Running quartus_pgm.exe with the --help=z, etc. flag says:

"-z | --haltcc: Halts the on-chip auto-configuration controller of the device to allow programming via the JTAG interface."

"-m ... specify which programming mode to use."

"-c ..." (obviously)

"-o ..." and "p;" means "Program"

Nothing unexpected there. Then, the .BAT file just sets up some path variables and runs Cygwin bash on the de3_dd2_bashrc script. That just runs the standard "nios_bash" script for sopc_builder (which I think the normal nios shell must do also, right?), sets up some aliases, then does:

nios2-download ddr2_TEST.elf -c USB-Blaster[USB-0] -r -g
nios2-terminal -c USB-Blaster[USB-0]

The --help for nios2-download says: -c specifies the cable (clearly), -r says to reset the target SOPC system before use, and -g says run processor from entry point after downloading. Meanwhile, the -c argument to nios2-terminal just sets the cable.

Who knows, maybe if I run it the usual way, it doesn't start from the right entry point, or something... I guess it doesn't matter because in a pinch I can always load/run my design using the command-line tools instead of the GUI, and just imitate what the batch file is doing...

Still, it would be nice to be able to use the interactive debugger... Right now it gives some kind of warning about a version mismatch... Forcing a recompile (i.e., like make clean; make) of all the firmware, to see if that helps... Nope. Now trying: Regenerate the SOPC system in SOPC Builder, recompile Quartus design, and recompile firmware... Argh, still same problem.

No comments:

Post a Comment