-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: master
Are you sure you want to change the base?
Conversation
Thanks very much for the PR! |
library.py
Outdated
# following function does not work with custom board due to platformio bug | ||
# linker_script = adjust_linker_offset(env.subst('$PIOENV'), 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.
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.
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.
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
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 issue is now resolved!
library.py
Outdated
global_env.Replace( | ||
LDSCRIPT_PATH=linker_script) | ||
env.Append( | ||
LINKFLAGS=['-T',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.
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.
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.
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.)
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.
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.
I also like your PR platformio/platform-atmelsam#84 which converts this library into a framework, it makes a lot of sense. |
as discussed in platformio/platform-atmelsam#33 (comment)