Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI; add dimensioned register fields #108

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

simonjwright
Copy link
Contributor

I would have put this in as 3 separate PRs, but they would need to be implemented in the right order, because the way that CI had been set up meant that CI failed.

Next, arrange that alr install installs the schema and SVDs, so that they’re accessible on the user’s computer.

Next (the main event), fix the problem raised in issues #100, #102, #106, where register fields with %s (and a <dim> tag, hence "dimensioned") weren’t properly translated.

  * .github/workflows/main.yml:
    (gnat_version): removed.
    (gprbuild_version): removed.
    (actions/checkout): v3.
    (project/setup-alire): v3.
    (toolchain): specify gnat_native before gprbuild, to avoid picking
      mismatched versions.
  * svd2ada.gpr (Install): new.
This warning (treated as error) causes build failure in CI on at least
Ubuntu.

  * src/ada_gen.adb (Get_Boolean): rename Dead, Dead2 to Dummy, Dummy2,
      so GNAT won't report unused warnings.
From the SVD, field components have an optional <dimElementGroup>:
  <dim> specifies the number of array elements,
  <dimIncrement> specifies the address (?bit) offset between consecutive
    array elements,
  (optional) <dimIndex> specifies "a comma seperated list of
    strings being used for identifying each element in the array",
    but we only see r'[0-9]+\-[0-9]+'.

We will produce <dim> fields, where %s in the Name translates to the
first component of <dimIndex> incremented by 1 for each field, and
LSB, MSB are incremented by <dimIncrement>.

  * src/descriptors-field.ads
    (Field_T): added components
      Dimensions: contents of the <dim> field in the SVD,
      Increment: contents of the <dimIncrement> field in the SVD,
      Index: the first component of the <dimIndex> field in the SVD.
    (Null_Field): added values for the new components, using associations.
  * src/descriptors-field.adb:
    (context): with Ada.Strings.Fixed, so we can pick out which Trim is
      required.
    (Read_Field): initialize new fields in Result. In particular, Dimensions
      will be set to 1. If present, process tags dim, dimIncrement, dimIndex.
    (Dump): add new function Insert_Dimensioned_Fields. Call this function
      on the input Reg_Fields, and then run the rest of Dump on the result.
    (Insert_Dimensioned_Fields): new. For each Field in the original, insert
      as many copies as indicated by its Dimensions, updating the Name, LSB
      and MSB. Note that if the original field from the SVD had no <dim>
      component, Dimensions will have been set to 1 by Read_Field, so this
      process will be done just once (resulting in no change).
  * alire.toml (version): updated to 0.1.1.
    (xmlada): updated to ">=22.0.0" (we're presently on 24.0.0).
Warnings reported in CI by GCC 14.2.1 on Ubuntu, but not locally on
macOS.

  * src/descriptors-field.adb:
      descriptors-field.adb:302:19: warning: "Addition" is not modified
      descriptors-field.adb:303:19: warning: "Index" is not modified
      descriptors-field.adb:304:19: warning: "LSB" is not modified
      descriptors-field.adb:305:19: warning: "MSB" is not modified
      descriptors-field.adb:310:25: warning: "Percent_S" is not modified
      descriptors-field.adb:313:25: (style) "exit Substitute" required
      descriptors-field.adb:372:07: warning: "Full_Fields" is not modified
@simonjwright simonjwright mentioned this pull request Sep 4, 2024
@Irvise
Copy link
Contributor

Irvise commented Oct 1, 2024

Hi @pat-rogers could you or someone else take a look at this? :)

@Irvise
Copy link
Contributor

Irvise commented Nov 4, 2024

@pat-rogers ping? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants