|
|||||||||||
Technical Support Support Resources
Product Information |
RTX166 TINY: Using Printf, Sprintf, Scanf, and SscanfInformation in this article applies to:
QUESTIONI have a very simple program that uses Round-Robin task scheduling and the printf function. Sometimes the output from sprintf and printf is corrupted as demonstrated by the following test code.
How can I solve this problem. ANSWERThe RTX166 Tiny README.TXT file found in the \KEIL\C166\RTX_TINY\ folder describes that using pointers to stack-based variables is not safe. The printf, sprintf, scanf, and sscanf library routines (as well as any other routines with variable-length argument lists) use pointers to access the parameters (which are passed on the stack). Since RTX166 may reorganize the stack after a task switch, you see the strange output results that you do. The result is that any function which uses variable-length argument lists (like printf, scanf, and so on) will not work as expected. RESOLUTIONWe recommend that you disable the RTX Tiny Hardware Timer Interrupt for those routines that access the stack via pointer. For example:
Note that this problem does not exist with ARTX-166. So you may want to consider using ARTX-166. MORE INFORMATION
Last Reviewed: Thursday, February 25, 2021 | ||||||||||
|
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.