5.4.3.1 Object Size Limitations
A const
-qualified object cannot be made larger than the
available device memory size, but there can be other restrictions as to how large each
object can be.
For Baseline PIC devices, the maximum size of a single
const
object is 255 bytes. However, you can define as many
const
objects as required provided the total size does not exceed the
available program memory size of the device.
For Mid-range devices, the maximum size of a
const
-qualified object is limited by the available program memory.
For PIC18 devices, the maximum size of a const
-qualified object is limited
by the smaller of the size of the available program memory or 0xFFFF, that is, objects must
be less than 64 KB in size, even if the device implements more than this amount of program
memory. Note, however, that program memory from address 0 up to an address equal to the
highest data memory address is typically not used to hold this data.
In addition to the const
data itself, the compiler might
need to output short routines to access the data in program memory. This additional code is
included only once, regardless of the amount or number of const
-qualified
objects but might further limit the maximum size of a const
object.