-
-
Notifications
You must be signed in to change notification settings - Fork 40k
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
[Core] Add support for RISC-V builds and GD32VF103 MCU #12508
Conversation
Thank you for your contribution! |
b071d07
to
44e7d22
Compare
@tzarc this is ready for review now 🥳 |
Oh yes there is one thing: For ChibiOS ARM builds GCC is currently set to align functions to 16 Byte boundaries with
But none of the supported ARM MCUs has 16-bytes lines, M7 afaik have 32-byte boundaries if they have cache at all. Do I miss anything? In conclusion I just dropped that flag. |
I have opened a issue at Nuclei-Software/nuclei-sdk#29 to see if it is possible at all to jump to the embedded bootloader. |
After some further investigation I'm pretty confident that it is not possible to jump to the bootloader from user code, because the bootloader wasn't written in a position independent way. See Nuclei-Software/nuclei-sdk#29 (comment) for further details. That leaves us with two possibilities:
I tried the dual bank reset hardware circuit on a YAEMK prototyp that has the same that is also found on the djinn. And it doesn't work for this chip. It resets but doesn't enter the bootloader and it generally just stuck until you reset it. BOOT0 is pulled high for at least 300ms with a 1uF capacitor. Doesn't matter if it is done by pushing the dfu button or with the charge pin mechanism. So the 2nd option is what we have left, because the bootloader is a buggy mess. |
friendly ping 🙂 |
Got some merge conflict. |
ca91cfd
to
3f81d02
Compare
Resolved. |
All pending chibios-contrib prs have been merged, I will resolve the conflicts. |
f88710f
to
92239cc
Compare
// GD32 compatibility | ||
#if defined(MCU_GD) | ||
# define CPU_CLOCK GD32_SYSCLK | ||
#endif | ||
|
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.
927452e
to
fd69f31
Compare
common_features.mk
Outdated
@@ -161,7 +161,7 @@ else | |||
SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c | |||
OPT_DEFS += -DEEPROM_EMU_STM32F303xC | |||
OPT_DEFS += -DSTM32_EEPROM_ENABLE | |||
else ifeq ($(MCU_SERIES), STM32F1xx) | |||
else ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),STM32F1xx GD32VF103)) |
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.
else ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),STM32F1xx GD32VF103)) | |
else ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),STM32F1xx GD32VF103)) # Despite being RISC-V, GD32VF103 effectively clones the peripherals of an equivalent STM32F103 |
docs/driver_installation_zadig.md
Outdated
@@ -93,6 +93,7 @@ The device name here is the name that appears in Zadig, and may not be what the | |||
|`usbasploader`|USBasp |`16C0:05DC` |libusbK| | |||
|`apm32-dfu` |APM32 DFU ISP Mode |`314B:0106` |WinUSB | | |||
|`stm32-dfu` |STM32 BOOTLOADER |`0483:DF11` |WinUSB | | |||
|`gd32-dfu` |GD32 BOOTLOADER |`28E9:0189` |WinUSB | |
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.
|`gd32-dfu` |GD32 BOOTLOADER |`28E9:0189` |WinUSB | | |
|`gd32v-dfu` |GD32V BOOTLOADER |`28E9:0189` |WinUSB | |
bd72990
to
5d70e19
Compare
@tzarc Thanks for the review! Applied suggested changes. |
5d70e19
to
e140749
Compare
* Add toolchain selection in chibios.mk based on the mcu selected in mcu_selection.mk * Reorder and added comments to chibios.mk to have a streamlined makefile * Add GD32VF103 mcu to possible targets for QMK. * Add STM32 compatibility for GD32VF103 MCU, this is hacky but more efficent then rewriting every driver. * Add GigaDevice DFU bootloader as flash target, please note that dfu-util of at least version 0.10 is needed. * Add analog driver compatibility * Add apa102 bitbang driver compatibility * Add ws2812 bitbang driver compatibility * Add eeprom in flash emulation compatibility * Allow faster re-builds with ccache
e140749
to
f0b8fc6
Compare
Rebased on develop, so friendly ping. 🙂 |
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.
__attribute__((weak))
✅
Cheers everyone! 🎉 |
* qmk/develop: (26 commits) [DOCS] Fix the STENO_COMBINEDMAP table (qmk#14883) Fix builds for ChibiOS + Cortex-M0[+] (qmk#14879) Split out HAPTIC_ENABLE to have separate DRIVER option (qmk#14854) [Core] Add support for RISC-V builds and GD32VF103 MCU (qmk#12508) Add HT32 support to core (qmk#14388) preonic/rev3_drop: Fix old custom matrix code (qmk#14857) Remove legacy Makefile functionality (qmk#14858) Infer more when building features (qmk#13890) [Keymap] added media controls, copy and paste; moved print screen (qmk#14850) [Keyboard] Add SpiderIsland 25 key keyboard (qmk#14793) [Keyboard] Update Support for The Uni (qmk#14569) Try to clarify "number of elements in info.json does not match" error (qmk#14844) [Keyboard] Fix minor typo in Ploopy Trackball Nano Docs (qmk#14717) add docs/ja/ja_doc_status.sh (qmk#14402) [Keyboard] Amended Some Pins - KiwiKeebs Macro V2 (qmk#14824) [Keyboard] Adding CK60 and CK65 (qmk#14737) [Keymap] Update Miryoku (qmk#14827) [Keymap] Drashna Keymap Updates (qmk#14842) [Keyboard] Tractyl Manuform Updates (qmk#14841) [Keymap] Added GMMK Pro keymap with RGB (qmk#14648) ...
* Add support for RISC-V builds and GD32VF103 MCU * Add toolchain selection in chibios.mk based on the mcu selected in mcu_selection.mk * Reorder and added comments to chibios.mk to have a streamlined makefile * Add GD32VF103 mcu to possible targets for QMK. * Add STM32 compatibility for GD32VF103 MCU, this is hacky but more efficent then rewriting every driver. * Add GigaDevice DFU bootloader as flash target, please note that dfu-util of at least version 0.10 is needed. * Add analog driver compatibility * Add apa102 bitbang driver compatibility * Add ws2812 bitbang driver compatibility * Add eeprom in flash emulation compatibility * Allow faster re-builds with ccache * Add SiPeed Longan Nano to platform files * Add SiPeed Longan Nano Onekeys * Make quine compatible with other bootloaders * Support builds with picolibc * Add risc-v toolchain to arch and debian/ubuntu scripts
* Add support for RISC-V builds and GD32VF103 MCU * Add toolchain selection in chibios.mk based on the mcu selected in mcu_selection.mk * Reorder and added comments to chibios.mk to have a streamlined makefile * Add GD32VF103 mcu to possible targets for QMK. * Add STM32 compatibility for GD32VF103 MCU, this is hacky but more efficent then rewriting every driver. * Add GigaDevice DFU bootloader as flash target, please note that dfu-util of at least version 0.10 is needed. * Add analog driver compatibility * Add apa102 bitbang driver compatibility * Add ws2812 bitbang driver compatibility * Add eeprom in flash emulation compatibility * Allow faster re-builds with ccache * Add SiPeed Longan Nano to platform files * Add SiPeed Longan Nano Onekeys * Make quine compatible with other bootloaders * Support builds with picolibc * Add risc-v toolchain to arch and debian/ubuntu scripts
Description
My port of the GD32VF103 has finally been merged into ChibiOS-Contrib so this PR adds support for this MCU and RISC-V in general. 🥳
The targeted toolchain is riscv64-unknown-elf or riscv32-unknown-elf. embecosm provides pre-built GCC toolchains for every OS. Also Debian 11 and Ubuntu 21.04 have support for building via
picolibc-riscv64-unknown-elf gcc-riscv64-unknown-elf binutils-riscv64-unknown-elf
.Example rules.mk config:
Types of Changes
Checklist