@@ -445,6 +445,13 @@ func readSVD(path, sourceURL string) (*Device, error) {
445445 return interruptList [i ].PeripheralIndex < interruptList [j ].PeripheralIndex
446446 })
447447
448+ // Properly format the description, with comments.
449+ description := ""
450+ if text := device .Description ; text != "" {
451+ description = "// " + strings .ReplaceAll (text , "\n " , "\n // " )
452+ description = regexp .MustCompile (`\s+\n` ).ReplaceAllString (description , "\n " )
453+ }
454+
448455 // Properly format the license block, with comments.
449456 licenseBlock := ""
450457 if text := formatText (device .LicenseText ); text != "" {
@@ -460,7 +467,7 @@ func readSVD(path, sourceURL string) (*Device, error) {
460467 DescriptorSource : sourceURL ,
461468 Name : device .Name ,
462469 NameLower : nameLower ,
463- Description : strings . TrimSpace ( device . Description ) ,
470+ Description : description ,
464471 LicenseBlock : licenseBlock ,
465472 }
466473 if device .CPU != nil {
@@ -902,7 +909,7 @@ func writeGo(outdir string, device *Device, interruptSystem string) error {
902909
903910//go:build {{.pkgName}} && {{.device.Metadata.NameLower}}
904911
905- // {{.device.Metadata.Description}}
912+ {{.device.Metadata.Description}}
906913//
907914{{.device.Metadata.LicenseBlock}}
908915package {{.pkgName}}
@@ -1350,7 +1357,7 @@ func writeAsm(outdir string, device *Device) error {
13501357 t := template .Must (template .New ("go" ).Parse (`// Automatically generated file. DO NOT EDIT.
13511358// Generated by gen-device-svd.go from {{.File}}, see {{.DescriptorSource}}
13521359
1353- // {{.Description}}
1360+ {{.Description}}
13541361//
13551362{{.LicenseBlock}}
13561363
0 commit comments