qmk_firmware icon indicating copy to clipboard operation
qmk_firmware copied to clipboard

smt32 F103 failed to flash qmk

Open jeromeli002 opened this issue 2 years ago • 4 comments

https://github.com/rogerclarkmelbourne/STM32duino-bootloader/blob/master/bootloader_only_binaries/generic_boot20_pc13.bin image image image The first time I used stm32f103, I flashed the bootloader provided in qmk, and the device displayed maple003, but I couldn't flash the qmk firmware. Is there any modification?

jeromeli002 avatar Jul 15 '22 05:07 jeromeli002

Apparently the flashing tool detected “Target: STM32F1_Low-density_32K”, which means that you have the STM32F103x6 chip (or maybe even some non-ST clone of that chip) with only 32K flash. The stm32duino bootloader reserves 8K for itself, leaving only 24K (24576 bytes) for the firmware, but apparently your firmware is larger than that, therefore the flashing process fails after crossing the 24K boundary.

If you really want to use this chip, you would need to get the firmware size down, probably by disabling some features; but you may end up wasting a lot of time on it without getting a usable result in the end. Note that the support for STM32F103x6 chips may not be 100% functional in current QMK versions (e.g., see #15297). Although the ChibiOS fix for USB support should be included now, the EEPROM emulation code would probably need to be turned off (EEPROM_DRIVER = transient); it could be possible to reconfigure it, but then the usable amount of flash will decrease even more. Also the firmware size check for STM32 chips does not take the emulated EEPROM area into account yet, so you may get firmware corruption when the emulated EEPROM overwrites a part of firmware code.

sigprof avatar Jul 15 '22 08:07 sigprof

How about extended flash, say, W25Q128. Does that possibly work?

myst729 avatar Jul 22 '22 01:07 myst729

No, this is not RP2040 — STM32F103 cannot run code directly from an external flash chip.

(Well, maybe some STM32 chips can do that using the FSMC peripheral, but it supports only flash chips with a parallel interface, and is present only in larger package variants (>= 100 pins) with lots of internal flash; it's also many times slower than the internal flash.)

sigprof avatar Jul 22 '22 05:07 sigprof

Can you test the STM32F103C6 support code from #17853?

Note that you need to use at least board.h and the bootloader-related section of rules.mk from the handwired/onekey/bluepill_f103c6 keyboard in your custom code, because the bootloader parameters also specify MCU_LDSCRIPT = STM32F103x6_stm32duino_bootloader. Also use EEPROM_DRIVER = transient for now, because the proper firmware size check which takes the EEPROM backing store into account is not implemented yet, and with only 24 KiB of flash available for QMK it would be easy to get the backing store overlapping the firmware code.

sigprof avatar Jul 30 '22 18:07 sigprof

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs. For maintainers: Please label with bug, in progress, on hold, discussion or to do to prevent the issue from being re-flagged.

github-actions[bot] avatar Jan 22 '23 02:01 github-actions[bot]

This issue has been automatically closed because it has not had activity in the last 30 days. If this issue is still valid, re-open the issue and let us know. // [stale-action-closed]

github-actions[bot] avatar Feb 21 '23 02:02 github-actions[bot]