qmk_firmware/assets/squeezing_avr.md.BmcLYKOr.js

16 lines
34 KiB
JavaScript
Raw Normal View History

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js";
const __pageData = JSON.parse('{"title":"Squeezing the most out of AVR","description":"","frontmatter":{},"headers":[],"relativePath":"squeezing_avr.md","filePath":"squeezing_avr.md"}');
const _sfc_main = { name: "squeezing_avr.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="squeezing-the-most-out-of-avr" tabindex="-1">Squeezing the most out of AVR <a class="header-anchor" href="#squeezing-the-most-out-of-avr" aria-label="Permalink to &quot;Squeezing the most out of AVR&quot;"></a></h1><p>AVR is severely resource-constrained, and as QMK continues to grow, it is approaching a point where support for AVR may need to be moved to legacy status as newer development is unable to fit into those constraints.</p><p>However, if you need to reduce the compiled size of your firmware to fit the controller&#39;s limited flash size, there are a number of options to do so.</p><h2 id="rules-mk-settings" tabindex="-1"><code>rules.mk</code> Settings <a class="header-anchor" href="#rules-mk-settings" aria-label="Permalink to &quot;`rules.mk` Settings&quot;"></a></h2><p>First and foremost is enabling link time optimization. To do so, add this to your rules.mk:</p><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">LTO_ENABLE = yes</span></span></code></pre></div><p>This will cause the final step to take longer, but should get you a smaller compiled size. This also disables Action Functions, and Action Macros, both of which are deprecated. This will get you the most savings, in most situations.</p><p>From there, disabling extraneous systems will help -- e.g.:</p><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CONSOLE_ENABLE = no</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">COMMAND_ENABLE = no</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">MOUSEKEY_ENABLE = no</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">EXTRAKEY_ENABLE = no</span></span></code></pre></div><p>This disables some of the functionality that you may not need. But note that extrakeys disables stuff like the media keys and system volume control.</p><p>If that isn&#39;t enough to get your firmware down to size, then there are some additional features that you can disable:</p><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">SPACE_CADET_ENABLE = no</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">GRAVE_ESC_ENABLE = no </span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">MAGIC_ENABLE = no</span></span></code></pre></div><p>These features are enabled by default, but they may not be needed. Double check to make sure. The <a href="./keycodes_magic">Magic Keycodes</a> are the largest and control things like NKRO toggling, GUI and ALT/CTRL swapping, etc. Disabling them will disable those functions. See <a href="#magic-functions">Magic Functions</a> for disabling related functions.</p><p>If you use <code>sprintf</code> or <code>snprintf</code> functions you can save around ~400 Bytes by enabling this option.</p><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">AVR_USE_MINIMAL_PRINTF = yes</span></span></code></pre></div><p>This will include smaller implementations from AVRs libc into your Firmware. They are <a href="https://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html#gaa3b98c0d17b35642c0f3e464909
const _hoisted_65 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_65);
}
const squeezing_avr = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
squeezing_avr as default
};