From: Erik M. <J.A...@it...> - 2001-12-08 18:06:10
|
On Fri, Dec 07, 2001 at 11:16:49PM -0800, Tim Riker wrote: > Update of /cvsroot/blob/blob/src/blob > In directory usw-pr-cvs1:/tmp/cvs-serv22231/src/blob > > Modified Files: > debug.c > Log Message: > dump Good idea, Jan-Derk also thought about adding such a function. You were faster :) > + for ( ; address < endaddress; address += 0x10) { > + SerialOutputHex(address); > + SerialOutputString(": "); > + for (tmpaddress = address; tmpaddress < address + 0x10; tmpaddress += 4) { > + value = (*((u32 *)tmpaddress)); > + barrier(); Minor clarification: a memory barrier is not necessary if "value" is used as an argument for a function. Because SerialOutputHex() isn't an function in the same compilation unit, the compiler doesn't know what to expect from it. The only option the compiler has is to load the address before SerialOutputHex() is called. In other words: the function call serves as an implicit memory barrier. Besides of that, the compiler does understand that "tmpaddress" is not an invariant variable, so it will also understand that "value" will change in every walk through the for loop. The reason I used a memory barrier in the flash code was that the memory value we read indeed changes when we read it (that's how flash behaves in non read-array mode). Same for Stefan's memory tester: the whole issue of it is to test if the memory contents changed, so we need to be sure that the compiler doesn't optimise away (in its opinion) redundant memory reads. > + SerialOutputHex(value); > + SerialOutputByte(' '); > + } > + for (tmpaddress = address; tmpaddress < address + 0x10; tmpaddress++) { > + value = (*((u8 *)tmpaddress)) & 0xff; > + barrier(); Same story over here. > + if ((value >= ' ') && (value <= '~')) > + SerialOutputByte(value); > + else > + SerialOutputByte('.'); > + } > + SerialOutputByte('\n'); > + } [snip] > +static char dumphelp[] = "dump address [endAddress]\n"; > +__commandlist(dump, "dump", dumphelp ); Hey, I told you that adding commands is simple :) And now, for something completely different: I found a tool that adds "changesets" functionality to CVS (a la BitKeeper): http://www.cobite.com/cvsps/ . Erik -- J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty of Information Technology and Systems, Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands Phone: +31-15-2783635 Fax: +31-15-2781843 Email: J.A...@it... WWW: http://www-ict.its.tudelft.nl/~erik/ |