-
Notifications
You must be signed in to change notification settings - Fork 143
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
Add ARC64 support #327
Add ARC64 support #327
Conversation
configs/arc64.config
Outdated
CT_TARGET_VENDOR="zephyr" | ||
CT_BINUTILS_SRC_DEVEL=y | ||
CT_BINUTILS_DEVEL_URL="https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb.git" | ||
CT_BINUTILS_DEVEL_REVISION="9742c8bf3899b833122ce0bfbf3e112132c907cb" |
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.
We need a set of patches added to the zephyr repo instead of git references like this.
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.
Are you sure? We use GCC 10.x releases in Zephyr's SDK, while ARC64 is based on GCC master
branch (i.e. what's going to be GCC 11.x at some point). Imagine amount of changes involved (it's not just ARC code).
Moreover, from time to time we re-base our ARC64-related changes on top of upstream new master
state and so those bumps will look like yet another huge patch for existing patch. So I'd prefer to use that much cleaner approach until our changes are merged upstream (say in a year or so).
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.
So for gcc we need to identify a baseline snapshot of the gcc11 work and than have any additional ARC changes on top of that.
configs/arc64.config
Outdated
CT_BINUTILS_DEVEL_REVISION="9742c8bf3899b833122ce0bfbf3e112132c907cb" | ||
CT_NEWLIB_SRC_DEVEL=y | ||
CT_NEWLIB_DEVEL_URL="https://github.com/foss-for-synopsys-dwc-arc-processors/newlib.git" | ||
CT_NEWLIB_DEVEL_REVISION="850160f6ba8620a6841ce956ee6c88ecc73399ac" |
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.
We need the patches for newlib to be against https://github.com/zephyrproject-rtos/newlib-cygwin
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.
Same here. I may generate patches, but see my explanation above for GCC.
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.
We need to utilize the same source base for ALL the architectures as much as possible. We can make an exception for GCC, but see my comment above about having a snapshot of upstream gcc sources + patches on top of that for any additional ARC support.
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.
Well I think there're many reasons to use the same versions of all components for all architectures in Zephyr. But I'm not sure how feasible that could be? Some need more recent version due to significant improvements & fixes, some prefer to stick to older versions because they are known to work.
And I think all becomes much worse if we decide to use a snapshot of not yet released components. Maybe we need to discuss that with wider audience?
As for the current ARC64 changes I think it's fine to differ from other "more stable/traditional" arches becase:
- We may not introduce additional turbulence for other arches switching all to WIP components.
- We'll minimize maintenance - only update commit hashes from time to time instead of huge patches
- ARC64 will also act as a guinea pig highlighting issues we'll see when we eventually switch to GCC 11, Binutils 2.37 etc
- This all is for a limited amount of time - we're interested in upstreaming GCC/Binutils/Newlib ASAP. It's too late for GCC 11 obviously, but GCC 12 might have if not all but at least some ARC64 support I hope.
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.
@nashif can chime in and we can discuss in the toolchain working group.
However, I understand what you are saying from a toolchain point of view, but from the Zephyr point of view this can be a huge pain. I'm less concerned about gcc/binutils and more about newlib. As I mentioned on a call we had huge pains when the xtensa newlib was out of sync with all the other zephyr arch's. So we really need newlib to be in sync.
right now I'd lean to saying NOT to include the ARC64 support in the SDK and just have the Zephyr ARC64 support point at an "external" toolchain. (similar to how esp32 works).
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 guess Newlib is the simplest thing among these 3 (GCC, Binutils & Newlib) as it's the smallest code-base and amount of changes is not that huge. Moreover for now we use not very recent Newlib (like v3.0 or v3.1) as a base so it's super easy to generate a cumulative patch for ARC64 and rarely update it as needed. As well as re-base it on top of v3.3 (currently used in Zephyr) or even more up-to-date versions when time comes.
So think again, maybe accept ARC64 SDK ;)
@abrodkin I've do a straight forward rebase of the ARC patches to newlib on the zephyr newlib tree: https://github.com/galak/newlib-zephyr/tree/newlib-3.3.0-arc It looks like the ARC tree is based on 3.1.0. Wondering if you can take a look at that. We need to see if this builds and test it out. Also, there are a few changes in those patches that I wonder about:
|
Ok I finally made that exercise as well and may easily answer - all those things 1, 2 & 3 are not needed. |
c0d786d
to
5f5b601
Compare
@galak see my most recent update with:
With all that I hope we're good to go for an alpha of the SDK to be used at least with ARC64. |
One last finishing touch was in moving ARC64 patches to a separate folder as in case of Binutils we still don't have ARCv2 & ARCv3 back-ends decoupled, thus source tree for ARC64 is not usable at this point for ARCv2.
Now that problem is obviously gone. |
Can you submit a PR to https://github.com/zephyrproject-rtos/newlib-cygwin |
In the GCC & binutils patches can we drop the changes to testsuite files. Can make it harder to manage other changes in the future.
See comment about submitting a PR to the zephyr newlib tree.
Zephyr CT-NG should be merged, so should be able to update this now. |
In binutils PR there is a change to bfd/elflink.c, gas/write.c. Can you explain that? Is there a separate patch we can have for that if needed. |
What are the patches in a separate |
GCC patch comments:
|
In your tree I don't see any change to warning.h. Can we reduce the change in libgloss/configure to just the arc support? |
Right, I didn't see that funny change back in the day and in fact I used your a bit cleaner tree ;) |
I think your cleanups are good, just need to see about |
Well, see --- a/libgloss/configure.in
+++ b/libgloss/configure.in
@@ -38,9 +38,12 @@ case "${target}" in
AC_CONFIG_SUBDIRS(aarch64)
config_testsuite=true
;;
- arc*-*-*)
+ arc-*-* | arceb-*-*)
AC_CONFIG_SUBDIRS(arc)
;;
+ arc64-*-*)
+ AC_CONFIG_SUBDIRS(arc64)
+ ;;
epiphany-*-*)
AC_CONFIG_SUBDIRS(epiphany)
config_testsuite=true And I understand how ugly |
When I look at the other commits/changes to |
@galak see my cleaned-up branch here: https://github.com/foss-for-synopsys-dwc-arc-processors/newlib/tree/abrodkin-arc64-3.3.0 What was done:
|
Will take a look when I get a chance, do you want to submit it to https://github.com/zephyrproject-rtos/newlib-cygwin |
Sure, we may merge that into Zephyr's fork. Do you want it to be kept as a set of patches or just one cumulative patch? |
Set of patches is best when we have it, so lets leave it that way. |
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.
Can you rebase this on #340
e5d6669
to
170e1a9
Compare
Rebased. As well as:
|
@abrodkin I pushed an update here - rebased since I merged the newlib change, and added the symlinks I mentioned. It looks like gcc fails to build with errors of the form:
|
The problem was in somehow reverted [I'm pretty sure it was once correctly updated] commit of CT-NG, which was pointing to the prior zephyrproject-rtos/crosstool-ng@dded2f6 one, effectively we attempted to use CT-NG which had no idea about ARC64 and so we were building for ARCv2 from Binutils which only support ARCv3, thus that strange GCC errors. See what we had in Buildkite log:
Note target is Now fixed with 8531d19. |
Ah, that makes sense |
And see, now all got built perfectly fine! |
Add patches for GCC and binutils to enable ARC64 support. We also update crosstool-ng reference to support building ARC64. The binutils patches are not a clean and probably break support for none-ARC platforms currently. As such we create a unique patch dir (patches-arc64) to be used when building the ARC64 toolchain. We symlink in the gcc and gdb patches and just have a unique binutils patch for ARC64 in there. Additionally GDB isn't currently supported on ARC64. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
zephyrproject-rtos/crosstool-ng#9 is a prerequisite for this one.
And until zephyrproject-rtos/crosstool-ng#9 is not merged let's use my CT-NG fork so that the SDK is really buildable.