4.59 Udata_shr Directive

On Baseline and Mid-range devices, the MPASM UDATA_SHR directive creates a section for unbanked objects that are uninitialised.

Suggested Replacement

Use the predefined udata_shr psect or a create a similar psect, ensuring the flags are suitable for a section containing variables on the Baseline or Mid-range device.

The PIC Assembler provides the udata_shr psect once you include <xc.inc>. You can use this psect without having to specify any psect flags, for example:

#include <xc.inc>

PSECT udata_shr
;data goes here
Alternatively, you can define your own psect with any name and suitable psect flags. The psect's space flag must be 1, to indicate that the psect should be positioned in data memory. Typically, you would use the class flag to assign the psect to one of the COMMON linker classes, which is also predefined by the driver, so that the psect will be positioned somewhere in the memory associated with the specified class without you having to specify any linker options. You could also position this psect at a particular address using the linker's -p option, passed to the linker from the driver's -Wl option. For example:
PSECT myData,space=1,class=COMMON
;data goes here