@@ -350,7 +350,7 @@ func readSVD(path, sourceURL string) (*Device, error) {
350350 sort .SliceStable (clusterRegisters , func (i , j int ) bool {
351351 return clusterRegisters [i ].address < clusterRegisters [j ].address
352352 })
353- if dimIncrement == - 1 {
353+ if dimIncrement == - 1 && len ( clusterRegisters ) > 0 {
354354 lastReg := clusterRegisters [len (clusterRegisters )- 1 ]
355355 lastAddress := lastReg .address
356356 if lastReg .array != - 1 {
@@ -537,7 +537,14 @@ func parseBitfields(groupName, regName string, fieldEls []*SVDField, bitfieldPre
537537 enumName = strings .ToUpper (enumName )
538538 }
539539 enumDescription := strings .Replace (enumEl .Description , "\n " , " " , - 1 )
540- enumValue , err := strconv .ParseUint (enumEl .Value , 0 , 32 )
540+ var enumValue uint64
541+ var err error
542+ if strings .HasPrefix (enumEl .Value , "0b" ) {
543+ val := strings .TrimPrefix (enumEl .Value , "0b" )
544+ enumValue , err = strconv .ParseUint (val , 2 , 32 )
545+ } else {
546+ enumValue , err = strconv .ParseUint (enumEl .Value , 0 , 32 )
547+ }
541548 if err != nil {
542549 if enumBitSpecifier .MatchString (enumEl .Value ) {
543550 // NXP SVDs use the form #xx1x, #x0xx, etc for values
0 commit comments