instead of posting to Discord I rather post here as this seems better suited for longer posts.
To get to the point: I advocate baseing further development stronger on the offical pico-sdk's "Hardware Structs Library" and "Hardware Registers Library" instead on the offical or our own CMSIS header files. At the moment we mostly use the "Runtime Support Library" as outlined in the official pico-sdk manual[1].
These libraries can be used in relativ isolation and don't necessarly pull in all the other dependencies in the pico-sdk (sure there is still some "polution"). For better RTOS isolation the pico-sdk now also features a `PICO_CONFIG_RTOS_ADAPTER_HEADER` define that allows us to overwrite some decisions of pico-sdk e.g. naming of linker sections. This could surely be expanded.
To add another thought: I assume that any bigger application (e.g. QMK) that leverages the custom RP2040/RP2350 peripherals like PIOs that don't fit into the existing ChibiOS HAL drivers will use the pico-sdk as a dependency anyway. Same is true for support libraries in the pico-sdk like the boot2 startup code[2] for the RP2040 which is needed for executing from flash. Or the optimized assembly for gcc intrinsics that use the RP2040 built-in integer divider[3].
After our chat in Discord I tried to go down the route of using the official CMSIS headers from RPI[4], which have been generated from their official SVD files using SVDConv. These headers are lacking in various ways:
1. They only provide structs for the drivers, no register defines. These can be generated though.
2. The resulting structs do not cluster repeating registers[5] in peripherals like GPIOs or DMA/PWM channels, same is true for the register defines - once generated.
3. It is possible to pre-process the SVD files to generate the clusters and better defines. I tried that process, but it is *a lot* of work with sub-optimal results in the struct and define nameing.
4. The generated CMSIS peripheral base address defines have name collisions with the pico-sdk headers
5. I assume that there will probably be more conflicts - but I stopped at this point to write this post.
Of course it is still possible to write our own CMSIS headers or to improve the code generation but both options are error prone and time consuming.
For me personally I would like to rather spend my time in leveraging the existing struct and header defines from pico-sdk and refactor the existing drivers (which is pretty straight forward [7]). If the coupling is unnessarly high there is a good chance that the pico-sdk maintainers are open to a PR (at least from my experience).
So yes, relying on pico-sdk means making compromises, but maybe not as bad as it used to be?
Looking forward to your response

Cheers,
Stefan / KarlK90
[1]: See Chapter 2.3 https://datasheets.raspberrypi.com/pico ... -c-sdk.pdf
[2]: https://github.com/raspberrypi/pico-sdk ... oot_stage2
[3]: https://github.com/raspberrypi/pico-sdk ... /divider.S
[4]: https://github.com/raspberrypi/pico-sdk ... SIS/Device
[5]: https://github.com/raspberrypi/pico-sdk ... #L298-L350
[6]: https://github.com/KarlK90/ChibiOS/blob ... P2040.yaml and https://github.com/KarlK90/ChibiOS/comm ... 4434443794
[7]: https://github.com/KarlK90/ChibiOS-Cont ... 80268e119b