Embedded Systems Design - August 2008 - (Page 12) programmer’s toolbox found that I needed to make changes to the vector-related files. That worked—no problem. Then I went back to run the vector project again. I discovered, to my horror, that it was now broken. VC++ Express was telling me that the files were corrupted, so it wouldn’t even open the project. If it had, perhaps I could have repaired the damage somehow, but I couldn’t. What’s up with that? What good is software reuse if you can’t actually reuse the software? I can’t tell you what happened—I need a Microsoft guru for that—but I do have a theory. When you’re working with a given VC++ Express project, I gather that it retains info on the files in a given project, which it uses to rebuild it as needed. When I made changes to some file in the second project, the date and size info on that file didn’t match what the first project had remembered. So VC++ concluded that the project was broken. Many Windows applications—Visual SlickEdit and the Matlab editor, for example—easily detect files that have been changed and politely ask you if you want to revert to an older version. Apparently, VC++ Express does not. I can’t say that I’ve done an exhaustive study of this issue—yet—but I did talk to a few folks in the Microsoft developers’ community, from both the online help forums and newsgroups. Without exception, the folks who responded all said that they’d never tried to use files in the way I had. Whenever they “reuse” files, they make new copies in the new project folder. That path leads to disaster, because you end up with multiple copies of a given file—copies that can be subtly, or not so subtly, different. Sorry, folks, but that ain’t reuse. Of course, you and I both know what’s needed here: a good version control system. I guess that, in the warm glow of my delight with VC++ Express, I had put too much faith in its ability to manage software that is shared between projects. Expect to hear more about this issue. I hope to find some guru, in Microsoft or not, who can tell me how best to handle the problem. In the meantime, just know that it is—or seems to be—a problem. BACK TO THE MATRIX CLASS Now let’s get back to software. As promised, I’m adding a new file, called SimpleMat.cpp, to the project (the code will be available at www.embedded.com/code). As the name suggests, this file contains the same kind of low-level functions that are in SimpleVec.cpp. In the last column (June 2008, p.14), I finessed the need for these functions by tricking the SimpleVec functions into doing the work. That trick still works, but since the functions involved are so tiny, we lose almost nothing by following the more straightforward and transparent approach. Furthermore, SimpleMat.cpp contains a few new, and key functions specific to matrix operations. The first two functions in SimpleMat.cpp are the console I/O functions mGet and mPut. The mGet function is essentially identical to vGet—the only difference is the range of the for-loop. The mPut function is a little more complicated, so that it will output the matrix row by row. I note again that these functions are rather crude, doing the least amount of work that’s practical. For specific applications, you might want to elaborate on them. At first glance, these new routines seem to be identical in function to the higher-level stream I/O routines I showed last time. In fact, it’s tempting to just call the low-level functions from the higher-level ones. But be careful: the functions in SimpleMat.cpp are strictly for console I/O. I use them mainly just for testing. The functions in Matrices.cpp can input/output to any compatible stream object. The next few functions in SimpleMat are virtually identical to their counterparts in SimpleVec. Because they perform the same operation on every element of the matrix, only the range of the loop counter changes. One exception relates to the vector function vSet. You might remember that this function sets every element of a vector to the same scalar value s. To be honest, even this vector function has limited value, except when s is 0 or 1. For a matrix, it has no value at all. On the other hand, the notion of a scalar matrix is fundamental. A scalar matrix has the form: 12 AUGUST 2008 | embedded systems design | www.embedded.com http://www.embedded.com/code http://www.cmx.com http://www.cmx.com http://www.embedded.com
Table of Contents Feed for the Digital Edition of Embedded Systems Design - August 2008 Embedded Systems Design - August 2008 Contents Number Include Parity Bit Programmer's Toolbox Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications Wanted: Industry Standards for Benchmarking Embedded VMM Hypervisors Achieving Cache Coherence in a MIPS32 Multicore Design Memory Allocation in C Advertising Index Break Points Marketplace Embedded Systems Design - August 2008 Embedded Systems Design - August 2008 - Embedded Systems Design - August 2008 (Page Cover1) Embedded Systems Design - August 2008 - Embedded Systems Design - August 2008 (Page Cover2) Embedded Systems Design - August 2008 - Embedded Systems Design - August 2008 (Page 1) Embedded Systems Design - August 2008 - Embedded Systems Design - August 2008 (Page 2) Embedded Systems Design - August 2008 - Contents (Page 3) Embedded Systems Design - August 2008 - Contents (Page 4) Embedded Systems Design - August 2008 - Number Include (Page 5) Embedded Systems Design - August 2008 - Number Include (Page 6) Embedded Systems Design - August 2008 - Number Include (Page 7) Embedded Systems Design - August 2008 - Number Include (Page 8) Embedded Systems Design - August 2008 - Parity Bit (Page 9) Embedded Systems Design - August 2008 - Parity Bit (Page 10) Embedded Systems Design - August 2008 - Programmer's Toolbox (Page 11) Embedded Systems Design - August 2008 - Programmer's Toolbox (Page 12) Embedded Systems Design - August 2008 - Programmer's Toolbox (Page 13) Embedded Systems Design - August 2008 - Programmer's Toolbox (Page 14) Embedded Systems Design - August 2008 - Programmer's Toolbox (Page 15) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 16) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 17) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 18) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 19) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 20) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 21) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 22) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 23) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 24) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 25) Embedded Systems Design - August 2008 - Cover Feature: Virtualization for Embedded X86 Multiprocessor Applications (Page 26) Embedded Systems Design - August 2008 - Wanted: Industry Standards for Benchmarking Embedded VMM Hypervisors (Page 27) Embedded Systems Design - August 2008 - Wanted: Industry Standards for Benchmarking Embedded VMM Hypervisors (Page 28) Embedded Systems Design - August 2008 - Wanted: Industry Standards for Benchmarking Embedded VMM Hypervisors (Page 29) Embedded Systems Design - August 2008 - Achieving Cache Coherence in a MIPS32 Multicore Design (Page 30) Embedded Systems Design - August 2008 - Achieving Cache Coherence in a MIPS32 Multicore Design (Page 31) Embedded Systems Design - August 2008 - Achieving Cache Coherence in a MIPS32 Multicore Design (Page 32) Embedded Systems Design - August 2008 - Achieving Cache Coherence in a MIPS32 Multicore Design (Page 33) Embedded Systems Design - August 2008 - Achieving Cache Coherence in a MIPS32 Multicore Design (Page 34) Embedded Systems Design - August 2008 - Memory Allocation in C (Page 35) Embedded Systems Design - August 2008 - Memory Allocation in C (Page 36) Embedded Systems Design - August 2008 - Memory Allocation in C (Page 37) Embedded Systems Design - August 2008 - Memory Allocation in C (Page 38) Embedded Systems Design - August 2008 - Memory Allocation in C (Page 39) Embedded Systems Design - August 2008 - Memory Allocation in C (Page 40) Embedded Systems Design - August 2008 - Memory Allocation in C (Page 41) Embedded Systems Design - August 2008 - Memory Allocation in C (Page 42) Embedded Systems Design - August 2008 - Advertising Index (Page 43) Embedded Systems Design - August 2008 - Advertising Index (Page 44) Embedded Systems Design - August 2008 - Break Points (Page 45) Embedded Systems Design - August 2008 - Break Points (Page 46) Embedded Systems Design - August 2008 - Marketplace (Page 47) Embedded Systems Design - August 2008 - Marketplace (Page 48) Embedded Systems Design - August 2008 - Marketplace (Page Cover3) Embedded Systems Design - August 2008 - Marketplace (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.