pico-sdk
pico-sdk copied to clipboard
rp2_common/pico_*: MMIO access without going through HAL
As stated in README.md, hardware_* are Hardware Abstraction Layer (HAL), while pico_* provide higher level functionality.
I have noticed that some code in pico_* accesses memory-mapped I/O (MMIO) without going through HAL or drivers. This type of access may have several drawbacks, including poor portability and maintainability.
I would like to open this issue to investigate why some MMIO access does not follow the conventional path through HAL or drivers. Are there specific scenarios where non-conventional MMIO access is preferred? Is it possible to fix the code by accessing MMIO conventionally (i.e. through HAL/drivers)?
Code snippets with MMIO access that does not go through HAL or drivers:
- https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_bootrom/bootrom.c#L20
- https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_platform/platform.c#L31
- https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_platform/platform.c#L22
- https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_platform/include/pico/platform.h#L347
- https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_runtime/runtime.c#L117-L118
- https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_runtime/runtime.c#L47