Skip to content

Commit 7847f4e

Browse files
cibomahtodeadprogram
authored andcommitted
Fix invalid assembler syntax from gen-device-svd
This addresses #4608
1 parent 19736e5 commit 7847f4e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tools/gen-device-svd/gen-device-svd.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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}}
908915
package {{.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

Comments
 (0)