Keil Logo Arm Logo


Information in this article applies to:

  • C166 All Versions


I need to perform a software reset in C without using inline assembly. How can I do that?


There are 2 ways to accomplish this depending on what you want to achieve:

  1. The following reset function jumps to 0 and starts executing code from there. Note that since this is only jumping to the reset vector, the chip is not actually being reset. The startup code (executed before EINIT) will have no effect.
    void reset (void)
    ((void (far *) (void)) 0x000000) ();

    The following code is generated for the reset function. The ?C_SCALLI routine calls the address stored in R4 and R5 (which is 0x000000).

    0000 E004          MOV       R4,#00H
    0002 E005          MOV       R5,#00H
    0004 DA000000 E    CALLS     SEG (?C_SCALLI),?C_SCALLI
    0008 CB00          RET
  2. The Keil compiler supports a number of "intrinsic library functions". These are not really functions. When you use one of them, the compiler inserts a C16x architecture specific instruction inline. You do not need to use the "asm" pragma and you don't need to insert assembly mnemonics yourself.

    To perform a software reset, use intrinsic library function _trap_ with a parameter of 0. For example:

    #include <intrins.h>
    // ...............................
      _trap_ (0);

    If you look at the listing file, you will see that main function has an SRST assembly instruction in place of _trap_(0).


  • Refer to _trap_ in the C166 User's Guide.


Last Reviewed: Friday, July 15, 2005

Did this article provide the answer you needed?
Not Sure

Keil logo

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.

Acquisition of ARM Holdings plc. by SoftBank Group Corp.

We are pleased to inform you that on 5 September 2016, SoftBank Group Corp. acquired ARM Holdings Plc. ARM will continue to operate as an independent business within the SoftBank group.

Any current agreements between ARM Ltd (or other ARM group companies, as applicable) you / your company remain in effect as between the parties, and the parties will continue to be bound by and perform the obligations in such agreements. If you have any queries please direct these to