rp2_common/pico_*: MMIO access without going through HAL #1279

Open
opened 2023-02-24 00:00:00 -06:00 by szsam · 0 comments
szsam commented 2023-02-24 00:00:00 -06:00 (Migrated from github.com)

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. github.com/raspberrypi/pico-sdk@f396d05f82/src/rp2_common/pico_bootrom/bootrom.c (L20)
  2. github.com/raspberrypi/pico-sdk@f396d05f82/src/rp2_common/pico_platform/platform.c (L31)
  3. github.com/raspberrypi/pico-sdk@f396d05f82/src/rp2_common/pico_platform/platform.c (L22)
  4. github.com/raspberrypi/pico-sdk@f396d05f82/src/rp2_common/pico_platform/include/pico/platform.h (L347)
  5. github.com/raspberrypi/pico-sdk@f396d05f82/src/rp2_common/pico_runtime/runtime.c (L117-L118)
  6. github.com/raspberrypi/pico-sdk@f396d05f82/src/rp2_common/pico_runtime/runtime.c (L47)
As stated in [README.md](https://github.com/raspberrypi/pico-sdk/tree/master/src/rp2_common#readme), 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
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1279
No description provided.