Author Topic: Compile ml w/ Linaro gcc?  (Read 13561 times)

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Compile ml w/ Linaro gcc?
« on: September 05, 2012, 11:05:34 AM »
I'm just setting up the arm toolchain and noticed that that the summon-arm script contains the outdated gcc 4.6.2 (current is 4.6.3).

Is there any reason to use this particular gcc release, and why doesn't it use the current linaro 4.6 or 4.7 gcc which is supposed to be the latest and greatest for building arm compiles? Is it just because of "never touch a running system" or does any more current gcc release make your cameras crash and burn? What gcc do you guys use?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Compile ml w/ Linaro gcc?
« Reply #1 on: September 05, 2012, 11:10:29 AM »
I'm interested too, if you succeed, please let me know (especially if there are any performance improvement). I couldn't compile with Linaro, but that was many months ago.

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Compile ml w/ Linaro gcc?
« Reply #2 on: September 05, 2012, 11:14:12 AM »
I'm interested too, if you succeed, please let me know (especially if there are any performance improvement). I couldn't compile with Linaro, but that was many months ago.

Hmmmm, I'm still somewhat critical about the guinea pig role, but I've been using Linaro for years to compile OpenWrt for my router (though it is mips and Linaro improvements are mainly for arm). And since I'm no ml insider, it is very unlikely I could recognize any performance improvements, or are there any dev benchmark tools hidden somewhere in ml? But I'll let you know if it compiles, and if I'm to hesitant to try it myself maybe you could have a go with your sponsored guinea pig hardware :-o

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
R: Compile ml w/ Linaro gcc?
« Reply #3 on: September 05, 2012, 11:14:36 AM »
I use the 32bit compiler binary mantained by arm. The link should be in the sticky thread

The stability test sub-menu has some benchmarks too if I'm not mistaken
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Compile ml w/ Linaro gcc?
« Reply #4 on: September 05, 2012, 11:22:53 AM »
Well... if you make the Linaro work with ML (just compile it and tell me what changes you had to do), I'll do the rest. You don't have to try it on your camera for the first time.

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
R: Compile ml w/ Linaro gcc?
« Reply #5 on: September 05, 2012, 11:31:45 AM »
A1ex, how about a compiler "race" then?
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Compile ml w/ Linaro gcc?
« Reply #6 on: September 05, 2012, 11:39:43 AM »
Sounds good.

I think this is best done in playback mode (where Canon tasks are idle), with some operation that feels a bit slow on ML right now (like focus peaking or defishing).

Compiling with -O3 also has noticeable speed improvements, but it caused trouble on 500D so I've turned it off in 2.3.

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: Compile ml w/ Linaro gcc?
« Reply #7 on: September 05, 2012, 11:51:49 AM »
I just realized that we are using the same cpu the Nintendo DS has. It was fun porting linux to it. We don't have much cpu power eh?
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: R: Compile ml w/ Linaro gcc?
« Reply #8 on: September 05, 2012, 11:53:38 AM »
The stability test sub-menu has some benchmarks too if I'm not mistaken

Alex' post implies that you are mistaken - but I'll have a go at compiling it w/ Linaro and let you know my findings. There shouldn't be too many changes necessary (unless I try 4.7), Linaro is proven & stable and is the default compiler on Ubuntu.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Compile ml w/ Linaro gcc?
« Reply #9 on: September 05, 2012, 12:01:26 PM »
There's enough CPU power to run a basic operating system, with file I/O, multitasking, even some simple image processing at 720x480 at 20fps in parallel with LiveView (that's the new focus peaking).

Trammell was able to write to display from bootloader context, without starting the main firmware:

Also, the bootloader has basic file I/O and probably direct card access too.

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Compile ml w/ Linaro gcc?
« Reply #10 on: September 05, 2012, 12:01:47 PM »
Compiling with -O3 also has noticeable speed improvements, but it caused trouble on 500D so I've turned it off in 2.3.

... that's the CFLAG in line 161 in Makefile.inc which is -Os in the current hg checkout, so I can should/can change that to -O3 if the target is my 60d?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Compile ml w/ Linaro gcc?
« Reply #11 on: September 05, 2012, 12:04:46 PM »
I usually only add these lines:
Code: [Select]
# compile some modules with -O3 for increased speed
zebra.o: $(SRC_DIR)/zebra.c
$(call build,CC,$(CC) $(CFLAGS) -O3 -c -o $@ $<)
menu.o: $(SRC_DIR)/menu.c
$(call build,CC,$(CC) $(CFLAGS) -O3 -c -o $@ $<)
bmp.o: $(SRC_DIR)/bmp.c
$(call build,CC,$(CC) $(CFLAGS) -O3 -c -o $@ $<)
chdk-gui_draw.o: $(SRC_DIR)/chdk-gui_draw.c
$(call build,CC,$(CC) $(CFLAGS) -O3 -c -o $@ $<)
You can try to compile everything with -O3 too, it usually works, but the binary size will increase quite a bit.

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: Compile ml w/ Linaro gcc?
« Reply #12 on: September 05, 2012, 12:52:15 PM »
Ok, digging out my old DSLinux stuff...here's what we used:
Code: [Select]
-g -Wall -Os -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-mathMaybe it's worth a shot

fomit-frame-pointer is actually redundant but the march and mtune can generate optimized code paths
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Compile ml w/ Linaro gcc?
« Reply #13 on: September 05, 2012, 08:17:42 PM »
Maybe it's worth a shot

Harrrgnnn ... now *that* was annoying, but I managed to compile ml with latest Linaro gcc 4.6 series (d/l from Launchpad) and even valiantly tested it - runs fine so far :-)

However, I couldn't persuade summon-arm to get even fsf gcc to compile on my x64 Ubuntu lts system, so I used the arm toolchain from https://launchpad.net/gcc-arm-embedded and replaced their gcc source with Linaro before running their build-toolchain.sh ... and I had to patch newlib, see the patch @ http://sourceware.org/ml/newlib/2011/msg00076.html

If you manage to write some benchmark we might even see if it was worth it - but since Linaro is working on optimizing gcc for arm for years, I think it certainly cannot be worse than the vanilla version. And we could try to compile ml with Linaro gcc 4.7, but without any benchmarks it would be a waste of time because we cannot tell the difference offhand.



Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Compile ml w/ Linaro gcc?
« Reply #14 on: September 05, 2012, 08:58:19 PM »
... btw, here's the autoexec if anyone wants to run a stability test and is to lazy to compile Linaro gcc: [link deleted: obsolete]

ilguercio

  • Hero Member
  • *****
  • Posts: 845
Re: Compile ml w/ Linaro gcc?
« Reply #15 on: September 05, 2012, 09:29:48 PM »
Thanks, will try it out.
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Compile ml w/ Linaro gcc?
« Reply #16 on: September 05, 2012, 09:32:26 PM »
Thanks, will try it out.

... and remember it's the latest trunk, so if anything's broken it might be very well the sourcecode itsself, too.

ilguercio

  • Hero Member
  • *****
  • Posts: 845
Re: Compile ml w/ Linaro gcc?
« Reply #17 on: September 05, 2012, 09:37:14 PM »
Got an error, here's the log file.
Looks huuuge.

https://dl.dropbox.com/u/1087972/ML/log000.log
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Compile ml w/ Linaro gcc?
« Reply #18 on: September 05, 2012, 09:40:55 PM »
Got an error, here's the log file.
Looks huuuge.

:-) ... what did you do to throw the error? I turned on all optimizations the devs recommended for the 60d, but they also said that might decrease stability. Maybe the next step should be to compile it with standard settings and Linaro 4.6 and then 4.7 to isolate the cause of problems - but as I wrote it runs just fine on my 60d as far as I can see, but your 50d is another model alltogether.

ilguercio

  • Hero Member
  • *****
  • Posts: 845
Re: Compile ml w/ Linaro gcc?
« Reply #19 on: September 05, 2012, 09:56:09 PM »
Let me try to reproduce it.
I just opened LV with focus peaking active.
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Compile ml w/ Linaro gcc?
« Reply #20 on: September 05, 2012, 10:00:37 PM »
Be careful, some bleeding edge focus peaking modes won't work on 50D.

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Compile ml w/ Linaro gcc?
« Reply #21 on: September 05, 2012, 10:02:13 PM »
Let me try to reproduce it.
I just opened LV with focus peaking active.

Alex did some changes to focus peaking recently (see changelog), it might be buggy. I'll do Linaro compiles for the stable 2.3 tag, optimized and non-optimized, this should be better than testing the unstable trunk. Check this thread again tomorrow at latest for the d/l links.

ilguercio

  • Hero Member
  • *****
  • Posts: 845
Re: Compile ml w/ Linaro gcc?
« Reply #22 on: September 05, 2012, 10:02:51 PM »
Ok, that might be it then.
Want me to tell you which modes do not work?
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: Compile ml w/ Linaro gcc?
« Reply #23 on: September 05, 2012, 10:32:06 PM »
Please do all tests on 2.3 stable (it's tagged on bitbucket as ML2.3-stable, revision afdeefef62fa)

edit: just realized that ML uses -march so it should be good. The makefile is a mess though ::)
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Compile ml w/ Linaro gcc?
« Reply #24 on: September 05, 2012, 11:43:22 PM »
I usually only add these lines:

@alex: *Where* do I add these lines in the Makefile.inc? In the places I tried they are ignored and everything is compiled with -Os in spite of the special lines with -O3 for zebra.o and so on...

edit: just realized that ML uses -march so it should be good.

... still, if the exact cpu is known shouldn't be -mtune=arm946e-s or even -mcpu=... better in addition to -march?

Please do all tests on 2.3 stable (it's tagged on bitbucket as ML2.3-stable, revision afdeefef62fa)

Ok, here it goes - standard -Os compile with current Linaro gcc 4.7, working ok on my 60d, anyone feel free to try it for regressions to the release build with the vanilla fsf compiler: https://dl.dropbox.com/u/94419838/ml-2.3.linaro47-test1.marsu42.zip