Skip to content

Commit

Permalink
fixed noTZ project
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstendb-ARM committed Oct 5, 2023
1 parent d68fd27 commit 8e69128
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/stm32CubeMX/iniReader.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"strconv"
"strings"

"github.com/open-cmsis-pack/generator-bridge/internal/utils"
log "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
"gopkg.in/ini.v1"
Expand Down Expand Up @@ -192,6 +193,13 @@ func AppendToCores(iniSectionCore IniSectionCore, list *[]IniSectionCore) {

func IniReader(path string, trustzone bool) (MxprojectAllType, error) {
var mxprojectAll MxprojectAllType

if !utils.FileExists(path) {
text := "File not found: "
text += path
return mxprojectAll, errors.New(text)
}

inidata, err := GetIni(path)
if err != nil || inidata == nil {
text := "File not found or error opening file: .mxproject"
Expand All @@ -208,6 +216,9 @@ func IniReader(path string, trustzone bool) (MxprojectAllType, error) {
for coreId := range iniSections.cores {

Check failure on line 216 in internal/stm32CubeMX/iniReader.go

View workflow job for this annotation

GitHub Actions / Lint

ST1003: range var coreId should be coreID (stylecheck)
core := iniSections.cores[coreId]
iniName := core.iniName
if iniName == "Cortex" { // remove workaround for single-core .mxproject CubeMx files
iniName = ""
}
coreName := core.CoreName
trustzone := core.trustzone
mxproject, _ := GetData(inidata, iniName)
Expand Down Expand Up @@ -278,10 +289,9 @@ func GetSections(inidata *ini.File, iniSections *IniSectionsType) error {

func GetData(inidata *ini.File, iniName string) (MxprojectType, error) {
var mxproject MxprojectType

var sectionName string
const PreviousUsedKeilFilesId = "PreviousUsedKeilFiles"

Check failure on line 293 in internal/stm32CubeMX/iniReader.go

View workflow job for this annotation

GitHub Actions / Lint

ST1003: const PreviousUsedKeilFilesId should be PreviousUsedKeilFilesID (stylecheck)
if iniName != "" && iniName != "Cortex" {
if iniName != "" {
sectionName = iniName + ":" + PreviousUsedKeilFilesId
} else {
sectionName = PreviousUsedKeilFilesId
Expand Down
3 changes: 3 additions & 0 deletions internal/stm32CubeMX/stm32CubeMX.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ func FilterFile(file string) bool {
func FindMxProject(subsystem *cbuild.SubsystemType, mxprojectAll MxprojectAllType) (MxprojectType, error) {
coreName := subsystem.CoreName
trustzone := subsystem.TrustZone
if trustzone == "off" {
trustzone = ""
}
for id := range mxprojectAll.Mxproject {
mxproject := mxprojectAll.Mxproject[id]
if mxproject.CoreName == coreName && mxproject.Trustzone == trustzone {
Expand Down

0 comments on commit 8e69128

Please sign in to comment.