AdaCore / AdaCore/svd2ada

`range check failed` because type `Natural` is used for address values

Open
#99 3 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

Some of the SVD files in CMSIS_SVD lead to CONSTRAINT_ERROR exceptions because type Natural is too small to store address values.
This can be reproduced for example with M1AGL.svd.

The following error is raised by svd2ada:

raised CONSTRAINT_ERROR : base_types.adb:218 range check failed

In my system (linux 64-bit), type Natural has a max value of 2147483647, i.e. 0x7FFFFFFF. As a result of this, svd2ada fails to process address or size values which are greater than this upper limit.

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

Reproduce the failure with CMSIS-SVD/Microsemi/M1AGL.svd and inspect base_types.adb around line 218, where the range check is raised. Confirm that svd2ada can process address and size values above 0x7FFFFFFF without a CONSTRAINT_ERROR.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.