Skip to content

Commit 6b21a55

Browse files
committed
ARM: ARMC6: Copy headers along with the updated linker scatter file
* Need to copy headers into the build directory as well when also writing an updated linker scatter file to the build directory
1 parent 3c21f1e commit 6b21a55

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tools/toolchains/arm.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
"""
17+
import glob
1718
import re
1819
from copy import copy
1920
from os.path import join, dirname, splitext, basename, exists
2021
from os import makedirs, write
22+
from shutil import copyfile
2123
from tempfile import mkstemp
2224

2325
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
@@ -198,7 +200,7 @@ def correct_scatter_shebang(self, scatter_file):
198200
"""
199201
with open(scatter_file, "rb") as input:
200202
lines = input.readlines()
201-
if (lines[0].startswith(self.SHEBANG) or
203+
if (lines[0].startswith(self.SHEBANG) or
202204
not lines[0].startswith("#!")):
203205
return scatter_file
204206
else:
@@ -208,6 +210,12 @@ def correct_scatter_shebang(self, scatter_file):
208210
out.write(self.SHEBANG)
209211
out.write("\n")
210212
out.write("".join(lines[1:]))
213+
214+
# Copy headers into the build dir as well
215+
headers = glob.glob(join(dirname(scatter_file), '*.h'))
216+
for header in headers:
217+
copyfile(header, join(self.build_dir, basename(header)))
218+
211219
return new_scatter
212220

213221
@hook_tool

0 commit comments

Comments
 (0)