qilingframework / qilingframework/qiling

Hardware & peripherals API

Open
#1,466 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.1k
Forks
798
Avg merge
1d 1h
Merged PRs (30d)
9

Description

Please introduce public API for creating custom peripherals and managing hardware outside the framework's core.
Currently, it can be challenging to create a virtual SoC using existing APIs as only pre-defined MCUs are supported and hw blocks are instantiated from internal modules.

Also I'd like to have an ability to create dummy registers and map them to any address in the memory map.

Smth like this:

ql = Qiling(...)


class MyDummyReg(...):
    size: ClassVar = 2

    def read(self, ql: Qiling, addr: int) -> int:
        # do nothing or handle request
        ...

    def write(self, ql: Qiling, addr: int, value: int):
        # do nothing or handle request
        ...

    ...


ql.hw.add_reg("<bus_name>", 0xBEEFDEAD, MyDummyReg.size, "MyDummyReg", MyDummyReg())


class NandController(QlPeripheral):
    def read(self, offset: int, size: int) -> int:
        # map to file or read from a register
        ...

    def write(self, offset: int, size: int, value: int):
        # map to file or write to a register
        ...

    ...


ql.hw.add_peripheral("<bus_name>", 0xBEEF0000, "NandController", NandController())


class EthernetController(QlConnectivityPeripheral):
    def send(self, data: bytes):
        ...

    def recv(self, numb:int = 4096) -> bytes:
        ...

    def send_to_user(self, data: int):
        ...

    def recv_from_user(self) -> bytes:
        ...

    ...


ql.hw.add_connectivity_peripheral("<bus_name>", 0xBABE0000, "EthernetController", EthernetController())

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the Python examples in the issue as the starting point: they describe custom peripherals, dummy registers, and connectivity peripherals added through ql.hw. First map these requested entry points to the existing hardware APIs, then define the public API boundaries and tests needed to show that custom components can be created and mapped outside the framework's core.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.