pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

rp2_common/pico_*: MMIO access without going through HAL

Open szsam opened this issue 2 years ago • 0 comments

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:

  1. https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_bootrom/bootrom.c#L20
  2. https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_platform/platform.c#L31
  3. https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_platform/platform.c#L22
  4. https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_platform/include/pico/platform.h#L347
  5. https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_runtime/runtime.c#L117-L118
  6. https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_runtime/runtime.c#L47

szsam avatar Feb 24 '23 06:02 szsam