{"id":1330,"date":"2023-09-13T12:59:46","date_gmt":"2023-09-13T11:59:46","guid":{"rendered":"https:\/\/ibex.tech\/embedded\/?p=1330"},"modified":"2023-10-03T11:46:57","modified_gmt":"2023-10-03T10:46:57","slug":"new-xc32-project","status":"publish","type":"post","link":"https:\/\/ibex.tech\/embedded\/microchip\/pic32\/xc32\/xc32-general\/new-xc32-project","title":{"rendered":".New XC32 Project"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Use MCC<\/h4>\n\n\n\n<p>Get over it, you have to with V4.# and above XC32, all the old plib.h and config etc functions are completely gone. If you don&#8217;t want it you&#8217;ll have to use V2.# of the XC32 compiler (we skipped V3.#, not sure on that one).<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Create MPLAB X Project<\/h4>\n\n\n\n<p>Run MPLAB X IDE<\/p>\n\n\n\n<p>Menu &gt; File &gt; New Project<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Project Type (Standalone or Harmony)<\/h5>\n\n\n\n<p>Categories: Microchip Embedded<\/p>\n\n\n<p>Projects:<\/p>\n<p>Standalone Project<\/p>\n<p style=\"padding-left: 40px;\">The typical straightforward project choice.<\/p>\n<p style=\"padding-left: 40px;\">(Don&#8217;t use if you are going to be using Harmony libraries, or if only &#8220;MPLAB Harmony&#8221; is available for your device within MCC once you create the project and run MCC the first time &#8211; in this case you MUST create your project as a &#8220;32-bit MCC Harmony Project&#8221;. If you select &#8220;Standalone Project&#8221; and MCC Harmony you&#8217;ll get a confusing corrupt config error when you try and use MCC).<\/p>\n<p>Harmony Project<\/p>\n<p style=\"padding-left: 40px;\">Must be used if you are going to be using Harmony libraries, or if only &#8220;MPLAB Harmony&#8221; is available for your device within MCC once you create the project and run MCC the first time<\/p>\n\n\n<p>Select the device<\/p>\n\n\n\n<p>Select the debugging tool<\/p>\n\n\n\n<p>Select the Compiler to use<\/p>\n\n\n\n<p>Set project name and \u201cSet as main project\u201d<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">MCC<\/h4>\n\n\n\n<p>Use the MPLAB Code Configurator to setup all your peripherals, uC settings etc.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Add Source Code Files<\/h4>\n\n\n\n<p>Add your initial project files to the projects \u201cProjectName.X\u201d directory (not the &#8220;\/firmware\/src\/&#8221; directory that has the main.c in it)<\/p>\n\n\n\n<p>Right click the project &gt; Add Existing Item &gt; Select the files<\/p>\n\n\n\n<p>Drag them into the Header Files and Source File folders.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Setting Up Debug \/ Release Mode<\/h4>\n\n\n\n<p>Old MPLAB allowed you to use this macro in code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>__DEBUG<\/code><\/pre>\n\n\n\n<p>to detect if a debug or release mode was selected. It was just built in, but its not in MPLAB X.<\/p>\n\n\n\n<p>So add this to a global header file when debugging:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n#ifndef __DEBUG\n\t#define __DEBUG\t\t\t\t\t\t\/\/&lt;&lt;&lt;&lt;&lt; COMMENT OUT FOR RELEASE\n#endif\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Compiler Settings<\/h4>\n\n\n\n<p><em><strong>IMPORTANT \u2013 ENSURE YOU CHECK THE BASIC COMPILER SETUP OPTIONS TO HELP ENSURE YOU DON\u2019T GET CAUGHT UP IN STUPID BUGS<\/strong><\/em><\/p>\n\n\n\n<p>Right click project &gt; Project Properties &gt; Conf &gt; XC32 &gt; xc32-gcc<\/p>\n\n\n<p>Check these settings in particular:<\/p>\n<p style=\"padding-left: 40px;\">Right click project &gt; Project Properties &gt; Conf &gt; XC32 &gt; xc32-gcc &gt; Preprocessing and messages &gt; Make warnings into errors = No<\/p>\n<p style=\"padding-left: 40px;\">Right click project &gt; Project Properties &gt; Conf &gt; XC32 &gt; xc32-gcc &gt; Optimization &gt; optimization-level: 0 &lt;&lt;&lt;For simple degugging<\/p>\n\n\n<h4 class=\"wp-block-heading\">MCC Config<\/h4>\n\n\n\n<p>Make sure you use the MCC clock setup to configure clock source, speed etc. <a href=\"\/embedded\/microchip\/pic32\/xc32\/xc32-general\/system-clocks-config\" data-type=\"link\" data-id=\"https:\/\/ibex.tech\/embedded\/microchip\/pic32\/xc32\/xc32-general\/system-clocks-config\" target=\"_blank\" rel=\"noreferrer noopener\">See here<\/a>.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use MCC Get over it, you have to with V4.# and above XC32, all the old plib.h and config etc functions are completely gone. If you don&#8217;t want it you&#8217;ll have to use V2.# of the XC32 compiler (we skipped V3.#, not sure on that one). Create MPLAB X Project Run MPLAB X IDE Menu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106],"tags":[],"class_list":["post-1330","post","type-post","status-publish","format-standard","hentry","category-xc32-general"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1330","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=1330"}],"version-history":[{"count":13,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1330\/revisions"}],"predecessor-version":[{"id":1493,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1330\/revisions\/1493"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/media?parent=1330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/categories?post=1330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/tags?post=1330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}