I have troubles with const memory allocation with XC8. I try to do this:
const unsigned char patterns[12] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
};
but I get this error: "can't find 0xC words (0xc withtotal) for psect "stringtext" in class "STRCODE" (largest unused contiguous range 0x57)". That's strange because space needed is less than space available (contiguous). In the user guide:
http://ww1.microchip.com/downloads/en/DeviceDoc/MPLAB_XC8_C_Compiler_User_Guide.pdf
I read that
stringtext psect must be linked within the first half of each program memory page
I'm not quite sure why. I guess the compiler fills all the first halves before trying to find space for constants. Can anyway advice me how to give a hint to the compiler where to locate the constants section? Or Is there any other way to workaround this problem.
I'm using MPLAB because I find it difficult to use MPLAB X.
P.S. Keep in mind that the ROM is almost full - only 0x57 bytes left. It's well fragmented in small sections in order to fit better.