Keil Logo

Predefined Functions

Predefined functions assist the developer in debugging applications and in creating his own functions.

The following table lists all predefined debugging functions.

Return Name Parameter Description
double  __acos  (double) Calculates the arc cosine.
double  __asin  (double) Calculates the arc sine.
double  __atan  (double) Calculates the arc tangent.
double  __cos  (double) Calculates the cosine.
double  __exp  (double) Calculates the exponential.
double  __log  (double) Calculates the natural logarithm.
double  __log10 (double) Calculates the common logarithm.
double __sin (double) Calculates the sine.
double __sqrt  (double) Calculates the square root.
double __tan  (double) Calculates the tangent.
uchar _RBYTE (address) Read a char from the memory address.
uint _RWORD (address) Reads a short int from the memory address.
ulong _RDWORD (address) Reads a long from the memory address.
float _RFLOAT (address) Reads a float from the memory address.
double _RDOUBLE (address) Reads a double from the memory address.
int _TaskRunning_ (ulong func_address) Checks if the specified task function is the currently running task. Available only if a DLL for RTX Kernel Awareness is used.
double _sleep_ (ulong milli_seconds) Delays execution for milli seconds.
void _WBYTE (address, uchar val) Writes a char to the memory address.
void _WWORD (address, uint val) Write a short int to the memory address.
void _WDWORD (address, ulong val) Writes a long to the memory address.
void _WFLOAT (address, float val) Writes a float o the memory address.
void _WDOUBLE (address, double val) Writes a double to the memory address.
int exec ("command_string") Executes the debug command. Returns '0' on success, else an error code.
int execf ("fmt_string", ... ) Define debug commands with a variable component (for Cortex-M only). Returns '0' on success, else an error code.
double getdbl ("prompt_string") Prompts the user to enter a double.
int getint ("prompt_string") Prompts the user to enter an integer.
long getlong ("prompt_string") Prompts the user to enter a long number.
void memset (start_addr, len, value) Fills the memory starting at start_addr and the length len with the value.
void printf ("string", ...) Works like the ANSI-C printf function.
int rand (int seed) Returns a random number in the range 0 to 32767.
void rwatch (ulong address) Delays the execution of a signal function until a read-access event occurs on address.
void swatch (float seconds) Delays the execution of a signal function for seconds.
void twatch (ulong states) Delays the execution of a signal function for number of CPU states.
void wwatch (ulong address) Delays the execution of a signal function until a write-access event occurs on address.

Note

The predefined functions in this table cannot be deleted or modified.

User hook functions

User hook functions are also predefined, but need additional coding by the user. OnResetExec and OnStopAfterReset help you to run code after certain reset conditions have been met.

  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.