Skip to content

Commit

Permalink
Merge pull request #14 from Open-CMSIS-Pack/absOutPath
Browse files Browse the repository at this point in the history
added support for (absolute) output path with "STM32CubeMX" as last elemet
  • Loading branch information
thorstendb-ARM authored Nov 15, 2023
2 parents aa3d96e + 9384e7c commit dfbb4a4
Showing 1 changed file with 15 additions and 3 deletions.
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

0 comments on commit dfbb4a4

Please sign in to comment.