qmk_firmware/assets/other_eclipse.md.C-zqyJO9.js

16 lines
9.9 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js";
const __pageData = JSON.parse('{"title":"Setting up Eclipse for QMK Development","description":"","frontmatter":{},"headers":[],"relativePath":"other_eclipse.md","filePath":"other_eclipse.md"}');
const _sfc_main = { name: "other_eclipse.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="setting-up-eclipse-for-qmk-development" tabindex="-1">Setting up Eclipse for QMK Development <a class="header-anchor" href="#setting-up-eclipse-for-qmk-development" aria-label="Permalink to &quot;Setting up Eclipse for QMK Development&quot;"></a></h1><p><a href="https://en.wikipedia.org/wiki/Eclipse_(software)" target="_blank" rel="noreferrer">Eclipse</a> is an open-source <a href="https://en.wikipedia.org/wiki/Integrated_development_environment" target="_blank" rel="noreferrer">Integrated Development Environment</a> (IDE) widely used for Java development, but with an extensible plugin system that allows to customize it for other languages and usages.</p><p>Using an IDE such as Eclipse provides many advantages over a plain text editor, such as:</p><ul><li>intelligent code completion</li><li>convenient navigation in the code</li><li>refactoring tools</li><li>build automation (no need for the command-line)</li><li>a GUI for GIT</li><li>static code analysis</li><li>many other tools such as debugging, code formatting, showing call hierarchies etc.</li></ul><p>The purpose of this page is to document how to set-up Eclipse for developing AVR software, and working on the QMK code base.</p><p>Note that this set-up has been tested on Ubuntu 16.04 only for the moment.</p><h1 id="prerequisites" tabindex="-1">Prerequisites <a class="header-anchor" href="#prerequisites" aria-label="Permalink to &quot;Prerequisites&quot;"></a></h1><h2 id="build-environment" tabindex="-1">Build Environment <a class="header-anchor" href="#build-environment" aria-label="Permalink to &quot;Build Environment&quot;"></a></h2><p>Before starting, you must have followed the <a href="./newbs_getting_started">Getting Started</a> section of the Tutorial. In particular, you must have been able to build the firmware with <a href="./newbs_building_firmware#build-your-firmware">the <code>qmk compile</code> command</a>.</p><h2 id="java" tabindex="-1">Java <a class="header-anchor" href="#java" aria-label="Permalink to &quot;Java&quot;"></a></h2><p>Eclipse is a Java application, so you will need to install Java 8 or more recent to be able to run it. You may choose between the JRE or the JDK, the latter being useful if you intend to do Java development.</p><h1 id="install-eclipse-and-its-plugins" tabindex="-1">Install Eclipse and Its Plugins <a class="header-anchor" href="#install-eclipse-and-its-plugins" aria-label="Permalink to &quot;Install Eclipse and Its Plugins&quot;"></a></h1><p>Eclipse comes in <a href="https://www.eclipse.org/downloads/eclipse-packages/" target="_blank" rel="noreferrer">several flavours</a> depending on the target usage that you will have. There is no package comprising the AVR stack, so we will need to start from Eclipse CDT (C/C++ Development Tooling) and install the necessary plugins.</p><h2 id="download-and-install-eclipse-cdt" tabindex="-1">Download and Install Eclipse CDT <a class="header-anchor" href="#download-and-install-eclipse-cdt" aria-label="Permalink to &quot;Download and Install Eclipse CDT&quot;"></a></h2><p>If you already have Eclipse CDT on your system, you can skip this step. However it is advised to keep it up-to-date for better support.</p><p>If you have another Eclipse package installed, it is normally possible to <a href="https://eclipse.org/cdt/downloads.php" target="_blank" rel="noreferrer">install the CDT plugin over it</a>. However it is probably better to reinstall it from scratch to keep it light and avoid the clutter of tools that you don&#39;t need for the projects you will be working on.</p><p>Installation is very simple: follow the <a href="https://eclipse.org/downloads/eclipse-packages/?show_instructions=TRUE" target="_blank" rel="noreferrer">5 Steps to Install Eclipse</a>, and choose <strong>Eclipse IDE for C/C++ Developers</strong> at Step 3.</p><p>Alternatively, you can also directly <a href="https://www.eclipse.org/downloads/eclipse-packages/" target="_blank" rel="noreferrer">download Eclipse IDE for C/C++ Developers</a> (<a href="https://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/neonr" target="_blank" rel="noreferrer">direct link to current version</a>) and extract the package to the location of your choice (this creates an <code>eclipse</code> folder).</p><h2 id="first-launch" tabindex="-1">First Launch <a class="header-anchor" href="#first-launch" aria-label="Permalink to &quot;First Launch&quot;"></a></h2><p>When installation is complete, click the <kbd>Launch</kbd> button. (If you extracted the package manually, open the Eclipse installation folder and double-click the <code>eclipse</code> executable)</p><p>When you are prompted with the Workspace Selector, select a directory that will hold Eclipse metadata and usually your projects. <strong>Do not select the <code>qmk_firmware</code> directory</strong>, this will be the project directory. Select the parent folder instead, or another (preferably empty) folder of your choice (the default is fine if you do not use it yet).</p><p>Once started, click the <kbd>Workbench</kbd> button at the top right to switch to the workbench view (there is a also checkbox at the bottom to skip the welcome screen at startup).</p><h2 id="install-the-necessary-plugins" tabindex="-1">Install the Necessary Plugins <a class="header-anchor" href="#install-the-necessary-plugins" aria-label="Permalink to &quot;Install the Necessary Plugins&quot;"></a></h2><p>Note: you do not need to restart Eclipse after installing each plugin. Simply restart once all plugins are installed.</p><h3 id="the-avr-plugin" tabindex="-1"><a href="https://avr-eclipse.sourceforge.net/" target="_blank" rel="noreferrer">The AVR Plugin</a> <a class="header-anchor" href="#the-avr-plugin" aria-label="Permalink to &quot;[The AVR Plugin](https://avr-eclipse.sourceforge.net/)&quot;"></a></h3><p>This is the most important plugin as it will allow Eclipse to <em>understand</em> AVR C code. Follow <a href="https://avr-eclipse.sourceforge.net/wiki/index.php/Plugin_Download#Update_Site" target="_blank" rel="noreferrer">the instructions for using the update site</a>, and agree with the security warning for unsigned content.</p><h3 id="ansi-escape-in-console" tabindex="-1"><a href="https://marketplace.eclipse.org/content/ansi-escape-console" target="_blank" rel="noreferrer">ANSI Escape in Console</a> <a class="header-anchor" href="#ansi-escape-in-console" aria-label="Permalink to &quot;[ANSI Escape in Console](https://marketplace.eclipse.org/content/ansi-escape-console)&quot;"></a></h3><p>This plugin is necessary to properly display the colored build output generated by the QMK makefile.</p><ol><li>Open <kbd>Help</kbd> &gt; <kbd>Eclipse Marketplace…</kbd></li><li>Search for <em>ANSI Escape in Console</em></li><li>Click the <samp>Install</samp> button of the plugin</li><li>Follow the instructions and agree again with the security warning for unsigned content.</li></ol><p>Once both plugins are installed, restart Eclipse as prompted.</p><h1 id="configure-eclipse-for-qmk" tabindex="-1">Configure Eclipse for QMK <a class="header-anchor" href="#configure-eclipse-for-qmk" aria-label="Permalink to &quot;Configure Eclipse for QMK&quot;"></a></h1><h2 id="importing-the-project" tabindex="-1">Importing the Project <a class="header-anchor" href="#importing-the-project" aria-label="Permalink to &quot;Importing the Project&quot;"></a></h2><ol><li>Click <kbd>File</kbd> &gt; <kbd>New</kbd> &gt; <kbd>Makefile Project with Existing Code</kbd></li><li>On the next screen:</li></ol><ul><li>Select the directory where you cloned the repository as <em>Existing Code Location</em>;</li><li>(Optional) Give a different name to the project¹, e.g. <em>QMK</em> or <em>Quantum</em>;</li><li>Select the <em>AVR-GCC Toolchain</em>;</li><li>Keep the rest as-is and click <kbd>Finish</kbd></li></ul><p><img src="https://i.imgur.com/oHYR1yW.png" alt="Importing QMK in Eclipse"></p><ol start="3"><li>The project will now be loaded and indexed. Its files can be browsed easily through the <em>Project Explorer</em> on the left.</li></ol><p>¹ There might be issues for importing the project with a custom name. If it does not work properly, try leaving the default project name (i.e. the name of the directory, probably <code>qmk_firmware</code>).</p><h2 id="build-your-keyboard" tabindex="-1">Build Your Keyboard <a class="header-anchor" href="#build-your-keyboard" aria-label="Permalink to &quot;Build Your Keyboard&quot;"></a></h2><p>We will now change the default make target of the project from <code>all</code> to the specific keyboard and keymap combination we are working on, e.g. <code>kinesis/kint36:stapelberg</code>. This way, project-wide actions like cleaning and building the project will complete quickly, instead of taking a long time or outright locking up Eclipse.</p><ol><li>Focus an editor tab within the project</li><li>Open the <code>Project</code> &gt; <code>Properties</code> window, then select the <code>C/C++ Build</code> list entry and switch to the <code>Behavior</code> tab.</li><li>Change the default <code>Make build target</code> text fields for all enabled builds from <code>all</code> to e.g. <code>kinesis/kint41:stapelberg</code>.</li><li>Verify your setup works by selecting <code>Project</code> &gt; <code>Clean...</code>.</li></ol>', 40);
const _hoisted_41 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_41);
}
const other_eclipse = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
other_eclipse as default
};