Skip to content

Commit ac37699

Browse files
committed
Fix destination path for built startup object file to not be in the same folder as source
1 parent 384e112 commit ac37699

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

builder/frameworks/noneos_sdk.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,27 +119,29 @@ def get_startup_filename(board):
119119
)
120120

121121
startup_filename = board.get("build.startup", None)
122-
if get_flag_value("use_builtin_startup_file", True) or startup_filename:
123-
if startup_filename is None:
124-
env.Append(CPPPATH=[join(FRAMEWORK_DIR, "Startup")])
125-
startup_filename = get_startup_filename(board)
126-
else:
127-
# evaluate possible variables in the path
128-
startup_filename = env.subst(startup_filename)
129-
# if not absolute path, assume relative to project dir.
130-
if not isabs(startup_filename):
131-
startup_filename = join(env.subst("$PROJECT_DIR"), startup_filename)
132-
startup_filename = realpath(startup_filename)
133-
env.Append(CPPPATH=[dirname(startup_filename)])
134-
print("Using custom startup file: %s" % startup_filename)
135-
if not isfile(startup_filename):
136-
print("Provided startup file not found: %s" % startup_filename)
137-
env.Exit(-1)
138-
startup_file_filter = "-<*> +<%s>" % startup_filename
122+
if startup_filename :
123+
# evaluate possible variables in the path
124+
startup_filename = env.subst(startup_filename)
125+
# if not absolute path, assume relative to project dir.
126+
if not isabs(startup_filename):
127+
startup_filename = join(env.subst("$PROJECT_DIR"), startup_filename)
128+
startup_filename = realpath(startup_filename)
129+
env.Append(CPPPATH=[dirname(startup_filename)])
130+
print("Using custom startup file: %s" % startup_filename)
131+
if not isfile(startup_filename):
132+
print("Provided startup file not found: %s" % startup_filename)
133+
env.Exit(-1)
134+
env.BuildSources(
135+
join("$BUILD_DIR", "ProjectStartup"),
136+
dirname(startup_filename),
137+
"-<*> +<%s>" % startup_filename
138+
)
139+
elif get_flag_value("use_builtin_startup_file", True):
140+
env.Append(CPPPATH=[join(FRAMEWORK_DIR, "Startup")])
139141
env.BuildSources(
140142
join("$BUILD_DIR", "FrameworkNoneOSStartup"),
141143
join(FRAMEWORK_DIR, "Startup"),
142-
startup_file_filter
144+
"-<*> +<%s>" % get_startup_filename(board)
143145
)
144146

145147
# for clock init etc.

0 commit comments

Comments
 (0)