@@ -445,6 +445,13 @@ func readSVD(path, sourceURL string) (*Device, error) {
445
445
return interruptList [i ].PeripheralIndex < interruptList [j ].PeripheralIndex
446
446
})
447
447
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
+
448
455
// Properly format the license block, with comments.
449
456
licenseBlock := ""
450
457
if text := formatText (device .LicenseText ); text != "" {
@@ -460,7 +467,7 @@ func readSVD(path, sourceURL string) (*Device, error) {
460
467
DescriptorSource : sourceURL ,
461
468
Name : device .Name ,
462
469
NameLower : nameLower ,
463
- Description : strings . TrimSpace ( device . Description ) ,
470
+ Description : description ,
464
471
LicenseBlock : licenseBlock ,
465
472
}
466
473
if device .CPU != nil {
@@ -902,7 +909,7 @@ func writeGo(outdir string, device *Device, interruptSystem string) error {
902
909
903
910
//go:build {{.pkgName}} && {{.device.Metadata.NameLower}}
904
911
905
- // {{.device.Metadata.Description}}
912
+ {{.device.Metadata.Description}}
906
913
//
907
914
{{.device.Metadata.LicenseBlock}}
908
915
package {{.pkgName}}
@@ -1350,7 +1357,7 @@ func writeAsm(outdir string, device *Device) error {
1350
1357
t := template .Must (template .New ("go" ).Parse (`// Automatically generated file. DO NOT EDIT.
1351
1358
// Generated by gen-device-svd.go from {{.File}}, see {{.DescriptorSource}}
1352
1359
1353
- // {{.Description}}
1360
+ {{.Description}}
1354
1361
//
1355
1362
{{.LicenseBlock}}
1356
1363
0 commit comments