The Basics Of Embedded Systems

Computers & TechnologyTechnology

  • Author Sanjay Mishra
  • Published February 8, 2010
  • Word count 413

For any C programmer making the change to embedded systems, here are some basic tips for more successful programming.

Test on Hardware Right Away

Testing in a realistic scenario is always the best way to identify potential problems, so try to get at least a prototype of the hardware needed so you can do more accurate testing as you do your programming.

Try to Use a Widely Available Processor with Online Support

With just the processor's datasheet from your client, you are going into a project blind. These sheets are usually buggy, so being able to access an online forum can speed up your work by getting you connected with other users who have found the same problems.

Keep Updated Schematics at Hand

With embedded programming, you must understand the hardware while you are working on the software. Always have the schematics on hand so you can refer to them as you work.

Watch Your RAM

Embedded systems can be very restricted in terms of RAM capabilities. To use your RAM effectively, you might want to store variables and constant strings in flash instead.

Avoid Infinite Loops

Your programming should never have infinite loops that can only terminate when a certain condition is met. Any bug that stops that condition will result in a loop with no escape, and effectively locked-up software. Always leave a way out of a loop.

Keep in Modular

When writing code in C, write each particular function into a module. It's very efficient then to expose just the interface in the header file.

Use the Best Debugger You can Afford

In Circuit Emulators (also known as ICE) are your best option, but they can be expensive. JTAG is another choice, but you'll be limited in how many breakpoints you can place and whether you can examine the code traces.

Save your Toolchain After the Project

Even years after a programming project is complete, you may be called to make changes. To ensure you still have the right tools at hand that you used originally, plan to save everything. A great way to do this is with a virtual machine. Do the project on a virtual machine (such as with VirtualBox or VMWare) and then just save the entire thing for future reference once the project is done.

If its Not Tested, Assume it Doesn't Work

All code needs to be tested with all hardware, under any possible condition that might arise. Automated testing can help keep it efficient.

Sanjay Mishra is on the team of Fast Product Development, a product development bureau based in Potomac, Maryland. Read more about hiring an electronic design consultant at their site.

Article source: https://art.xingliano.com
This article has been viewed 600 times.

Rate article

Article comments

There are no posted comments.

Related articles