Open jaygreco opened 9 months ago
The real problem here is that nullbitsco/nibble
is one of the rare boards which uses the QMK UART API (uart.h
), but the uart.c
implementation for ChibiOS supports only the SERIAL
driver, while the RP2040 port provides only the SIO
driver. Because of that problem using a RP2040-based controller currently won't work for that board, unless some option to disable the custom “remote keyboard” code is added. The UART_DRIVER_REQUIRED
change just makes things fail earlier (before that change the compile would fail only on uart.c
).
The proper way to fix things would be to implement support for the SIO
backend in uart.c
, and then adjust the code which handles UART_DRIVER_REQUIRED
to enable either HAL_USE_SERIAL
or HAL_USE_SIO
as appropriate for the MCU (currently that code blindly enables HAL_USE_SERIAL
, which then fails on MCUs which don't have the SERIAL
driver). Alternatively, someone could add a SERIAL
driver for RP2040 to ChibiOS-contrib, so that the existing uart.c
code could be used.
Thanks for the feedback.
Because of that problem using a RP2040-based controller currently won't work for that board
Not strictly true, although I get your point with the current QMK implementation. I have the serial working with the raw SIO driver in a dedicated branch that we use for our CI/precompiled builds. There are a lot of changes in that branch though and I haven't had the gusto to open a PR to get it into upstream QMK.
unless some option to disable the custom “remote keyboard” code is added
That seems enough to add with a preprocessor check and was already have stubbed it out so that the boards compile with the converter in my working branch; happy to explore it further if it's a potential workaround for this.
I'm not necessarily looking to drive changes to QMK on behalf of contributors, but rather interested on feedback as to whether there are any changes or workarounds I can take advantage of on my end.
I have the serial working with the raw SIO driver in a dedicated branch that we use for our CI/precompiled builds.
Code like that is probably not suitable for the upstream QMK as is — it should be moved to platforms/chibios/drivers/uart.c
, so that the UART API would be available for all keyboards.
That seems enough to add with a preprocessor check and was already have stubbed it out so that the boards compile with the converter in my working branch; happy to explore it further if it's a potential workaround for this.
With the current implementation of UART_DRIVER_REQUIRED
the option would need to be at the makefile level (probably post_rules.mk
, because only simple assignments are allowed in rules.mk
) — the UART_DRIVER_REQUIRED = yes
setting would need to be omitted to avoid errors due to this code:
ifeq ($(strip $(UART_DRIVER_REQUIRED)), yes)
OPT_DEFS += -DHAL_USE_SERIAL=TRUE
QUANTUM_LIB_SRC += uart.c
endif
Enabling HAL_USE_SERIAL
if the MCU does not actually support that driver would result in errors. Probably mcu_selection.mk
should set something like CHIBIOS_SERIAL_DRIVER_SUPPORTED = no
for RP2040, and then the code handling UART_DRIVER_REQUIRED
would need to set OPT_DEFS += -DHAL_USE_SIO=TRUE
.
Hey, this issue is affecting me as well. I can't compile qmk for my nullbitsco/snap keyboard because I'm using a Bit-c Pro (which is RP2040-based).
What're the next steps here? It seems like the fundamental issue is that qmk_firmware/platforms/chibios/drivers/uart.{c,h}
need to be re-worked to use HAL_SIO if HAL_SERIAL isn't supported by the underlying MCU. Is that correct? If so, how can I help?
Related to #17744
This should be solved with #22839 being merged to master
?
Whoa, thanks @KarlK90! #22839 is awesome.
The original issue is resolved, but is one step away from working turnkey:
$ qmk compile -kb nullbitsco/nibble -km default -e CONVERT_TO=bit_c_pro
...
Compiling: keyboards/nullbitsco/nibble/matrix.c In file included from ./lib/chibios/os/hal/include/hal_sio.h:158,
from ./lib/chibios/os/hal/include/hal.h:321,
from platforms/chibios/platform_deps.h:18,
from quantum/quantum.h:18,
from keyboards/nullbitsco/nibble/matrix.c:16:
./lib/chibios/os/hal/ports/RP/LLD/UARTv1/hal_sio_lld.h:82:2: error: #error "SIO driver activated but no UART peripheral assigned"
I confirmed changing #define RP_SIO_USE_UART0
to TRUE
in platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h
gets past it. Any thoughts?
Weirdly enough I'm trying to build the firmware for the 0xCB-Helios and I'm getting the same error message:
qmk compile -kb nullbitsco/nibble -km lucasmaffazioli -e CONVERT_TO=helios
Compiling: keyboards/nullbitsco/nibble/matrix.c
In file included from ./lib/chibios/os/hal/include/hal_sio.h:158,
from ./lib/chibios/os/hal/include/hal.h:321,
from platforms/chibios/platform_deps.h:18,
from quantum/quantum.h:18,
from keyboards/nullbitsco/nibble/matrix.c:16:
./lib/chibios/os/hal/ports/RP/LLD/UARTv1/hal_sio_lld.h:82:2: error: #error "SIO driver activated but no UART peripheral assigned"
82 | #error "SIO driver activated but no UART peripheral assigned"
| ^~~~~
[ERRORS]
|
|
|
make: *** [builddefs/common_rules.mk:373: .build/obj_nullbitsco_nibble_lucasmaffazioli/matrix.o] Error 1
Describe the Bug
I'm fixing up the Bit-C PRO RP2040 converters and have run into an issue with
UART_DRIVER_REQUIRED
, which has been introduced in the latest breaking change merge. All extra source included inrules.mk
fail to compile with the following error:Keyboard Used
nullbitsco/nibble
Link to product page (if applicable)
No response
Operating System
Ubuntu 22.04
qmk doctor Output
Is AutoHotKey / Karabiner installed
Other keyboard-related software installed
No response
Additional Context
The converter updates are minor changes to resolve missing LED pins during compilation.