diff options
author | Matt Mets <[email protected]> | 2024-11-21 23:13:06 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-11-22 14:44:27 +0100 |
commit | 7847f4ea8ed1873b53f6b68e05cec94bea1f452f (patch) | |
tree | 29d95f35e0b7c0731348f3efa1ea59b6e01b162c | |
parent | 19736e5be2e95cac57d24f387525ddce29da3020 (diff) | |
download | tinygo-7847f4ea8ed1873b53f6b68e05cec94bea1f452f.tar.gz tinygo-7847f4ea8ed1873b53f6b68e05cec94bea1f452f.zip |
Fix invalid assembler syntax from gen-device-svd
This addresses #4608
-rwxr-xr-x | tools/gen-device-svd/gen-device-svd.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/gen-device-svd/gen-device-svd.go b/tools/gen-device-svd/gen-device-svd.go index 0c49986ab..c547af586 100755 --- a/tools/gen-device-svd/gen-device-svd.go +++ b/tools/gen-device-svd/gen-device-svd.go @@ -445,6 +445,13 @@ func readSVD(path, sourceURL string) (*Device, error) { return interruptList[i].PeripheralIndex < interruptList[j].PeripheralIndex }) + // Properly format the description, with comments. + description := "" + if text := device.Description; text != "" { + description = "// " + strings.ReplaceAll(text, "\n", "\n// ") + description = regexp.MustCompile(`\s+\n`).ReplaceAllString(description, "\n") + } + // Properly format the license block, with comments. licenseBlock := "" if text := formatText(device.LicenseText); text != "" { @@ -460,7 +467,7 @@ func readSVD(path, sourceURL string) (*Device, error) { DescriptorSource: sourceURL, Name: device.Name, NameLower: nameLower, - Description: strings.TrimSpace(device.Description), + Description: description, LicenseBlock: licenseBlock, } if device.CPU != nil { @@ -902,7 +909,7 @@ func writeGo(outdir string, device *Device, interruptSystem string) error { //go:build {{.pkgName}} && {{.device.Metadata.NameLower}} -// {{.device.Metadata.Description}} +{{.device.Metadata.Description}} // {{.device.Metadata.LicenseBlock}} package {{.pkgName}} @@ -1350,7 +1357,7 @@ func writeAsm(outdir string, device *Device) error { t := template.Must(template.New("go").Parse(`// Automatically generated file. DO NOT EDIT. // Generated by gen-device-svd.go from {{.File}}, see {{.DescriptorSource}} -// {{.Description}} +{{.Description}} // {{.LicenseBlock}} |