You copied the Doc URL to your clipboard.

Execution mode considerations

You must consider the mode in which the main application is to run. Your choice affects how you implement system initialization.


This does not apply to Arm®v6‑M, Armv7‑M, and Armv8‑M profiles.

Much of the functionality that you are likely to implement at startup, both in the reset handler and $Sub$$main, can only be done while executing in privileged modes, for example, on-chip memory manipulation, and enabling interrupts.

If you want to run your application in a privileged mode, this is not an issue. Ensure that you change to the appropriate mode before exiting your reset handler.

If you want to run your application in User mode, however, you can only change to User mode after completing the necessary tasks in a privileged mode. The most likely place to do this is in $Sub$$main().


The C library initialization code must use the same stack as the application. If you need to use a non-User mode in $Sub$$main and User mode in the application, you must exit your reset handler in System mode, which uses the User mode stack pointer.