Monday | 2014 August 11 | Entries on how compilers work The is a brief cross reference to my blog entries on how various pieces in a compiler work: read more... |
---|---|---|
Wednesday | 2014 August 6 | Panopticon I have a small pile of "interesting ideas" that I'd like to try someday, time and motivation permitting. read more... |
Saturday | 2013 December 21 | Problem: Many images of the Earth are mirror images read more... |
Thursday | 2013 November 28 | The Problem: People don't understand the Earth's rotation. I'm pretty sure that people do not know how the earth rotates. Judging by the number of times that I see a globe spinning the wrong way, and how many years that these globes remain uncorrect, I suspect that people don't see this rotation as wrong. (This leads me to believe that people do not know how the earth looks, is oriented, and rotates.. and how this is connected to common place phenomenon) read more... |
Sunday | 2013 November 3 | Bad Methods: Just choose a technique that gives the answer you want A bad method spotted in a computer science / "big data" paper: read more... |
Wednesday | 2013 October 23 | Control the critters with buzzwords! So, now that the critters can be controlled, how can we control them with the buzzword of the day? read more... |
Sunday | 2013 October 20 | Become a neurophysiologist in the evenings and on weekends! First, you'll need a starter kit. Start with the Roboroach beta or Roboroach. read more... |
Thursday | 2013 September 19 | Interesting Video ome video that I think are interesting and worth sharing. read more... |
Friday | 2013 September 13 | Small Planes: Paper airplane reference design While searching the intertubes for fun stuff, I found an interesting paper that could be part of my goal to build a remote control paper airplane. The author, as part of his larger discussion, includes a description of a paper airplane with a PIC-16 based avionics using inertial measurement and voice-coil actuators. Rudimentary, but good stuff. read more... |
Wednesday | 2013 September 4 | Review of Informal Lectures on Formal Semantics I wrote a review (for my own purposes) of Informal Lectures on Formal Semantics Emmon Bach, 1989, State University of New York Press and have made it available. Enjoy. read more... |
Friday | 2013 July 26 | Better location identification within yard This is a note on improving the locating feature of the car. When I last described the locating feature of the robocar, it was based on principally on GPS, followed by some estimation techniques. There are some limits to how well these work. read more... |
Thursday | 2013 July 25 | Review of Principles of Program Analysis In 2008 I wrote a review (for my own purposes) of Principles of Program Analysis Flemming Nielson, Hanne Riss Nielson, Chris Hankin, 2ed 2005, Springer. I cleaned it up and made a pdf available. Enjoy. read more... |
Saturday | 2013 July 20 | Pause Last fall, I thought I�d be resuming the "robot car" this summer season. And that I might have built some support tools over the winter. Now that winter & spring have passed, and summer is on me, I�m not sure my son and I will get back to implementing anything. I may write up some more interesting ideas I�d like to pursue. read more... |
Monday | 2012 September 24 | Supplier Issues I hope to return soon enough technical details. I've been fighting with a supplier. In essence I recommend against purchasing from Hobby King. read more... |
Wednesday | 2012 September 5 | Bryce Lynch, Rise to Power Continuum is a great name and all, but it's over used. Besides, the story clearly is Bryce Lynch, rise to power. read more... |
Thursday | 2012 August 23 | Servo controller !! What I selected The servo Controller is a Torobot 32 servo controller. read more... |
Monday | 2012 August 20 | Raspberry Pi As I may have mentioned, I am using the Raspberry Pi as the robot's primary processor, mainly because it looks' to be a convenient embedded controller. My plan is to selectively leverage the power of the UNIX legacy, while trying to avoid the UNIX curses. To use commonly available USB parts and the boards GPIO port for the small number of special cases. read more... |
Friday | 2012 August 17 | GPS Unit Now we get to the actual GPS Unit. read more... |
Monday | 2012 August 13 | Navigation Part 3: Steering Now that the bot knows where to go, the trick is to get it reasonably to said point. read more... |
Saturday | 2012 August 11 | Navigation Part 2: Planning the gross route If we have a clear path from a starting point to the goal -- that is, one that does not cross a boundary -- our route planning is easy. It is just a straight line. read more... |
Friday | 2012 August 10 | Navigation Part 1: Geo-fencing The first step is to have a plan to keep the bot in the yard -- and out of the plants. This means the knowing where the bot a can (and can't) go. Geo-fencing is a virtual perimeter that keeps the drone (robot) inside the "fence." DIYDrone's "Ardupilot" and "Ardupilot-Mega" implement a fence. However, DIYDrone's fences appear to be a simple box. My yard (and parks) have irregular shapes. read more... |
Thursday | 2012 August 9 | Robot car For fun, I thought I'd make a robot car with the boy. read more... |
Saturday | 2011 September 24 | Small planes Recently its been too rainy or windy to fly my conventional RC planes. read more... |
Saturday | 2011 July 9 | Integer Types This is mostly an update to the previous post wherein I described integer types, especially those with specific sizes. read more... |
Sunday | 2011 January 16 | Preferred types Continuing on with some thoughts in the coding style, I ramble a bit about the kinds of types to be preferred. read more... |
Sunday | 2011 January 2 | Procedure and File sizes To extend the coding style guide outline thought I would write about the sizing of procedures and files. The short version is that both should be small. read more... |
Wednesday | 2010 December 29 | Hints for coding style guide To me, a coding style guide is a writers guide, similar to what you'd see used with publications. It is part of how a design is communicated (specs, requirements and, architecture) an implementation is communicated. Communication of its implementation (coding style, comments, review) its testing, what can be expected of it (the code). read more... |
Sunday | 2010 October 24 | Memory wrap-up This is to summarize what I've written so far regarding memory. I don't plan revisiting them soon. read more... |
Sunday | 2010 October 3 | CPD This time I am going to describe a copy-paste detector I wrote several years ago. This tool builds on the duplicate file finder I described earlier. The concept was introduced to me with the Tom Copeland article "Detecting Duplicate Code with PMD's CPD" on the O'Reilly, in 2003. That tool is part of the "PMD" toolset. Those tools proved invaluable at the time, because I was working with others on a set of large java-based programs. read more... |
Sunday | 2010 August 15 | Duplicate file finder I'm going to describe a tool I wrote to find duplicate files. I had a bunch of hard drives I wanted to get rid of. These were a few hundred megabytes to a few gigs, and I wanted to copy them all to a big terabyte hard drive. These drives were mostly backups of files, but they might have other stuff on them. Once I copied the drive, I wanted to eliminate duplicates that had accumulated. read more... |
Tuesday | 2010 August 10 | Memory allocation tool. In this entry, I am going to describe a memory allocator I wrote a few years ago. I don't claim it is unique (never been done before), perfect, or even suitable for your tasks. It did, however, work very well for the application I had (a copy-paste detector, suitable, for another time) read more... |
Sunday | 2010 August 1 | Note on checking memory in embedded systems I was recently in a conversion and the topic of long-lived, but hard-to-field-service embedded systems came up. The topic ranged over checking for system degradation through error counters to checking for memory corruption. This time I thought I'd share some techniques (and ideas) on checking that the memory in embedded systems. read more... |
Monday | 2010 July 19 | Memory models I was recently curious about the issues of memory models. I saw a video lecture wherein the instructor mentioned research on the Java memory model, eventually incorporated into Java 5, as the most complete on the issues involved. It fixes a number of issues in earlier Java versions, a model that is not too different from C, C++, C#, and so on. As he pointed out, everyone seems to be getting along fine before the analysis, did we really miss that much? (Yes) What were we missing? Did we know about these, but choose to discretely ignore them, and not put them altogether? read more... |
Wednesday | 2010 July 7 | One-time resource allocation There is a software design techniques where you make all of your allocation of resources at the start of program execution. This is useful for embedded, OS kernels, and software in general. I don't know that this technique is taught (or learned) any more. read more... |
Thursday | 2010 July 1 | Go lightly on the exclusive ors (XOR) When creating a code style guide, one of the considerations is the preferred choice between different constructs that achieve the same thing. I usually prefer an idiom that is easier to understand, or can be maintained over the long term, even if it is slightly more verbose. read more... |
Tuesday | 2010 June 29 | Performance In this entry, I would like to describe a profiling algorithm I considered, but never completed. (The performance never matter enough to examine the profile results in depth.) I believe that this approach can offer a different kind of insight. read more... |
Sunday | 2010 June 27 | Check for potential bad calling sequences One of the core ideas that I have been discussing is testing of embedded software internals. My focus has been on modal testing -- testing hypothetical cases, and checking current state with past state. I'd like to describe a technique that I believe will identify if it is possible for the code to generate a string calls that violate the system rules. The analysis treats source code as a specification for generating strings of calls, and it will check those strings. This will tell me if it is possible for the procedures to generate a bad calling sequence. read more... |
Friday | 2010 June 18 | Looking at some of the testing I'd like to do in the future Now that I have described how I automated unit tests for embedded system, I would like to discuss some things that I did not get around to. (At least not yet.) Below is a list of some of the kinds of things I'd like to revisit in the future. read more... |
Wednesday | 2010 June 16 | Brief interlude with Some of Microsoft's Analysis Tools I've been describing the emulation of embedded software on a host platform, and encouraging use of the hosts code analysis tools to improve the code. So I've had the good fortune that Raymond Chen has mentioning some of Microsoft's code analysis tools at the same time. I have reproduced some of his links below: read more... |
Tuesday | 2010 June 15 | Testing that the API accepts the promised sequence of calls This entry is about a body of checks to verify that each API accepts the sequences of calls promised by the regex description. This is done by turning each element of the regular expression into its own test procedure. Each of the five regular expression constructs has its own format for the procedure: read more... |
Monday | 2010 June 14 | Unit Tests This entry is about the unit tests that are automatically created as part of transforming the source code for the emulation. The core idea is to call each of the procedures with different combinations of valid values for their parameters. They are watched to see that they do not violate any of the rules outlined by the boundary conditions file and calling sequences rules. read more... |
Tuesday | 2010 June 8 | Protecting calling sequences Where we are? I have been describing part of an emulator that acts as a bug sieve. It helps automatically identify when it is likely there is a bug manifesting itself. In the previous entries I described that the emulation checks that we are following rules for using a peripheral device, that parameters to a call are in a valid range, that variables are within their constraints, and that the output values are in a valid range. This time I am going to explain how the emulation checks that the program is making acceptable sequences of procedure calls. read more... |
Sunday | 2010 June 6 | Boundary Conditions In a previous entry I outlined the beginnings of how the emulator monitors for errors. In this entry and the next, I will discuss how to I specify the rules of proper code execution, and how the specification is changed into mechanical checks. This time I will discuss how to check boundary conditions, with an approach that is very similar to design by contract. read more... |
Friday | 2010 June 4 | Monitoring the code execution Now that I have outlined how the emulation works, I can outline how I structured the emulation to monitor for proper execution, to catch bugs and other software errors. read more... |
Wednesday | 2010 June 2 | Fleshing out the emulation framework As I explain previously, the first part of the emulation was a tool that translates the source code into a form suitable for a PC host. A new directory structure is created. Then all of the generated code, templates, et cetera are deposited into this directory structure. The structure includes: read more... |
Tuesday | 2010 June 1 | Writing an emulator I mentioned in the previous entry that I would describe how I wrote an emulation of an embedded system (and in the future, I intend to explain how I wrote simulations). I wanted to write the simulation for a number of reasons. To explore language semantics, to explore parsing, to explore ideas in testing, and debugging. And, to allow development of embedded systems when I didn't have all of the hardware ready. read more... |
Sunday | 2010 May 30 | Emulators and simulators In the land of embedded systems development, it is broadly accepted that you should have an emulator. You do not need one with some simple systems, but you will find it hard to debug the design (hardware and software) without one. Most people often use an ICE (an in-circuit-emulator) or the debug port on a micro-controller. You can also use a simulator. In this entry, I will outline the kinds of tools available, and their distinction. read more... |
Wednesday | 2010 May 26 | Estimating the maximum time spent in an interrupt service routine. In design and development of software, I want to know what the worst-case, longest execution time for the interrupt service routine. Not what we specified or intended in design; rather what the compiler created. This is important because we want to be sure that we have plenty of time to spare: we don't want to miss other interrupts, or important hardware events that are signalled, and so forth. And we don't want the ISR to be an infinite loop. read more... |
Tuesday | 2010 May 25 | Cracker Barrel: Reconstructing Position In the summer of 1990 I started as a student assistant for an oceanographer at the University of Washington's Applied Physics Lab. Somewhere along the way I was given a task to reconstruct where on earth (literally) a measurement was taken. I was given a few different tapes, and copies of handwritten logs. From there I tried to estimating position of measurements based on these different sources: the ships logs, recordings from the navigation equipment, the sensor itself, and so on. read more... |
Sunday | 2010 May 23 | Addressing Misconceptions: On computers, Countable and Floating point numbers are not associative nor distributive One of the subtlest way to create bugs in embedded systems is with the math in C. Or, at least to assume that it is good enough, without considering how the compiler and hardware do math. read more... |
Friday | 2010 May 21 | Structure device drivers and error handling with sequence points In a previous post I discussed logical OR, sequence points, and mentioned that these are useful for writing driver code with failure handling. This is a description of just that. read more... |
Thursday | 2010 May 20 | Logical Operators, Bitwise Operators, and Sequence Points From time to time, I read C code that uses the bitwise | operator when the logical || operator is more appropriate. The code might look a bit like: read more... |
Wednesday | 2010 May 19 | Addressing Misconceptions: Procedures ("lambdas") vs Objects Some time ago I saw a Microsoft video wherein Eric Meijer claimed that object's were more powerful than "lambda's". I was pretty surprised, since it is (or was?) a standard undergraduate homework problem to show their equivalence. read more... |
Tuesday | 2010 May 18 | One of the things I learn from reading the assembly listing is how some compilers work. C (for example) has five kinds of looping constructs: for , while , do while , goto , and recursion. I'll skip the last two, since they lack bounds check (the programmer has to insert a stop). I used to write assembly that would implement loops for each of the first three constructs like the following: read more... |
Monday | 2010 May 17 | C's Switch / Case construct, Loop Unrolling and Duff's Device A few years ago I was in a fun discussion with one of our junior firmware engineers about the different constructs in C and how these constructs mapped to underlying machine code, and performance characteristics. During the conversation came up that he didn't know the switch , case ,break construct works in C, and how it makes Duff's device possible. I'll briefly describe it here. read more... |
Sunday | 2010 May 16 | Addressing Misconceptions: The precedence of C's shift operators What are the computed values, for the C/C++ language, of A and B below? read more... |
Friday | 2010 May 14 | Great Compilers: The Hi-Tech C Compiler When I work on a project I read the assembly listing that are produced by the compiler. One of the best compilers I have ever encountered is the C compiler from Hi-Tech C. It produces amazingly tight code for 8 microcontrollers with only a few bytes of RAM and program memory. Things like the 8051, PIC10, PIC12, PIC16, etc. read more... |
Thursday | 2010 May 13 | Addressing Misconceptions: Loop Termination One of the first things someone new to a language like C is that it integer variables wrap around. For example the following is an infinite loop: read more... |
Tuesday | 2010 May 11 | Micro Cornucopia When I was High School I subscribed to a magazine called Micro-Cornucopia. I loved its sense of humor, it's love of taking on hardware projects, robots and embedded projects, software projects that included fractals, prolog, the workings of compilers, and the like. Heck it even published the schematics of XT computer, which I poured over. I loved how it was in the neighborhood -- it was from Oregon and had regular get-togethers there, while I was in a part of Washington famous mainly for being Microsoft's headquarters. (I was looking forward to going to one of the SOG's someday) read more... |
Saturday | 2010 May 8 | Checksum and Hash padding I think people tend to learn to use MD5 / SHA / CRC calculations by mimicking others. This isn't bad. But I think it explains why I see a class of mistakes become common. The first is that these algorithms work on a certain number of bits and need to be padded out to get their power, qualities and other goodness. read more... |
Friday | 2010 May 7 | Programming in solder I often make my own twee lab hardware -- logic probes, op-amps (I love op-amps), power regulation etc. Not production quality, but that's fine. read more... |
Saturday | 2010 May 1 | A note on low power and microcontroller speed When working with low-power designs (e.g. battery powered) there is often a design trade-offs in developing software: (a) do work at high speed as quickly as possible, and then go to sleep, or (b) do the work at a lower speed? read more... |