Skip to content
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

Update and fix AtmelStart_PlatformIO #1

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

JelleRoets
Copy link

@JelleRoets JelleRoets commented Nov 11, 2019

@frankleonrose
Copy link
Owner

Thanks very much for the PR!

library.py Outdated
Comment on lines 188 to 189
# following function does not work with custom board due to platformio bug
# linker_script = adjust_linker_offset(env.subst('$PIOENV'), linker_script)
Copy link
Owner

Choose a reason for hiding this comment

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

The solution to failure with a custom board cannot be to disable this important feature. This works for non-custom boards and it specifically prevents the problem you mention in the readme of overwriting the bootloader.

Please detect the use of a custom board and disable the adjustment only in that case.

Copy link
Author

Choose a reason for hiding this comment

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

agree, enabled it again.
Currently didn't catch the error, which will make it a good example to fix the underlying issue: platformio/platformio-core#3264

Copy link
Author

Choose a reason for hiding this comment

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

this issue is now resolved!

library.json Outdated Show resolved Hide resolved
library.py Outdated
global_env.Replace(
LDSCRIPT_PATH=linker_script)
env.Append(
LINKFLAGS=['-T',linker_script])
Copy link
Owner

@frankleonrose frankleonrose Nov 13, 2019

Choose a reason for hiding this comment

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

Now that the custom board issue is fixed, can this be restored to global_env.Replace? That way we shouldn't have the double -T flag issue.

Copy link
Owner

Choose a reason for hiding this comment

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

Ok, I ran into the same problem with the 4.1.0 upgrade. How about we remove the -T flag? I fixed it using the following line to remove the -T linker_script.ld

global_env['LINKFLAGS'] = [ x for x in global_env['LINKFLAGS'] if not ('-T' == x or ".ld" in x)]

Then the replace works. (This isn't the best remove code - expects linker file to have .ld extension.)

Copy link
Author

Choose a reason for hiding this comment

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

looks good to me! indeed it's best to check if there is already a -T flag in the link flags and if so, replace it with the new linker script.

@JelleRoets
Copy link
Author

I also like your PR platformio/platform-atmelsam#84 which converts this library into a framework, it makes a lot of sense.
Would you like to integrete these changes into that PR as well?
I can help rewriting the readme if you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants