Main Content

Execute Real-Time Application with S-Functions in Run in Kernel Mode

You can use S-functions inRun in Kernelmode when the S-functions are self-contained. For example, the S-functions only call a limited subset of the standard C library, such as math and string functions and do not call file I/O, console I/O, or Windows API functions. An example of not-self-contained S-function would be a function that needs to#include .

Note that being able to simulate an S-function with other code generation targets—such asgrt.tlc,ert.tlc, orslrealtime.tlc—does not a prove that it can be simulated withsldrt.tlc. For example, S-functions that are linked with dynamically linked libraries (DLLs) on Windows generally do not simulate with金宝app®Desktop Real-Time™because the DLLs are not available to the real-time kernel.

在particular, the following functions are not supported in the C source code:

  • File I/O (fopenand others)

  • Process management (spawn,exit, and others)

  • Signals and exceptions (signal,longjmp,__tryand others)

  • Time functions (clockand others)

  • Any functions from the Windows API

The following C library functions are supported for use withSimulink Desktop Real-Time:

  • Data conversion functions:abs,atof,atoi,atol,itoa,labs,ltoa,strtod,strtol,strtoul,ultoa,

  • Memory allocation functions:calloc,free,malloc,

  • Memory manipulation functions:_memccpy,memcpy,memchr,memcmp,_memicmp,memmove,memset,

  • String manipulation functions:strcat,strchr,strcmp,strcpy,strcspn,_strdup,_stricmp,strlen,_strlwr,strncat,strncmp,strncpy,_strnset,strpbrk,strrchr,_strrev,_strset,strspn,strstr,strtok,_strupr,

  • Mathematical functions:acos,asin,atan,atan2,ceil,cos,cosh,div,exp,fabs,floor,fmod,frexp,ldexp,ldiv,log,log10,max,min,modf,pow,rand,sin,sinh,sqrt,srand,tan,tanh,uldiv,

  • Character class tests and conversion:isalnum,isalpha,_isascii,iscntrl,isdigit,isgraph,islower,isprint,ispunct,isspace,isupper,isxdigit,isxupper,isxlower,_toascii,tolower,toupper,

  • Searching and sorting:bsearch,qsort,

  • 虚函数(可以,但什么也不做)exit,

  • Console I/O:fprintf,printf,

Related Topics