View Single Post
  #7   Spotlight this post!  
Unread 04-01-2005, 23:31
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Program error after controller reset

Quote:
Originally Posted by Mike Betts
2. Just what is the value of an uninitialized variable? Answer: It is undefined. If you are lucky, it will be 0x0000 or 0xFFFF. If you are unlucky, it can be anything.

My point here is that it is impossible to do what you suggest in an embedded controller.
Actually, it is possible. If you assign an initial value to a static variable, the C compiler will automatically generate code to put the correct value in that location in RAM. This code is hidden from the user and is called before control is passed to the C program's entry point (usually main()).

{edit} The code that does this is in _do_cinit() in ifi_startup.c {/edit}

{edit2} But I agree with you that if you modify the default code then it becomes your responsibility to ensure there's no bugs. It would be impossible for IFI to protect the end users against all of the various mistakes like this that are possible. {/edit}

Last edited by Dave Flowerday : 04-01-2005 at 23:44.