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

Integrated code from device generator #18

Merged
merged 6 commits into from
Dec 14, 2023
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
# Folders
.vscode
/build*/

# others
*~
32 changes: 31 additions & 1 deletion internal/readFile/readFile.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ package readfile

import (
"errors"
"os"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -59,7 +61,35 @@ func Process(inFile, inFile2, outPath string) error {
params.Device = "Test Device"
}

err := stm32cubemx.WriteCgenYml(outPath, mxprojectAll, params)
var parms cbuild.ParamsType

err := stm32cubemx.ReadCbuildYmlFile(inFile, outPath, &parms)
if err != nil {
return err
}
workDir := path.Dir(inFile)
if parms.OutPath != "" {
if filepath.IsAbs(parms.OutPath) {
workDir = parms.OutPath
} else {
workDir = path.Join(workDir, parms.OutPath)
}
} else {
workDir = path.Join(workDir, outPath)
}
workDir = filepath.Clean(workDir)
workDir = filepath.ToSlash(workDir)
err = os.MkdirAll(workDir, os.ModePerm)
if err != nil {
return err
}

err = stm32cubemx.ReadContexts(workDir+"/STM32CubeMX/STM32CubeMX.ioc", parms)
if err != nil {
return err
}

err = stm32cubemx.WriteCgenYml(outPath, mxprojectAll, params)
if err != nil {
return err
}
Expand Down
Loading
Loading