Keil Logo


Information in this article applies to:

  • C166 All Versions
  • C251 All Versions
  • C51 All Versions


Are there any things that my embedded program should do when it starts? For example, is there a POST or Power On Self Test that is standard that I should use?



  1. C Run-Time Initialization
    This is the process that clears memory to 0 and initializes the contents of global variables. Fortunately, most of this is handled by the startup code that is provided with the Keil C Compilers. You should probably start a new project by copying the startup code (STARTUP.A51, START251.A51, or START167.A66) to your project directory and including it in your project. You may need to customize these files for your target system.
  2. Power Stabilization Delay
    In many systems, the CPU may start running before the power supply is completely stabilized. The easiest way to avoid reset problems due to noisy power systems is to insert a 100ms or so delay in the startup code. It is best to watch the power-up sequence with a digital storage scope to see how long this takes.
  3. ROM Checksum
    A ROM checksum is a method ot verifying that the program code is valid. This is an easy test to perform. Refer to GENERAL: GENERATING A ROM CHECKSUM for details.
  4. RAM Test
    A RAM test verifies that the RAM in your system is working. There are, of course, numerous ways to test the RAM in your system.
  5. Test Other Peripherals
    You should probably test any peripherals that are required for proper operation of your target.


The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Saturday, July 9, 2005

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.