-
-
Notifications
You must be signed in to change notification settings - Fork 40.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flash size suffixes to STM32 MCUs #8179
Conversation
@@ -1,5 +1,5 @@ | |||
# MCU name | |||
MCU = STM32F303 | |||
MCU = STM32F303xB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two PCB's that are otherwise identical, one with an xC and one with an xB. Given supply chain issues for the xC and xB I think we'll see this with other boards in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's ... a mess.
Would it be better to assume the smaller amount, even if that isn't accurate for every board?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On some MCUs, the smaller amount is quite small (64KB). QMK barely fits into that space, and some options have to be turned off to get there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably exacerbated now with @awkannan using APM32's due to supply chain issues of STM32's.
Candybar is x8. |
I can check the planck boards, at the very least. |
@drashna the thing is, as Skully mentioned above with the Clueboard 60, that Jack may have used the xC and xB interchangeably for the OLKB boards, which means it's basically impossible to get an accurate reading for some percentage of them. I guess we have two options here: split those keyboard directories into two further subprojects, for 128kB and 256kB, or leave off the suffix altogether (which in my WIP code will make |
So, tonight I learned that including the suffixes prevents qmk_compiler from doing Configurator builds, because the compiler doesn't recognize the MCU if the suffix is included. The keymap attached to qmk/qmk_configurator#664 is fully valid, but Configurator can't compile it:
qmk_compiler only recognizes the following as valid options for
|
We should change this check to match, then. Something like: if mcu.startswith(ARM_PROCESSORS): ? And I also notice the Arm Teensy |
@skullydazed, thoughts? |
For posterity: Wete: STM32F072CBT6 (source) |
Possible solution for qmk_compiler: #8256
|
fdcbda5
to
5d84c1f
Compare
Thank you for your contribution! |
6175aec
to
94adaf9
Compare
Hello! |
There is actually another issue here — not all MCUs from the same series, but with different flash sizes, are really compatible. One example came up today in Discord: the STM32F303RET7 chip does not work with the firmware built for STM32F303xC (which is what QMK assumes for #pragma once
#include_next "board.h"
#undef STM32F303xC
#define STM32F303xE The main problem in this case is that there are significant differences in the USB controller of STM32F303x[BC] and STM32F303x[DE] chips, and the code compiled for one chip does not work on another. Another series which has significant differences between chips with different flash sizes is STM32F103 — in this case there are 3 posssible variations (medium-density, high-density and XL-density devices; low-density devices have ≤32K flash and can probably be ignored); although in this case the USB implementation seems to be identical, and the main difference is the flash organization and the presence of some additional hardware like DAC or extra timers. Looks like this PR does not attempt to deal with this part of the problem. |
It might be that we need to provide a secondary I think for the reasons you touched upon we should probably be leaning towards providing ldscripts along with however the MCUs get configured, as well as an appropriately-written emulated eeprom driver, such that the ldscripts reserve a portion of the flash for eeprom usage. This will allow for flash sizing guarantees as well, instead of guessing and masquerading as a different part. F4xx's will likely benefit from this as well in future, as they need to have the emulated eeprom situated early in the flash space, purely from the perspective of not wasting 128kB on the last sector. |
For F4xx wasting a 128K sector is not the only problem — if you look at the flash memory characteristics in the datasheet, you will see that for a 128K sector even the best (x32 parallelism) typical erase time is 1 second (and the maximum erase time is then 2 seconds), and these erases will happen during some emulated EEPROM writes. (Erase times for 16K sectors are not the best too — 250 ms typical, 500 ms max). |
I know this isn't the only issue here, but I don't know of any OLKB boards that weren't built with STM32F303CBT7 (128k), and I can't find any BOM where a substitute was specified. And just for posterity, the Proton C used STM32F303CCT6 (256k) in both runs. |
Just to add my experience here, building code with the CC option in mind and flashing it on the CB chip can cause problems. This is because the with the CC code the eeprom emulation is at a region that does NOT exist in the CB chip. TL;DR running CC code on CB chips works, this is just pure luck. |
Description
Prep work for Arm size check support. And it's good to have these documented either way.
Should not affect anything as mcu_selection.mk detects based on
findstring
.Ones marked with, and I'm also unclear whether the Planck and Preonic use the 128kB F303 or the 256kB like the Proton C.x?
I am not sure of and would appreciate anyone with one of those boards to confirmNeeds confirmation:
✅candybar
@TerryMathews✅handwired/ck4x4
@awkannanplanck/ez
@jackhumbertplanck/rev6
preonic/rev3
✅retro_75
@zvecrTypes of Changes
Issues Fixed or Closed by This PR
Checklist