qmk_firmware icon indicating copy to clipboard operation
qmk_firmware copied to clipboard

Add minimal STM32F103C6 support

Open sigprof opened this issue 2 years ago • 0 comments

Description

Unfortunately, the crippled versions of “Bluepill” boards with STM32F103C6xx chips instead of STM32F103C8xx are now sold all over the place, sometimes advertised in a confusing way to make the difference not noticeable until too late. Add minimal support for these MCUs in the common “Bluepill with stm32duino” configuration, so that it could be possible to make something useful from those boards (although fitting QMK into the available 24 KiB of flash may be rather hard).

(In fact, I'm not sure whether the “STM32” part of the chip name is actually correct for those boards of uncertain origin, so the onekey board name is bluepill_f103c6; another reason for that name is to match the existing blackpill_f401 and blackpill_f411.)

The EEPROM emulation support is not included on purpose, because enabling it without having a working firmware size check would be irresponsible with such flash size (the chance that someone would build a firmware where the EEPROM backing store ends up overlapping some firmware code is really high). Other than that, enabling the EEPROM emulation code is mostly trivial (the wear_leveling driver with the embedded_flash backing store even works without any custom configuration, although its code is significantly larger than the vendor driver, which may also be important for such flash size).

Tested onekey keymaps:

  • default
  • adc (needs changes in halconf.h and mcuconf.h to enable ADC)
  • backlight
  • console
  • digitizer (seems to send some events visible in sudo evtest)
  • eep_rst (with EEPROM_DRIVER=transient this just restarts the firmware)
  • hardware_id
  • oled (needs changes in halconf.h and mcuconf.h to enable I2C)
  • quine
  • reboot (works appropriately with stm32duino — the bootloader does not appear during the reboot)
  • reset (works appropriately with stm32duino — the bootloader starts with the 8s timeout disabled)
  • rgb
  • rgb_matrix (needs -e RGB_MATRIX_DRIVER=WS2812 -e CONSOLE_ENABLE=no)

Types of Changes

  • [x] Core
  • [ ] Bugfix
  • [ ] New feature
  • [x] Enhancement/optimization
  • [x] Keyboard (addition or update)
  • [ ] Keymap/layout/userspace (addition or update)
  • [ ] Documentation

Issues Fixed or Closed by This PR

  • #15297
  • #16908
  • #17689

Checklist

  • [x] My code follows the code style of this project: C, Python
  • [x] I have read the PR Checklist document and have made the appropriate changes.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [x] I have tested the changes and verified that they work and don't break anything (as well as I can manage).

sigprof avatar Jul 30 '22 18:07 sigprof