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

added support for (absolute) output path with "STM32CubeMX" as last elemet #14

Merged
merged 1 commit into from
Nov 15, 2023
Merged
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
18 changes: 15 additions & 3 deletions internal/stm32CubeMX/stm32CubeMX.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ func Process(cbuildYmlPath, outPath, cubeMxPath, mxprojectPath string, runCubeMx
}

if runCubeMx {
cubeIocPath := path.Join(workDir, "STM32CubeMX", "STM32CubeMX.ioc")
cubeIocPath := workDir
lastPath := filepath.Base(cubeIocPath)
if lastPath != "STM32CubeMX" {
cubeIocPath = path.Join(cubeIocPath, "STM32CubeMX")
}
cubeIocPath = path.Join(cubeIocPath, "STM32CubeMX.ioc")

if utils.FileExists(cubeIocPath) {
err := Launch(cubeIocPath, "")
Expand All @@ -69,7 +74,8 @@ func Process(cbuildYmlPath, outPath, cubeMxPath, mxprojectPath string, runCubeMx
}
}

mxprojectPath = path.Join(workDir, "STM32CubeMX", ".mxproject")
tmpPath, _ := filepath.Split(cubeIocPath)
mxprojectPath = path.Join(tmpPath, ".mxproject")
}
mxproject, err := IniReader(mxprojectPath, false)
if err != nil {
Expand Down Expand Up @@ -214,7 +220,13 @@ func WriteCgenYmlSub(outPath string, mxproject MxprojectType, subsystem *cbuild.
outName := subsystem.SubsystemIdx.Project + ".cgen.yml"
outFile := path.Join(outPath, outName)
var cgen cbuild.CgenType
relativePathAdd := path.Join("STM32CubeMX", "MDK-ARM")

lastPath := filepath.Base(outPath)
var relativePathAdd string
if lastPath != "STM32CubeMX" {
relativePathAdd = path.Join(relativePathAdd, "STM32CubeMX")
}
relativePathAdd = path.Join(relativePathAdd, "MDK-ARM")

cgen.GeneratorImport.ForBoard = subsystem.Board
cgen.GeneratorImport.ForDevice = subsystem.Device
Expand Down
Loading