When the crash is fixed, it produces a nim file which does not compile.
This PR adds the following fixes:
Add the STM32F103.svd file to tests
Add an automated test that converts all (2 for now) SVD files and runs nim check on the result.
Allow the "access" property to remain undefined.
The SVD spec states about the registerPropertiesGroup, of which access is a part:
Elements not defined on a more general level, must be defined at level at the latest
That said, the STM32F103 SVD does not define the access property at any level up to the register level, for many registers. That said, ARM's SVDCONV tool does not produce any warning and generates an IOM struct member for these registers.
Therefore, we follow svdconv's approach and default to read-write access when it is undefined, with a warning however.
After checking what SVDconv does, I also added defaults (with warnings) for other undefined properties used by svd2nim (size and resetValue)
Don't crash for unimplemented code header bindings
This is an odd malformation in the STM32F103 file, many interrupt elements appear twice. Here we silently ignore the re-definition.
Remove linebreaks in interrupt description comments
Created invalid syntax as the supplementary lines were not prepended with #.
Use uint literals for register loc field
The loc field is already defined as uint type, but the literals were rendered un-annonated. This caused Nim to interpret any literal higher than int32.high as an int64 literal. Fix by appending the 'u annotation to loc field literals.
Resolves #1
svd2nim currently:
This PR adds the following fixes:
Add the STM32F103.svd file to tests
Add an automated test that converts all (2 for now) SVD files and runs nim check on the result.
Allow the "access" property to remain undefined.
The SVD spec states about the
registerPropertiesGroup
, of whichaccess
is a part:That said, the STM32F103 SVD does not define the access property at any level up to the register level, for many registers. That said, ARM's SVDCONV tool does not produce any warning and generates an
IOM
struct member for these registers.Therefore, we follow svdconv's approach and default to
read-write
access when it is undefined, with a warning however.After checking what SVDconv does, I also added defaults (with warnings) for other undefined properties used by svd2nim (
size
andresetValue
)Don't crash for unimplemented code header bindings
This was a recently introduced bug.
Prevent rendering duplicated interrupt enum entries
This is an odd malformation in the STM32F103 file, many interrupt elements appear twice. Here we silently ignore the re-definition.
Remove linebreaks in interrupt description comments
Created invalid syntax as the supplementary lines were not prepended with
#
.Use uint literals for register
loc
fieldThe
loc
field is already defined asuint
type, but the literals were rendered un-annonated. This caused Nim to interpret any literal higher thanint32.high
as anint64
literal. Fix by appending the'u
annotation to loc field literals.