July 16, 2007

Information

Yesterday evening (very early this morning) Google informed me that I have had an unusual number of invalid clicks and therefore they are disabling my blogs from running Google ads. This is a disappointment, since it is probably some of you checking out the advertisers on the blog as a way of supporting what I am doing.

Your support is always welcome and appreciated.

The Google ads were initial ran to help cover the cost and time of the blogs. I still believe in what I am doing as a good thing so I am continuing this blog and my other blogs and websites.

If you know of a some advertisers who what to place ads on the site to help sponsor the blog let me know.

If Google changes thier minds the ads will reappear.

Thanks,

Aaron

July 05, 2007

What to do when you have a critical error...

In a PC based software application this question is easy...

  • Print an error message and exit the software and if need reboot the PC.
  • Assertions can be used to check for unexpected errors.

In a embedded platform whether it be a programmable thermostat, ABS brake system, or an implanted medical device the what to do is less clear.

  • On a medical device do no harm is key but, they how do we recover.
  • On a programmable thermostat make sure you go back to a safe default.
  • On a ABS system possible go back to non-ABS mode (power assist only).

The problem is what to do to recover and how do we let the user know there was a problem.

  • Maybe the safest thing to do is ignore the error.
  • Store a message where the user can get to it later.
  • Maybe light an LED saying there was an error.
  • Possibly reboot to the last known state.
  • Possibly reboot to factory defaults.

Things to consider are the impacts of your recovery and side effects. Also, what if you ignored the issue. Then which is worse and better of your options. One that is done how to reboot a device.

  • To recover from hardware and software issue you will want to reset both.
  • To recover from software only issue you may only need to restart the code.

Remember when you are designing a system to make sure your hardware has a way to be rebooted and has a watchdog timer. Make sure it is long enough to allow it to not seriously impact your system performance.

Aaron

June 25, 2007

No volatile (not an embedded driver)

Have you every wondered why when you optimizate you code the code breaks. So, it is probably not your compiler at fault it is probably your own.

*(unsigned long *)0xabc123 = 1;
*(unsigned long *)0xabc123 = 2;
*(unsigned long *)0xabc123 = 3;

May get optimized as...

*(unsigned long *)0xabc123 = 3;

What happened to the 1 and the 2 required by your HW. Optimized out.

*(volatile unsigned long *)0xabc123 = 1;
*(volatile unsigned long *)0xabc123 = 2;
*(volatile unsigned long *)0xabc123 = 3;

The keyword volatile forces every access (read or write to occur). This should be on most HW accesses.

Another example (a delay loop)...

int i;

for (i=0; i < 100; i++) ;

Your optimizer says i= 100 and calls it a day (no delay).

Add volatile the loop now delays.

volatile int i;

for (i=0; i < 100; i++) ;

Any questions or comments contact me.

Aaron

May 08, 2007

If you are not co-developing and co-debugging you are behind the curve

You should be developing you hardware, software and documentation in parallel. If not you are falling behind.

The following should be developed in parallel...

  • Documentation (particularly the register specification)
  • Hardware Abstraction Layer
  • Register/Field definitions for both HW and SW.
  • Generation of a HW register model software can use.

Check out tools like NAUET (www.mataitech.com) and standards such as SPIRIT (IP-XACT).

When it comes to debug you should be doing co-simulation and co-debug...

  • You should be creating the environment to test your software before the hardware is ready.
  • Every software engineer should have a simulator and the tools to collaborate with HW.
  • Before you tape out you part is the software tested on it. If no, why not.

I have developed for several companies their HW/SW co-simulation environments. If you would like check out my website and can help you accelerate you HW/SW development and lower your risk of a dead chip returning. Check out my website (www.baranoff.com) and let me train you on how to do all the above and more.

April 18, 2007

Why this OS or not

In a informal survey, when why an OS was chosen by my clients over the years. The reasons were as follows...

  1. I don't know
  2. We use it on another product.
  3. My boss said so.
  4. We know that one.
  5. We can hire someone who knows that one.
  6. We saw a nice demo.
  7. The vendor offered to help us.
  8. It did what we needed it to do.
  9. It fits our system.

The bottom line is that the OS does not seem to be reevaluated on a project by project basis it is decided largely by items outside of the project's needs or requirements and then sometimes it drives the rest of the system. An OS should not drive your design your design should drive the OS choice or even if you need a RTOS or OS.

I would like to hear why you or your company has chosen an embedded OS or not.

To OS or not to OS that is the question

Actually the question is...

To OS, RTOS, or not to OS?

Many if not most embedded products we use don't need an RTOS or and sort of OS. So, why do people get wrapped around the axial worry about OSes.

First decide what you product is supposed to do then decide if you need and OS or not. Then decide what type. Does it need to be real time or not. Does adding support for the OS or RTOS in terms of memory, file systems and supporting software (drivers and more) worth the benefit of what you get.

If I can write the code as a simple main() with a while loop and an interrupt to two why do I need and OS. I am not against OSes or RTOS. Just use what you need and don't add unnecessary complexity.

I recently helped a client of mine by added a simple scheduler instead of adding a whole OS with actually better predictability and reliability then they could have with an and all in a very small footprint.

/* simplified code fragment */
main()
{
     while(1)
     {
           for(task_id=0;task_id<MAX_TASK;task_id++)
           {
                 (task_list[task_id])(); /* call each task in turn let run until completion */
           }
     }
}

Simplicity is more reliable then complexity. An OS adds complexity. With an OS each task has its own stack if you have hundred or thousands of small task the memory impacts can be huge. If the time it takes to get around through all the tasks is less then the time need required by the system this is very stable. If this could not make it all the way through the loop in time the same would apply to an RTOS as well (something to consider and RTOS does not create time). No OS, means less memory and no task context switch overhead. This list could be 1 or 1000 task long. You can add a sight twist and compare the last time the task ran with a the prior time a task ran and decide if you can skip this run.

Consider skipping the OS on your next design.

The reason why OSes show up in more place then they are needed is marketing.

April 08, 2007

Welcome

Welcome to the bit mines. A term coined by several engineers I worked with now almost 20 years ago.

The goal of this site is to freely exchange information about embedded systems software without the ties to any given OS or RTOS (Real Time Operating System) or is you even need one.

My name is Aaron Baranoff I have been writing and teaching embedded software for quite a while.

My personal website is www.baranoff.com.

What is software? (my definition)

  • Software is simply the sequence of code required to get the proper bits in and out of the proper bytes in the right sequence with the correct timing and present them to the user of the code in a way they can manipulate the process without violating the hardware rules and without violating common sense.
  • The user of the software can either be another piece of software or user buy way of some hardware.
  • This all needs to be done in a way that is both portable, readable and maintainable.

Why do I do this?

Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime.
Lao Tzu

Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime. If teach about the science or theory of fishing prior to learning to fish he will starve before he will learn.
Aaron Baranoff’s addition to Lao Tzu’s Quote

AddThis Social Bookmark Button
Blog powered by TypePad

July 2007

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

Amber Alerts