Skip to content

Generate one module for one peripheral #15

Open

Description

@demotomohiro

I tried svd2nim for SVD file for RP2040 in https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2040/hardware_regs/RP2040.svd
It generated rp2040.nim that has 66639 lines.
Importing large modules takes long time to compile.
If svd2nim divides device module, projects access only small numbers of peripherals can be compiled quickly.
How about to add a command line option that enables generating one module for one peripheral?

Activity

  1. auxym commented on Sep 12, 2024

    @auxym
    Collaborator

    Yeah, that makes sense I think. I'm also not a fan of the huge codegen. Thanks for the idea.

  2. dwhall commented on Sep 14, 2024

    @dwhall
    Contributor

    This is a compelling idea. It would be a fair bit of work, but it might be worth it. Thinking of how the result would be used:

    from <someArmDevice> import [device, <list of peripherals needed>]

    Where "device" gives you access to the device name, mpuPresent, fpuPresent, etc.
    and each peripheral module would hold all the registers, their fields accessors and enum constants, etc.

    One challenge will be where one peripheral is "derivedFrom" another. In those cases, I prefer the registers and register fields to be type-compatible, so I can copy values between them or put like registers into a list where they need to be the same type. To achieve this type-compatibility would require two modules importing the type from a common module. Not impossible to do, just a complication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions