-
-
Notifications
You must be signed in to change notification settings - Fork 114
arm-none-eabi-gcc build for armhf #105
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
Comments
No problem, and don't worry, we all learn new stuff every day, for me there are no "super coder" nor "stupid Chicken" but only good and positive contributors, so let's forget about that and move on :-).
We always used the unpatched pre-compiled binaries provided from https://launchpad.net/gcc-arm-embedded so we didn't build it directly like we do with al the other tools (that often have been patched to work properly). On their website there is a .pdf document that describes "how to build", and recently ARM added a script that should work with the Ubuntu distro (they suggest to use 8.04 IIRC). By the way I must warn you that the last time I tried it didn't worked out of the box (I don't remember the exact details sorry, it was too much time ago). Also please note that we need the exact version 4.8.3-2014q1, this is a very important detail. In any case if you're going to try something on your side I suggest to send frequent updates of your progress here and arduino/Arduino#4457 to avoid duplicating efforts (@PaulStoffregen seems to be also looking at that). |
I am indeed working on this. Well, right now my little Raspberry Pi 1 Model B is working on it.... the build takes many hours. You can find the modified scripts here: If you look at the commit log, this repository started with an exact copy of 2014q1. The important edits are in these 2 commits: PaulStoffregen/ARM_Toolchain_2014q1_Source@5902fd0 PaulStoffregen/ARM_Toolchain_2014q1_Source@3824906 |
If you're curious about why these particular edits, the reason stems from slightly different (and incompatible) naming conventions used by Debian, ARM's build script, and GNU. Because these scripts are meant to be able to build a Canadian cross compiler (eg, a Linux machine builds a compiler that runs on Windows, which compiles code for ARM EABI), they pass all 3 specs to every configure script, for --build, --host and --target. The problem stems from use of "uname" and some assumptions in the scripts to create the --build and --host names. On Raspberry Pi, the script will use "armv6l-linux-gnu". However, none of the GNU configure scripts recognize that particular combination. Fortunately, the configure scripts do know how to detect the build and host settings. Because we're not building a "Canadian" (this has to be actually built on a Raspberry Pi), the simple solution is to just not force the --build and --host settings. Then each configure script automatically detects "armv6l-unknown-linux-gnueabihf" and is able to build the code. ... or at least so far, so good... it's been running for about 11 hours and made it through the first stage gcc build... update: got through newlib... now in 2nd stage gcc build... looking good... I know there's always some level of anxiety about using a hacked toolchain. My earlier efforts involved replacing components with newer versions that were updated to understand "armv6l-linux-gnu". If you google the errors, that's the advice you find, because later versions added "armv6l-linux-gnu" to their configure scripts. But that would have changed quite a bit of the toolchain code. This way, the build is all the same toolchain code from 2014q1. It should result in a build that's a perfect match to the 2014q1 toolchain Arduino is currently using on the 4 other platforms. My intention is to do some testing to verify the compiler actually works, and then re-run the entire build a 2nd time, just to be absolutely sure it really compiles cleanly from the files on https://github.com/PaulStoffregen/ARM_Toolchain_2014q1_Source Even though this may look easy from only the commits I've pushed to Github, I can assure you I did quite a lot of fiddling yesterday. I want to make sure this really is correct before contributing the final result. Of course I'll post a final build for Arduino to use. Given the very slow speed of building on Raspberry Pi, it will very likely be 2 to 3 days to complete. |
Just a quick update, my first test build is still running, now going more than 38 hours! It seems to have successfully completed both stages of the gcc build and is now building other stuff like gdb. My hope is to do the first round of testing sometime this weekend. |
Good news. The build completed. I compiled several test programs. The .HEX files are a perfect match to the ones produced by Arduino's Linux 64 bit toolchain. @cmaglie The build process produces a final file named "gcc-arm-none-eabi-4_8-2014q1-20160129-linux.tar.bz2". When I complete another build, the "29" will become "31", because building takes 2 days. When extracted, the directory name is "gcc-arm-none-eabi-4_8-2014q1". That's slightly different than "4.8.3-2014q1". Internally, the subdirs and file structure is identical, and at least on the 6 small projects I tested, the compiled .HEX output is a perfect match. Hopefully this minor difference in the top level folder is ok? Or you'll rename it? |
Your having better luck then me, lol. @cmaglie since your using precompiled binaries from someone else with no patches, what is the harm of using the system package ?? |
The native (to Raspberry Pi) gcc I'm using to build the toolchain is:
Well, did you try using the repository I published. I put the exact commands you need to type in the readme file, so it should be extremely easy. Truly, it's just a matter of downloading those files and typing those commands... and waiting!
It sure would save a lot of time! (though I'm almost done now....) Does any system provide a pre-compiled package for the 2014q1 ARM embedded toolchain? It's quite different from the toolchains provided by the Linux distros. Just because it's for "ARM" doesn't mean it works for embedded systems. Arduino can't use the native toolchain on your ARM board, because it produces programs that run on your ARM Linux-based board, not on an ARM-based Arduino. Even among the embedded tools, significant differences exist between the many versions published over the last few years. In the long run, doing a sloppy job by not having a precise match to the 2014q1 toolchain Arduino uses on the other platforms will be result in anything but "save a lot of time and effort". Sure, it may get things running on ARM Linux sooner, but long-term all Arduino users on those platforms will suffer and Arduino developers will have to contend with frustrating issues if the toolchain doesn't very closely matched what's used on the PC & Mac platforms. That's why I'm taking a couple extra days to rebuild again and test carefully. I'll have this completed within a day, so please be patient and trust me. I do have quite a lot of experience in these matters and I want to make sure this is done properly. |
Opps, looks like I made a small mistake... which causes it to fail after 2 days of building. D'oh!! That's why I decided to rebuild, to make sure it really works from the files I published (rather than the fiddling I did last week). I'm starting another build now. It'll be Wednesday or Thursday before I have this done, due to the slow speed of my Raspberry Pi. If you downloaded that repository, please grab the latest copy. Perhaps click the "Watch" and "Star" buttons. |
Oops, to late, lol.
hmmm, real old .. :/~ This is the stuff the hack uses
which is like what we need isn't it ?? Ps: when did you last update your pi ?? |
hmmm,
there is a bunch of stuff in the install-native directory
did seem to take 10gigs |
@PaulStoffregen thanks for the time you put into this one!
It's ok, the first level folder is ignored by the IDE. Moreover I know that the .bz2 file contains a lot of very heavy .pdf documents that I'm going to remove anyway, so... yes, that's fine.
The problem is in the small subtle differences between different compiler versions. Just to give you an idea: we used to run the system provided
I tried to run the build on a Rpi2 and the build failed on binutils with a: I guess it's the same error encountered by @ShorTie8, the newer gcc seems to be able to detect more warnings and since binutils is compiled with the I found the following configuration files that adds the
I've commented out all the lines with:
and restarted the build. For now it's going without errors... let's see how it goes. |
Maybe that is why using gcc-4.8 would be best. |
FWIW, I disabled the that in build script. |
about 5 1/2 hours to compile ls -l pkg |
?? @cmaglie
Would not all those little errors cause problems, or the potential too... |
We are talking about warnings not errors (the build stopped because of the presence of
The toolchain obtained from the build is perfectly equivalent, despite the compiler version used to build it.
The warnings are probably already fixed upstream, it would be better to use a more recent version of the arm-gcc-none-eabi toolchain instead. BTW this is another task that requires more work (I'm quite sure that some patching on the cores SAM and SAMD is needed and other 3rd party cores may be affected as well), this is a long task and maybe another issue. |
Pretty much done with the build script. |
Only 5.5 hours is so much faster! Is that an armv6 platform? I've been building on the very slow Raspberry Pi 1 Model B board, with the assumption we want compatibility with all Raspberry Pi models. |
That is on a Odroid C1, which is armv7.
the old pi is the only armv6 I do believe |
And then you have the ODROID-C2 : 64bit quad-core SBC |
Does building on those boards result in a toolchain that can't run on the armv6-based Raspberry Pi Zero & version 1 model B? |
It seems that compiling on a Raspberry PI2 produces binaries that works on a Raspberry PI 1 (I checked that yesterday with the help of @sandeepmistry not sure the exact model or PI 1 he has BTW). This is the compiler installed on my RPi2:
The Instead I discovered that cross-compiling on x86 for arm doesn't work on the Pi1 (only Pi2), I had to recompile
I have a build made on the Pi2 but, even if it may work on the Pi1, since you're doing it I prefer to use your build because it has been made on an older environment it doesn't depends on more recent glibc and it guarantees a wider compatibility. |
Just checked on irc with
So, ya, pi's only produce armv6 stuff. |
I have finally finished. Here's the ready-to-use toolchain: https://github.com/PaulStoffregen/ARM_Toolchain_2014q1_Source/tree/master/pkg This actually completed several hours ago, but I spent some extra time to verify. The small collection of test programs I used earlier produced identical results, every HEX file a perfect match, compared to the 2014q1 toolchain in the Linux 64 bit version of Arduino 1.6.7. Initially, I saw a discrepancy when compiling a much larger project. After much digging through objdump listings, it turned out my build process was getting the list of files from the operating system in a different order. The order each file is compiled does not matter, but their order on the final linker command does matter. Once I used an identical linker command, I got a perfect match on the HEX files. I feel confident this toolchain is ready to be used by Arduino on ARM. |
I've uploaded the toolchain and updated Thanks to everyone! |
Thankz @cmaglie for the test_package_arm_index.json file!
Sorry for all the frustration relief, But I truly am just a stupid Chicken Farmer and not some super coder like you guys are.
This is really not a issue or a bug, But was wondering if your script to build the arm-none-eabi-gcc toolchain is around any where ?? Can't seem to find it .. :/~
Have A Great Day
ShirTie
The text was updated successfully, but these errors were encountered: