|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: Side-effects of VPRINTF and VSPRINTFInformation in this article applies to:
SYMPTOMSMy application uses the vsprintf function as follows:
The application seems to work fine on real hardware. However, when I use the µVision Simulator, I receive the following error:
What is the reason for this? CAUSEThe simulator has very strong access checking including checks for access outside the real variable space. The vsprintf function copies the argument buffer addressed by arg_ptr to a local buffer. When the variables are copied, vsprintf copies a fixed number of bytes (40 in large model and 15 in small and compact models) which may be more than were actually passed. Since your application uses the reentrant stack, it is likely that arg_ptr addresses the top of the reentrant stack and overflows during the copy process. On typical hardware this has no negative effects. However, if you have I/O buffers in the address range that overflows you might have unpredictable results. RESOLUTIONMake sure that arg_ptr does not underflow into non-existing external memory space or I/O address space. MORE INFORMATION
SEE ALSOLast 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.