{"id":486,"date":"2014-08-05T20:28:54","date_gmt":"2014-08-05T20:28:54","guid":{"rendered":"https:\/\/ibex.tech\/embedded\/?p=486"},"modified":"2022-02-18T15:37:49","modified_gmt":"2022-02-18T15:37:49","slug":"large-data-arrays","status":"publish","type":"post","link":"https:\/\/ibex.tech\/embedded\/microchip\/pic24\/xc16\/memory-data\/large-data-arrays","title":{"rendered":"Large Data Arrays"},"content":{"rendered":"<p>\nXC16 can accept up to 8k of data in near memory. &nbsp;Above that you can use compiler options to allow for larger memory access of specify individual arrays for far memory using the far attribute.\n<\/p>\n<h4>\nfar Attribute to locate large arrays in far memory<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nBYTE edid_emulation_buffer[16384] __attribute__ ((far));\r\nextern BYTE edid_emulation_buffer[16384] __attribute__ ((far));\r\n<\/code><\/pre>\n<h4>\neds Attribute (when far doesn&#39;t work)<br \/>\n<\/h4>\n<p>\nUsing far with a PIC24FJ256GB206 and 32k of arrays we got the error: &quot;Link Error: Could not allocate section .bss, size = 32768 bytes, attributes = bss &quot;. &nbsp;The device has 96k of ram and the error message implied the compiler was simply faulty. However using the eds attribute solved it.\n<\/p>\n<p>\nUse eds to specify&nbsp;Extended Data Space Access\n<\/p>\n<pre>\r\n<code>\r\n__eds__ BYTE my_big_emulation_buffer[16384] __attribute__ ((eds));\r\n__eds__ extern BYTE my_big_emulation_buffer[16384] __attribute__ ((eds));\r\n<\/code><\/pre>\n<p>\nTo read and write within the array don&#39;t use a pointer and instead just use an index value:\n<\/p>\n<pre>\r\n<code>\r\nmy_big_emulation_buffer[some_index_variable] = 0x11;\r\n<\/code><\/pre>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>XC16 can accept up to 8k of data in near memory. &nbsp;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[],"class_list":["post-486","post","type-post","status-publish","format-standard","hentry","category-memory-data"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/comments?post=486"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/486\/revisions"}],"predecessor-version":[{"id":491,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/486\/revisions\/491"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/media?parent=486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/categories?post=486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/tags?post=486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}