Skip to content

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

Merged
merged 5 commits into from
Apr 9, 2019

Conversation

naveenkaje
Copy link
Contributor

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

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

@naveenkaje naveenkaje requested review from bridadan and theotherjimmy and removed request for bridadan March 6, 2019 20:36
@@ -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))
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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'])
Copy link
Contributor

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.

Copy link
Contributor

@bridadan bridadan Mar 6, 2019

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?

Copy link
Contributor Author

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

Copy link
Contributor

@bridadan bridadan left a 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.

@@ -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]
Copy link
Contributor

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 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this should be:

Suggested change
scatter_name = split(scatter_file)[-1]
scatter_name = dirname(scatter_file)

Copy link
Contributor

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?

Copy link
Contributor Author

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

@naveenkaje
Copy link
Contributor Author

Tested the latest patch-set 1f051ffc4400ef312d2bf434ce59e64d7f9b4c07 locally on top of mbed-os-5.11.5.

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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curdir is removed

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake

@@ -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)
Copy link
Contributor

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:

Suggested change
scatter_name = dirname(scatter_file)
scatter_name = relpath(scatter_file)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes made.

@theotherjimmy
Copy link
Contributor

For what it's worth: I have tested this locally for compatibility with the online compiler, and it works

@cmonr
Copy link
Contributor

cmonr commented Mar 25, 2019

@naveenkaje Fyi, this needs a rebase.

@cmonr
Copy link
Contributor

cmonr commented Apr 1, 2019

@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.
@bridadan
Copy link
Contributor

bridadan commented Apr 2, 2019

Rebased!

@cmonr
Copy link
Contributor

cmonr commented Apr 2, 2019

CI started

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 3, 2019

CI restarted

@mbed-ci
Copy link

mbed-ci commented Apr 3, 2019

Test run: FAILED

Summary: 1 of 13 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_exporter

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 3, 2019

make armc5/6 failures in exporters - please review

@bridadan bridadan requested a review from theotherjimmy April 5, 2019 16:53
@bridadan
Copy link
Contributor

bridadan commented Apr 5, 2019

It'd be worth having @theotherjimmy take another look due to the new changes.

@bridadan
Copy link
Contributor

bridadan commented Apr 8, 2019

Oh I didn't mention this explicitly, but the exporter failures should be addressed with these latest changes.

@cmonr
Copy link
Contributor

cmonr commented Apr 8, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Apr 9, 2019

Test run: FAILED

Summary: 1 of 13 test jobs failed
Build number : 3
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_exporter

@bridadan
Copy link
Contributor

bridadan commented Apr 9, 2019

Ok, last issue should be resolved.

@cmonr
Copy link
Contributor

cmonr commented Apr 9, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Apr 9, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 4
Build artifacts

@cmonr cmonr merged commit 803f5fd into ARMmbed:master Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants