Try this:
In hal_sleep.c:
/* The instruction after the PCON instruction must not be 4-byte aligned. * The following code may cause excessive power consumption if not properly aligned. * See linker file ".xcl" for actual placement. */ #pragma location = "ALIGNED_CODE" void halSleepExec(void);
in the linker .xcl file:
-Z(CODE)ALIGNED_CODE|2=_CODE_BEG-_CODE_END,_BANK1_BEG-_BANK1_END,_BANK2_BEG-_BANK2_END
-P(CODE)BANKED_CODE=_CODE_BEG-_CODE_END,_BANK1_BEG-_BANK1_END,_BANK2_BEG-_BANK2_END