{"id":1347,"date":"2023-09-14T12:13:24","date_gmt":"2023-09-14T11:13:24","guid":{"rendered":"https:\/\/ibex.tech\/embedded\/?p=1347"},"modified":"2023-09-14T12:17:02","modified_gmt":"2023-09-14T11:17:02","slug":"xc8-v1-compiler","status":"publish","type":"post","link":"https:\/\/ibex.tech\/embedded\/microchip\/pic18\/xc8-compiler\/xc8-general\/xc8-v1-compiler","title":{"rendered":"XC8 V1.# Compiler"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Setting a new project<\/h4>\n\n\n\n<p>(After following the <a href=\"\/embedded\/microchip\/pic18\/xc8-compiler\/xc8-general\/new-xc8-project\">steps here<\/a>)<\/p>\n\n\n<p>Project Properties &gt; XC8 global options &gt; XC8 Compiler &gt; Select \u2018Optimizations\u2019<\/p>\n<p style=\"padding-left: 40px;\">Speed (or disable optimizations?) &amp; Debug checkboxes<\/p>\n<p style=\"padding-left: 80px;\">Set as needed (off and on is good for debugging)<\/p>\n<p style=\"padding-left: 40px;\">Address qualifiers \u2013 CAN BE VERY IMPORTANT!!!!<\/p>\n<p style=\"padding-left: 80px;\">If you are using anything that requires locating in specific memory locations set this to \u2018Require\u2019, e.g. variables used in assembler, etc. This is not the default setting as it can cause horribly confusing bugs until you realize it is the cause.<\/p>\n<p style=\"padding-left: 40px;\">Operation mode<\/p>\n<p style=\"padding-left: 80px;\">This is basically the optimization level setting and for debugging you are often going to want it set to \u2018Free\u2019 to effectively disable optimization even if you have a paid for version, so that you can breakpoint and step through code without any problems.<\/p>\n<p>Project Properties &gt; XC8 Global Options &gt; XC8 Linker &gt; Link in peripheral library: Yes (if you are using the old peripheral libraries)<\/p>\n\n\n<h5 class=\"wp-block-heading\">Other things to consider<\/h5>\n\n\n\n<p>You may want to add the C99 typedefs to your project:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/----- STDINT.H TYPE DEFINITIONS -----\n#ifndef uint8_t\ntypedef unsigned char uint8_t;\n#endif\n\n#ifndef int8_t\ntypedef signed char int8_t;\n#endif\n\n#ifndef uint16_t\ntypedef unsigned short uint16_t;\n#endif\n\n#ifndef int16_t\ntypedef signed short int16_t;\n#endif\n\n#ifndef uint32_t\ntypedef unsigned long uint32_t;\n#endif\n\n#ifndef int32_t\ntypedef signed long int32_t;\n#endif<\/code><\/pre>\n\n\n\n<p>See this:&nbsp;<a href=\"https:\/\/ibex.tech\/embedded\/embedded-programming\/microchip-pic\/pic18\/xc8-compiler\/xc8-basic-settings-for-new-projects\">https:\/\/ibex.tech\/embedded\/embedded-programming\/microchip-pic\/pic18\/xc8-compiler\/xc8-basic-settings-for-new-projects<\/a><\/p>\n\n\n\n<p>See this assembler issue here:&nbsp;<a href=\"https:\/\/ibex.tech\/embedded\/embedded-programming\/microchip-pic\/pic18\/xc8-compiler\/assembler-3\">https:\/\/ibex.tech\/embedded\/embedded-programming\/microchip-pic\/pic18\/xc8-compiler\/assembler-3<\/a><\/p>\n\n\n\n<p>See this peripheral libraries issue here:&nbsp;<a href=\"https:\/\/ibex.tech\/embedded\/embedded-programming\/microchip-pic\/pic18\/xc8-compiler\/issues-xc8-compiler\/xc8-peripheral-library-support-is-missing-for-the\">https:\/\/ibex.tech\/embedded\/embedded-programming\/microchip-pic\/pic18\/xc8-compiler\/issues-xc8-compiler\/xc8-peripheral-library-support-is-missing-for-the<\/a><\/p>\n\n\n\n<p>If you get errors for interrupt function formatting etc&nbsp;double check you\u2019ve got XC8 selected for the project and not C18!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting a new project (After following the steps here) Project Properties &gt; XC8 global options &gt; XC8 Compiler &gt; Select \u2018Optimizations\u2019 Speed (or disable optimizations?) &amp; Debug checkboxes Set as needed (off and on is good for debugging) Address qualifiers \u2013 CAN BE VERY IMPORTANT!!!! If you are using anything that requires locating in specific [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80],"tags":[],"class_list":["post-1347","post","type-post","status-publish","format-standard","hentry","category-xc8-general"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1347","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=1347"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1347\/revisions"}],"predecessor-version":[{"id":1352,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1347\/revisions\/1352"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/media?parent=1347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/categories?post=1347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/tags?post=1347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}