Memory allocation in assembler modules

Language reference ›› Procedures and functions ›› External procedures and functions ››
Parent Previous Next

External procedures and functions may have local storage for variables, but since they are not controlled by the compiler, this may generate troubles.

Memory allocation should not be explicitly addressed to avoid memory overlapping with variables generated by the compiler, so it is necessary to use MPLAB® UDATA, UDATA_SHR or UDATA_ACS simple directives without addressing, like this MPLINK® will allocate the storage in areas unused by the compiler; since real address is unknown at writing time, bank is also unknown: banksel pseudo instructions should be used.

The $RESERVED directive may be used to reserve storage that is forbidden to the compiler.

Also the $VARIABLES directive may be used to limit compiler RAM space and manage storage for absolute variables (not recommended).