mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 19:44:00 +00:00
@@ -445,6 +445,13 @@ func readSVD(path, sourceURL string) (*Device, error) {
|
|||||||
return interruptList[i].PeripheralIndex < interruptList[j].PeripheralIndex
|
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.
|
// Properly format the license block, with comments.
|
||||||
licenseBlock := ""
|
licenseBlock := ""
|
||||||
if text := formatText(device.LicenseText); text != "" {
|
if text := formatText(device.LicenseText); text != "" {
|
||||||
@@ -460,7 +467,7 @@ func readSVD(path, sourceURL string) (*Device, error) {
|
|||||||
DescriptorSource: sourceURL,
|
DescriptorSource: sourceURL,
|
||||||
Name: device.Name,
|
Name: device.Name,
|
||||||
NameLower: nameLower,
|
NameLower: nameLower,
|
||||||
Description: strings.TrimSpace(device.Description),
|
Description: description,
|
||||||
LicenseBlock: licenseBlock,
|
LicenseBlock: licenseBlock,
|
||||||
}
|
}
|
||||||
if device.CPU != nil {
|
if device.CPU != nil {
|
||||||
@@ -902,7 +909,7 @@ func writeGo(outdir string, device *Device, interruptSystem string) error {
|
|||||||
|
|
||||||
//go:build {{.pkgName}} && {{.device.Metadata.NameLower}}
|
//go:build {{.pkgName}} && {{.device.Metadata.NameLower}}
|
||||||
|
|
||||||
// {{.device.Metadata.Description}}
|
{{.device.Metadata.Description}}
|
||||||
//
|
//
|
||||||
{{.device.Metadata.LicenseBlock}}
|
{{.device.Metadata.LicenseBlock}}
|
||||||
package {{.pkgName}}
|
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.
|
t := template.Must(template.New("go").Parse(`// Automatically generated file. DO NOT EDIT.
|
||||||
// Generated by gen-device-svd.go from {{.File}}, see {{.DescriptorSource}}
|
// Generated by gen-device-svd.go from {{.File}}, see {{.DescriptorSource}}
|
||||||
|
|
||||||
// {{.Description}}
|
{{.Description}}
|
||||||
//
|
//
|
||||||
{{.LicenseBlock}}
|
{{.LicenseBlock}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user