Skip to content

Commit

Permalink
Sort all arrays before code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed May 26, 2023
1 parent 606061a commit 80e8cc2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stm32-cube-cmake-vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ def parse_and_generate(projectFolderBasePath, args):
cpu_params.append(target_fpu_abi)

# Make replacements
cpu_params.sort()
templatefiledata = templatefiledata.replace(
'{{sr:cpu_params}}', NEWLINE_INDENTED.join(cpu_params))

Expand Down Expand Up @@ -557,6 +558,7 @@ def parse_and_generate(projectFolderBasePath, args):

# Normalize path to remove "Debug" from path
paths.append(os.path.normpath(path))
paths.sort()
templatefiledata = templatefiledata.replace('{{sr:' + varname + '}}', NEWLINE_INDENTED.join(
[gen_relative_path_to_cmake_folder(projectFolderBasePath, p) for p in paths]))

Expand All @@ -567,6 +569,7 @@ def parse_and_generate(projectFolderBasePath, args):
for conf in ['debug']:
for compiler in ['c', 'cxx', 'asm']:
varname = 'symbols_' + compiler + '_SYMB'
data_obj['confs'][conf][compiler]['symbols'].sort()
templatefiledata = templatefiledata.replace('{{sr:' + varname + '}}', NEWLINE_INDENTED.join(
["\"" + f + "\"" for f in data_obj['confs'][conf][compiler]['symbols']]))

Expand All @@ -579,6 +582,7 @@ def parse_and_generate(projectFolderBasePath, args):
for i in range(len(paths)):
# Do some optimizations with path if necessary
pass
libs.sort()
templatefiledata = templatefiledata.replace('{{sr:link_DIRS}}', NEWLINE_INDENTED.join([gen_relative_path_to_cmake_folder(
projectFolderBasePath, os.path.normpath(os.path.join(CProjBasePath, 'Debug', p))) for p in paths]))
templatefiledata = templatefiledata.replace(
Expand Down

0 comments on commit 80e8cc2

Please sign in to comment.