Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cmsis-svd library, and fix incompatiblitiy with gen-device-svd #4625

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tools/gen-device-svd/gen-device-svd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand All @@ -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 {
Expand Down Expand Up @@ -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}}
Expand Down Expand Up @@ -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}}

Expand Down