How to use sprintf, memset and strstr functions in the callback function?
Are they safe to use in the ISR Context?
Only a limited number of the runtime library functions are available to call from within ISRs. Not all C run-time library functions are interrupt-safe (and can, therefore, be called from an interrupt service routine). For a run-time function to be classified as interrupt-safe: • It must not update any global data, such as errno • It must not write to (or maintain) any private static data It is recommended that none of the functions defined in the math.h header file, nor the string conversion functions defined in the stdlib.h header file, be called from an ISR as these functions are commonly defined to update the global variable errno. Similarly, the functions defined in the stdio.h header file maintains static tables for currently opened streams and should not be called from an ISR. The memory allocation routines (such as malloc, calloc, realloc, and free), the C++ operators new and delete, and any variants, read and update global tables and are not interrupt-safe; they should not be called from an ISR. The following library functions are not interrupt-safe because they use private static data. asctime gmtime localtimerand srand strtok Please refer to the chapter "Calling a Library Function From an ISR" from the below C/C++ Compiler and Library Manual for Blackfin Processors in the below link:https://www.analog.com/media/en/dsp-documentation/software-manuals/cces-blackfincompiler-library-manual.pdf
And for Sharc processors, Please refer to the chapter "Calling a Library Function From an ISR" from the below link
This document was generated from the following discussion: Using sprintf, strstr and memset functions in the UART ISR Callback