Cx51 Variable-length Argument List Size

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero Employee</font></font> </a> Jiehui on ‎10-09-2017 03:31 AM

Question

How to can I change the number of bytes reserved for function with a variable-length argument list when using 8-bit MCUs with Cx51?

Answer

By default, the C51 compiler reserves 15 bytes for passing arguments to functions with variable-length argument list for SMALL and COMPACT memory model, and 40 bytes for LARGER memory model.

 

User can use the MAXARGS(n) compiler directive to change the number of bytes reserved.

 

To do this in Simplicity IDE, here as an example, if 24 bytes is required for the variable-length argument list, you can use the MAXARGS(24) for the Keil 8051 Compiler setting as the picture below showing, and then re-build the project again.

 

Cx51_MAXARGS.png

 

For more information on Cx51 Variable Length Argument Routines, please click here.