AdaCore / AdaCore/svd2ada

SPARK mode consideration

Open
#96 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
71
Forks
41
PR merge metrics
No merged PRs in 30d

Description

After discovering that Spark supports overlays. I was just investigating whether it would be possible for svd2ada generated files to pass SPARK mode compliance checks.

With arrays off. Most discriminant records dissappear. For STM32 a couple remain such as for timers and USB_OTG.

Most of these are easily solved by removing the by value option for arrays if a --no-discriminant flag is passed. It would seem that --no-arrays would create a lot of client code duplication. I have seen @simonjwright use --no-arrays. I am not sure how he avoids e.g. 30 item case statements for EXTI/Interrupts etc.. Unless he overlays a 32 bit value or boolean array with an address or unchecked_conversion in the client code?

However, I am unsure of how to solve e.g. the Timer discriminant issue for svd functionality. Whereby depending upon the mode that the timer is in (Input/Output) then the bits of the CCMR1 register differ. The C code just has multiple defines with little/no protection. Is that the only way to make it SPARK compatible or does any one have any ideas?

I wonder if @Fabien-Chouteau unchecked_conversion work could play into solving this?

https://github.com/AdaCore/svd2ada/issues/40

Contributor guide

Open the contributing guide

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

Start by reviewing issue #40 and the svd2ada handling related to --no-discriminant, --no-arrays, and alternateRegister; compare generated STM32 timer and USB_OTG records against SPARK compliance checks. Done would require an agreed implementation path for the remaining discriminant cases and a defined compliance test.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.