InfiniTimeOrg / InfiniTimeOrg/InfiniTime
Access MMIO without going through HAL or drivers
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Verification
- I searched for similar issues and found none was relevant.
Introduce the issue
I have noticed that some code accesses memory-mapped I/O (MMIO) without going through Hardware Abstraction Layer (HAL) or drivers. This type of access may have several drawbacks, including poor portability and reusability.
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 or a must (e.g. because, for example, SDK does not provide the necessary API)? 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:
NRF_TIMER2->CC[0]in https://github.com/InfiniTimeOrg/InfiniTime/blob/d968bcb1f3afd2364558e41013dbd2d6d5c286aa/src/main.cpp#L345- https://github.com/InfiniTimeOrg/InfiniTime/blob/d968bcb1f3afd2364558e41013dbd2d6d5c286aa/src/components/firmwarevalidator/FirmwareValidator.cpp#L8-L11
On the contrary,FirmwareValidator::Validate()uses driver API to write tovalidBitAdress: https://github.com/InfiniTimeOrg/InfiniTime/blob/d968bcb1f3afd2364558e41013dbd2d6d5c286aa/src/components/firmwarevalidator/FirmwareValidator.cpp#L15
Preferred solution
No response
Version
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the cited MMIO access in src/main.cpp and src/components/firmwarevalidator/FirmwareValidator.cpp, including FirmwareValidator::Validate() and validBitAdress. Compare these sites with the available HAL or driver paths and determine whether each direct access has a necessary exception or can be replaced conventionally; completion requires a documented decision for both examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100