XC16 can accept up to 8k of data in near memory.  Above that you can use compiler options to allow for larger memory access of specify individual arrays for far memory using the far attribute.

far Attribute to locate large arrays in far memory


BYTE edid_emulation_buffer[16384] __attribute__ ((far));
extern BYTE edid_emulation_buffer[16384] __attribute__ ((far));

eds Attribute (when far doesn't work)

Using far with a PIC24FJ256GB206 and 32k of arrays we got the error: "Link Error: Could not allocate section .bss, size = 32768 bytes, attributes = bss ".  The device has 96k of ram and the error message implied the compiler was simply faulty. However using the eds attribute solved it.

Use eds to specify Extended Data Space Access


__eds__ BYTE my_big_emulation_buffer[16384] __attribute__ ((eds));
__eds__ extern BYTE my_big_emulation_buffer[16384] __attribute__ ((eds));

To read and write within the array don't use a pointer and instead just use an index value:


my_big_emulation_buffer[some_index_variable] = 0x11;

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *