-
Notifications
You must be signed in to change notification settings - Fork 3k
tools: fix the path generated to the sct file #9966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tools/export/makefile/__init__.py
Outdated
@@ -272,11 +272,10 @@ def generate(self): | |||
if self.resources.linker_script: | |||
sct_file = self.resources.get_file_refs(FileType.LD_SCRIPT)[-1] | |||
new_script = self.toolchain.correct_scatter_shebang( | |||
sct_file.path, join("..", dirname(sct_file.name))) | |||
sct_file, dirname(sct_file.name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indentation looks off. It looks like it's 12 spaces when it should be 4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
tools/export/uvision/__init__.py
Outdated
sct_file_ref = self.toolchain.correct_scatter_shebang(sct_file_ref, dirname(sct_file_ref.name)) | ||
self.resources.add_file_ref(FileType.LD_SCRIPT, sct_file_ref.name, sct_file_ref.path) | ||
ctx['linker_script'] = sct_file_ref.name | ||
if ctx['linker_script'] != sct_file_ref.path: | ||
self.generated_files.append(ctx['linker_script']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that this (and the if above it) is no longer needed, as the new scatter file is in the Resources object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theotherjimmy Does the old linker script need to be removed from Resources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lines removed as per Jimmy's comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work! A few questions for @theotherjimmy as I'm still getting more familiar with this.
tools/toolchains/arm.py
Outdated
@@ -284,8 +285,9 @@ def link(self, output, objects, libraries, lib_dirs, scatter_file): | |||
if lib_dirs: | |||
args.extend(["--userlibpath", ",".join(lib_dirs)]) | |||
if scatter_file: | |||
new_scatter = self.correct_scatter_shebang(scatter_file) | |||
args.extend(["--scatter", new_scatter]) | |||
scatter_name = split(scatter_file)[-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is quite right, shouldn't this be the path to the scatter_file relative to the project root @theotherjimmy ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this should be:
scatter_name = split(scatter_file)[-1] | |
scatter_name = dirname(scatter_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think dirname is correct either, right? That wouldn't include the actual file name.
Wouldn't it be closer to relpath
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggested changes by Jimmy have been made
Tested the latest patch-set 1f051ffc4400ef312d2bf434ce59e64d7f9b4c07 locally on top of mbed-os-5.11.5. |
tools/toolchains/arm.py
Outdated
from os.path import join, dirname, splitext, basename, exists, isfile | ||
from os import makedirs, write, remove | ||
from os.path import join, dirname, splitext, basename, exists, isfile, split | ||
from os import makedirs, write, curdir, remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think curdir
is used. Could you remove this? or point me to where you use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curdir is removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake
tools/toolchains/arm.py
Outdated
@@ -284,8 +285,9 @@ def link(self, output, objects, libraries, lib_dirs, scatter_file): | |||
if lib_dirs: | |||
args.extend(["--userlibpath", ",".join(lib_dirs)]) | |||
if scatter_file: | |||
new_scatter = self.correct_scatter_shebang(scatter_file) | |||
args.extend(["--scatter", new_scatter]) | |||
scatter_name = dirname(scatter_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, my recommendation was really wrong here. This should probably be:
scatter_name = dirname(scatter_file) | |
scatter_name = relpath(scatter_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made.
For what it's worth: I have tested this locally for compatibility with the online compiler, and it works |
@naveenkaje Fyi, this needs a rebase. |
Ping |
The sct file path generated in the online compiler is incorrect. Fix that by changing the correct_scatter_shebang API to accept a FileRef object instead and use the path. This change should go with change in online compiler that removes the override for correct_scatter_shebang.
Rebased! |
CI started |
CI restarted |
Test run: FAILEDSummary: 1 of 13 test jobs failed Failed test jobs:
|
make armc5/6 failures in exporters - please review |
It'd be worth having @theotherjimmy take another look due to the new changes. |
Oh I didn't mention this explicitly, but the exporter failures should be addressed with these latest changes. |
CI started |
Test run: FAILEDSummary: 1 of 13 test jobs failed Failed test jobs:
|
Ok, last issue should be resolved. |
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
The sct file path generated in the online compiler
is incorrect. Fix that by changing the correct_scatter_shebang
API to accept a FileRef object instead and use the path.
This change should go with change in online compiler that removes
the override for correct_scatter_shebang.
Pull request type