qmk / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
18.09k stars 38.89k forks source link

Do I need to worry about the size of the Moonlander firmware? #16308

Closed jmdesprez closed 2 years ago

jmdesprez commented 2 years ago

Hello,

My apologies if this is in the wrong place to ask but I've some consideration regarding the size of my Moonlander firmware.

The documentation indicates that "Too large a .hex file is trouble" Also, It's not currently possible to do a firmware size check for the ARM firmware

As I added a lot of things in the Moonlander firmware, it has "grown a lot", from 52716 (the default) to 87504 (current size). Actually, as I'm pretty new to all of this, I've no idea if a size like this is normal or way too large.

Those links seems to indicate that "everything should be fine":

But I'm still very concerned regarding this question as I don't want to make a huge mistake. Maybe I've added too much things to the firmware and I should cut some feature to avoid problems in the future? Or is the available size so large that I really don't have to worry about a "too large firmware" error?

Thanks

tzarc commented 2 years ago

No, you don't. The Moonlander has enough space for a 256kB firmware and the bootloader cannot be overwritten.

The issues you point to are purely related to AVR-based boards and their use of "unsafe" bootloaders that are capable of destructively overwriting themselves.

We aren't aware of any supported ARM bootloaders that are capable of overwriting bootloaders, as the vast majority of ARM-based MCUs have their bootloaders in silicon on the die of the chip itself -- they literally can't be overwritten.

For that reason it hasn't really been a priority to work out the size checks for ARM -- if it's too large, it purely won't flash.

You've identified an area where the docs could do with a bit of clarification, though -- we'll see what we can do about rewording it so that it's not so dire.

jmdesprez commented 2 years ago

Thank you very much for this crystal clear answer :+1:

drashna commented 2 years ago

just to add my 2 cents here...

tzarc is spot on, per usual.

Also, the moonlander as an integrated i2c eeprom chip, so it doesn't use the emulated eeprom option that the STM32F303 controller would normal use. So that's full 256kb of firmware space that it can use.

Additionally:

text data bss dec hex filename 0 123432 0 123432 1e228 moonlander_drashna.bin

that's with a BUNCH of larger features (such as autocorrect) enabled on the board. You have a LOT of room to play with.

jmdesprez commented 2 years ago

Thanks for the clarification. I am really reassured, I understand better the fact that there are no worries about firmware too large :) There are a lot of things that I will be able to test!