Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: Totte on April 10, 2013, 06:52:11 PM

Title: 5Dc in Unified doesn't compile
Post by: Totte on April 10, 2013, 06:52:11 PM
Hi,
I've now come to the point that I can compile ML from the Unified source tree for several cameras, but not for 5Dc, which is the camera that I was interested in.

The compilation stops like this:
...
[ CC       ]   picoc.o
[ CC       ]   chdk-gui_script.o
[ AR       ]   strrchr.o
[ AR       ]   dietlibc.a
[ AR       ]   lib_a-setjmp.o
[ AR       ]   newlib-libc.a
[ LD       ]   magiclantern
pico.o: In function `abort':
pico.c:(.text+0x603c): multiple definition of `abort'
menu.o: In function `entry_default_display_info':
menu.c:(.text+0x1c3c): undefined reference to `was_sound_recording_disabled_by_fps_override'
menu.c:(.text+0x1c4c): undefined reference to `fps_should_record_wav'
debug.o: In function `run_test':
debug.c:(.text+0x244): undefined reference to `exmem_test'
debug.o: In function `config_menu_init':
debug.c:(.text+0xedc): undefined reference to `movie_tweak_menu_init'
lens.o: In function `draw_ml_bottombar':
lens.c:(.text+0x17f0): undefined reference to `hdr_video_enabled'
lens.o: In function `iso_components_update':
lens.c:(.text+0x2378): undefined reference to `get_digic_iso_gain_movie'
pico.o: In function `LibSetGuiMode':
pico.c:(.text+0x8ae): undefined reference to `SetGUIRequestMode'
collect2: error: ld returned 1 exit status
make[1]: *** [magiclantern] Error 1

Before I look into the source files, do other people have the same problem or are there simply tools and/or source files that I'm missing?

Thank you!
Title: Re: 5Dc in Unified doesn't compile
Post by: Marsu42 on April 10, 2013, 07:53:19 PM
A possible quick fix could be to copy Makefile.user to Makefile.user.default and set CONFIG_PICOC = n
Title: Re: 5Dc in Unified doesn't compile
Post by: a1ex on April 10, 2013, 07:59:32 PM
Nobody touched the 5Dc port since months.
Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on April 11, 2013, 02:43:39 PM
Quote from: a1ex on April 10, 2013, 07:59:32 PM
Nobody touched the 5Dc port since months.

How should I read this message? Are the compile errors to be expected because nobody has completed the port, or should it (still) compile because nobody has messed with it?

I was under the impression that the 5Dc had now been integrated in Unified, but I've reverted to the pre-compiled toolchain that should work with the unmodified make files (gcc-arm-none-eabi-4_7-2012q4-20121208-linux.tar.bz2), and I still get the same errors. The ones already listed under SUPPORTED_MODELS compile fine, though.

So, is the announcement "EDIT The 5dc will work on the unified tree! Big thanks to A1ex for the help in making this happen." found at http://www.magiclantern.fm/forum/index.php?topic=1010.0 a bit misleading or am I missing something?

Thanks again!
Title: Re: 5Dc in Unified doesn't compile
Post by: nanomad on April 11, 2013, 03:18:06 PM
Well, since nobody compiled it, nobody noticed it broke sometime ago.
You basically have to fix the error and submit a pull request if you're interested
Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on April 11, 2013, 10:14:39 PM
Thanks for the clarification.
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on April 12, 2013, 02:31:44 AM
Quote from: nanomad on April 11, 2013, 03:18:06 PM
Well, since nobody compiled it, nobody noticed it broke sometime ago.
You basically have to fix the error and submit a pull request if you're interested

For what I know is from when Coutts stopped porting it that 5dc branch is not a lot updated and with all the subsequent changes in the main repo went broke.
Since when I got the 5Dc I can compile and use only the 0xAF fork or the beta release.
That's why I've not yet tried to add or fix what's working strange on the 5Dc.

Title: Re: 5Dc in Unified doesn't compile
Post by: coutts on April 17, 2013, 10:12:23 PM
disable picoc (probably not enough ram anyways) and add dummy stubs (fake functions) with the names that the compiler complains is missing (see dummy.c in platform directory, put the stuff there).

the error about abort is related to libc.a, I forget how we fixed it last time I saw this..

Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on April 18, 2013, 04:08:57 PM
CONFIG_PICOC = n in Makefile.user.default and the following declarations in dummy.c did indeed produce an autoexec.bin file.

int was_sound_recording_disabled_by_fps_override() { return 1; }
int fps_should_record_wav() { return 0; }
void movie_tweak_menu_init() {}
int hdr_video_enabled() { return 0; }
int get_digic_iso_gain_movie() { return 0; }
void SetGUIRequestMode(int name) {}

I'm going away for a few days, but I'll see if I can brick my camera with this next week :P  Thanks!
Title: Re: 5Dc in Unified doesn't compile
Post by: coutts on April 18, 2013, 05:40:36 PM
Quote from: Totte on April 18, 2013, 04:08:57 PM
CONFIG_PICOC = n in Makefile.user.default and the following declarations in dummy.c did indeed produce an autoexec.bin file.

int was_sound_recording_disabled_by_fps_override() { return 1; }
int fps_should_record_wav() { return 0; }
void movie_tweak_menu_init() {}
int hdr_video_enabled() { return 0; }
int get_digic_iso_gain_movie() { return 0; }
void SetGUIRequestMode(int name) {}

I'm going away for a few days, but I'll see if I can brick my camera with this next week :P  Thanks!
glad that worked for you! :)
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on April 20, 2013, 03:37:21 PM
Quote from: Totte on April 18, 2013, 04:08:57 PM
CONFIG_PICOC = n in Makefile.user.default and the following declarations in dummy.c did indeed produce an autoexec.bin file.

int was_sound_recording_disabled_by_fps_override() { return 1; }
int fps_should_record_wav() { return 0; }
void movie_tweak_menu_init() {}
int hdr_video_enabled() { return 0; }
int get_digic_iso_gain_movie() { return 0; }
void SetGUIRequestMode(int name) {}

I'm going away for a few days, but I'll see if I can brick my camera with this next week :P  Thanks!

Tried just right now and the bin compiled, but not loaded by the camera.
As soon as the card is inserted the red led stay on after a first blink.
This also when pushing the battery with camera on and card in (with slot open).
Title: Re: 5Dc in Unified doesn't compile
Post by: coutts on April 24, 2013, 02:43:30 AM
void SetGUIRequestMode(int name) {}


this is needed by ML, it should be a stub defined in stubs.S
Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on April 24, 2013, 02:17:58 PM
So, is there a way that a mere mortal like myself could help find the correct address for SetGUIRequestMode()?
Title: Re: 5Dc in Unified doesn't compile
Post by: a1ex on April 24, 2013, 05:35:36 PM
There's no such thing in 5Dc iirc; the workaround for opening the menu was different.

If the menu works, don't worry about it.
Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on April 26, 2013, 09:29:17 AM
OK, but I'm still having the same problem as reported by scrax above.

Any idea what prevents ML from starting? Otherwise it seems I have to go back to the Unified version that had a working 5Dc port and try to see where it all went wrong. Can anyone confirm that the working beta4 was indeed compiled from Unified?
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on April 29, 2013, 01:41:24 PM
I've commented the line:
//void SetGUIRequestMode(int name) {}

now the red led still stay on but I can see the top LCD changing values like if it's working, but no buttons are working, so menu will not show up and is impossible to do anything.

EDIT: the button near the top LCD are working halfshutter and DOF too (trig AF), other buttons like MENU, INFO, TRASH etc.. are not responding. wheels are working too.


NOTE, I've installed gawk with homebrew on mac cause there was a warning about it not found when compiling:


[ SYMBOLS  ]   magiclantern.sym
/bin/sh: gawk: command not found
Title: Re: 5Dc in Unified doesn't compile
Post by: 0xAF on April 29, 2013, 08:55:25 PM
The beta4 was compiled from Unified by Alex, but way too many things changed since then... One of the first changes was the boot procedure. This is the reason, which prevents you from booting it correctly right now...
I were trying to fix the booting, but it still needs work. In my repo you can find the local_entry.S which is the old entry.S from 5DC (made by Coutts), but I had made some modifications to it (cant remember what and where).
Basically 5Dc will not boot normally in the current ML source, even if you compile it. Not in this shape at least.

I will have few free days after Tuesday, since we are Orthodox Christians, and we have 1 week calibrations now.
I will try to sync my repo with the main-stream ML.
So if anyone is interested, it will be easier to take over from there (and try to finish the cache-hacks boot method)

EDIT:
Just read the last post from scrax, how you booted it with cache-hacks or with your local entry.S ?

EDIT2:
Sorry, just saw in the ML repo that the entry.S is still there, I dont know why I were thinking that it were removed long time ago...
But still IIRC (which I doubt already), there will be problems with booting it, because of the CPU initialization, I had to modify some parts in entry.S to fix this (but again, I may be wrong).
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on April 29, 2013, 09:41:42 PM
Quote from: 0xAF on April 29, 2013, 08:55:25 PM
The beta4 was compiled from Unified by Alex, but way too many things changed since then... One of the first changes was the boot procedure. This is the reason, which prevents you from booting it correctly right now...
I were trying to fix the booting, but it still needs work. In my repo you can find the local_entry.S which is the old entry.S from 5DC (made by Coutts), but I had made some modifications to it (cant remember what and where).
Basically 5Dc will not boot normally in the current ML source, even if you compile it. Not in this shape at least.

I will have few free days after Tuesday, since we are Orthodox Christians, and we have 1 week calibrations now.
I will try to sync my repo with the main-stream ML.
So if anyone is interested, it will be easier to take over from there (and try to finish the cache-hacks boot method)

EDIT:
Just read the last post from scrax, how you booted it with cache-hacks or with your local entry.S ?

EDIT2:
Sorry, just saw in the ML repo that the entry.S is still there, I dont know why I were thinking that it were removed long time ago...
But still IIRC (which I doubt already), there will be problems with booting it, because of the CPU initialization, I had to modify some parts in entry.S to fix this (but again, I may be wrong).

I've just tried to pull from source repo to your repo and merged them, added those dummy things and now it can load and I'm enjoying the new menu layout :D

EDIT: here (https://dl.dropboxusercontent.com/u/123918/MagicLantern/bleeding-edge/5Dc/patch.diff.zip) the patch
Title: Re: 5Dc in Unified doesn't compile
Post by: 0xAF on April 29, 2013, 09:46:23 PM
Quote from: scrax on April 29, 2013, 09:41:42 PM
I've just tried to pull from source repo to your repo and merged them, added those dummy things and now it can load and I'm enjoying the new menu layout :D

Nice, would you pull-request so I can merge it into my repo. It can save me some time when I get back to it.
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on April 29, 2013, 10:10:09 PM
I can't right now, need todo a fork before. maybe the diff is enough?
Title: Re: 5Dc in Unified doesn't compile
Post by: nanomad on April 29, 2013, 10:10:56 PM
Export the hg diff, we can pull his repo to the main via bitbucket anyway
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on April 29, 2013, 10:14:40 PM
Quote from: nanomad on April 29, 2013, 10:10:56 PM
Export the hg diff, we can pull his repo to the main via bitbucket anyway

I've made the diff of 0xAF's repo after merging it with latest unified here the link: https://dl.dropboxusercontent.com/u/123918/MagicLantern/bleeding-edge/5Dc/patch.diff.zip
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on April 29, 2013, 10:17:26 PM
now forking ML and 0xAF sources to make the pull request
Title: Re: 5Dc in Unified doesn't compile
Post by: 0xAF on April 29, 2013, 10:18:25 PM
Quote from: nanomad on April 29, 2013, 10:10:56 PM
Export the hg diff, we can pull his repo to the main via bitbucket anyway

If you want me, I can merge scrax's diff and sync to latest ML, before you pull. Though it's not worth pulling my repo may be, the job is not finished.


EDIT: I see scrax is going to handle it.
Title: Re: 5Dc in Unified doesn't compile
Post by: 0xAF on April 29, 2013, 10:22:26 PM
Off-topic, sorry for posting this, call me superstitious or naive, but I do not like my post count staying on 66.
:)
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on April 29, 2013, 10:55:16 PM
I've made the pull request to 0xAF fork, now doing it to the main repo, let you decide wich one keep. ;)

EDIT: done both.
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on April 30, 2013, 01:29:02 PM
Updated both the pull request.

Will post a compiled autoexec later, I have to check what to include.
Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on May 02, 2013, 12:40:50 PM
Thanks, guys! I was able to compile a working autoexec.bin from https://bitbucket.org/0xAF/magic-lantern-5dc-port-wip yesterday. (Still had to modify the makefile to "PICOC = n" though)
Is there any hope at all that PICOC could be made to work with 5Dc, or is the hardware just too limited, as was implied earlier in this thread?

Oh, and I also played with the camera for a little bit. The intervalometer works but I couldn't get the bulb timer to work, with or without the intervalometer. Is that perhaps because the Bulb mode is only detected correctly on the cameras that have B at the end of the T range, and not B as a separate choice on the mode dial?
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on May 03, 2013, 05:35:54 AM
Quote from: Totte on May 02, 2013, 12:40:50 PM
Thanks, guys! I was able to compile a working autoexec.bin from https://bitbucket.org/0xAF/magic-lantern-5dc-port-wip yesterday. (Still had to modify the makefile to "PICOC = n" though)
Is there any hope at all that PICOC could be made to work with 5Dc, or is the hardware just too limited, as was implied earlier in this thread?

Oh, and I also played with the camera for a little bit. The intervalometer works but I couldn't get the bulb timer to work, with or without the intervalometer. Is that perhaps because the Bulb mode is only detected correctly on the cameras that have B at the end of the T range, and not B as a separate choice on the mode dial?

Yes picoc has to be disabled and bulb mode is not yet detected. Now that last source can be compiled I'll try to fix what I can, that bulb thing is something that I'm missing too.
EDIT: Bulb mode is detected, so there was some problems somewhere else when ported, I doubt I can fix it.

For scripting there are other option being added to ML that looks better so better wait for that maybe.

Also keep in mind that there are some not working features enabled just to check them, I'll remove all what is not working in the menu like flash/no flash option.

If you want to help fell free to post a list with what's strange/weird or missing.
Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on May 05, 2013, 01:00:11 AM
In addition to the Bulb timer, I've found that the Quick erase, Sticky half-pressed shutter button and Sticky DOF button don't do anything.
Those are all features that I personally would find useful, but I haven't checked if the sticky button features where even meant to be included for 5Dc or in beta4.

I haven't really tried all the ins and out the zebras and spot thingies, as I don't really see what they would be useful for, but they seem to be there and doing something. Very happy to see that the bracketing, intervalometer and MLU functions are all working like a charm.

Any pointers to what other scripting options could become available?
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on May 05, 2013, 02:02:14 PM
Quote from: Totte on May 05, 2013, 01:00:11 AM
In addition to the Bulb timer, I've found that the Quick erase, Sticky half-pressed shutter button and Sticky DOF button don't do anything.
Those are all features that I personally would find useful, but I haven't checked if the sticky button features where even meant to be included for 5Dc or in beta4.

I haven't really tried all the ins and out the zebras and spot thingies, as I don't really see what they would be useful for, but they seem to be there and doing something. Very happy to see that the bracketing, intervalometer and MLU functions are all working like a charm.

Any pointers to what other scripting options could become available?

Quick erase for me is working, it just selects the erase button when pressing trash in play mode.
Other two were enabled to check them and they don't work for me too, I've removed them from what could be the beta5
Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on May 05, 2013, 03:54:45 PM
You are absolutely right, I rechecked the Quick erase now and it works! I could've sworn that there was absolutely no difference between the on/off settings last night  :-[
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on May 05, 2013, 04:16:17 PM
Quote from: Totte on May 05, 2013, 03:54:45 PM
You are absolutely right, I rechecked the Quick erase now and it works! I could've sworn that there was absolutely no difference between the on/off settings last night  :-[

So far I've enabled some small feat like sensor temp and warning for bad settings and removed all what is not working. I have some problem with spotmeter, zebra and magic zoom, once disabled they can't be turned on in any way.

Other things tried are focus patterns but the menu item don't shows up if enabled and camera didn't recognize the lens attached.

EDIT: I've fixed compiling with picoc enabled but without any script on card ML loads fine (and no scripts menu), with scripts loaded in ML/scripts/ the blue led stay on at boot and ML menu don't show up pressing trash, other than that camera seems to work like without ML.                       
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on May 05, 2013, 11:38:26 PM
got this assert running the test suite:

ML ASSERT:
PROP_LEN(80020015) = 0
at ../../src/property.c:293 (prop_request_change), task ?


Magic Lantern version : v2.3.NEXT.2013May05.5DC111.scrax
Mercurial changeset   : 9f1a1235a182+ (unified) tip
Built on 2013-05-05 21:14:32 by [email protected].
Free Memory  : 0K + 2443K
Title: Re: 5Dc in Unified doesn't compile
Post by: coutts on May 06, 2013, 07:54:52 PM
Quote from: scrax on May 05, 2013, 11:38:26 PM
got this assert running the test suite:

ML ASSERT:
PROP_LEN(80020015) = 0
at ../../src/property.c:293 (prop_request_change), task ?


Magic Lantern version : v2.3.NEXT.2013May05.5DC111.scrax
Mercurial changeset   : 9f1a1235a182+ (unified) tip
Built on 2013-05-05 21:14:32 by [email protected].
Free Memory  : 0K + 2443K


that property corresponds to PROP_REMOTE_SW1 which from what I recall, doesn't exist in the 5dc (it's missing SW1/SW2 properties). I remember this is the reason we can't trigger bulb exposures for bulb timer. I'm not at a developing computer atm (busy this week at work) but go to property.c and see what needs to be IFDEF'd out for the 5dc for this property. The prop len returns as 0 because the property is inert / doesn't exist in the 5dc.
Title: Re: 5Dc in Unified doesn't compile
Post by: coutts on May 06, 2013, 07:55:52 PM
Quote from: scrax on May 05, 2013, 04:16:17 PM
So far I've enabled some small feat like sensor temp and warning for bad settings and removed all what is not working. I have some problem with spotmeter, zebra and magic zoom, once disabled they can't be turned on in any way.

Other things tried are focus patterns but the menu item don't shows up if enabled and camera didn't recognize the lens attached.

EDIT: I've fixed compiling with picoc enabled but without any script on card ML loads fine (and no scripts menu), with scripts loaded in ML/scripts/ the blue led stay on at boot and ML menu don't show up pressing trash, other than that camera seems to work like without ML.                     

does the 5dc have the free memory available for scripting? (iirc it was pretty low on free memory)
Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on May 06, 2013, 09:27:06 PM
My camera reports 2524k free memory right after start-up. Sounds like alot, is there anything that will really dig into those 2.4M during use?

BTW, would it be possible to hijack the shutter button full press and start the bulb timer that way instead of the awkward 1s half-press? When mode is set to B *and* bulb timer is set to on I think it's fair to assume that the user wants to use bulb timer.
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on May 07, 2013, 12:15:26 AM
Quote from: coutts on May 06, 2013, 07:54:52 PM
that property corresponds to PROP_REMOTE_SW1 which from what I recall, doesn't exist in the 5dc (it's missing SW1/SW2 properties). I remember this is the reason we can't trigger bulb exposures for bulb timer. I'm not at a developing computer atm (busy this week at work) but go to property.c and see what needs to be IFDEF'd out for the 5dc for this property. The prop len returns as 0 because the property is inert / doesn't exist in the 5dc.

How to find prop? I can't see them with prop spy it's all a black box
Title: Re: 5Dc in Unified doesn't compile
Post by: coutts on May 07, 2013, 05:33:30 PM
I think I found prop changes by hijacking the PropMgr manager and printing to console. The other problem with the 5dc was there's no full-press (and no way to find it), I had to dig deep just to find half press (using EMState changes to know when it happens). 5dc was quite difficult to port
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on May 07, 2013, 05:50:43 PM
I've updated some file with compilation fixes and the assert fix, here they are: https://bitbucket.org/600dplus/magic-lantern-5dc-port-wip-updated/overview

entrering Vram menu will hang ML so I think I'll remove it for 5DC.

EDIT: A binary compiled without picoc and debugmsg is here (https://bitbucket.org/600dplus/magic-lantern-5dc-port-wip-updated/downloads/ML2.3NEXT_5DC.fw111_workingFEATonly_07mary2013.zip).

added some new feat like warning for bad settings, temp. I have to fix someFixed problems with the new menu system in overlay menu and thenso maybe could be considered a beta5, no?

It's running stability tests now, will post back results when finished. PASSED
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on May 07, 2013, 06:35:01 PM
fixed spotmeter, now is possible to toggle it, looking into the other two now...  :)
All fixed now, updated the link (https://bitbucket.org/600dplus/magic-lantern-5dc-port-wip-updated/downloads/ML2.3NEXT_5DC.fw111_workingFEATonly_07mary2013.zip).  :D
Title: Re: 5Dc in Unified doesn't compile
Post by: Totte on May 09, 2013, 10:10:19 PM
I played around with your autoexec.bin and compiled my own with picoc just to confirm. The LED stays blue forever even with an empty SCRIPTS folder, so I guess the loading of picoc is just too much for 5Dc.

I now see why I was so confused about the Quick erase option earlier: It works only when deleting via the Play menu. If the erase button is pressed just after taking a pic, Cancel is selected as default regardless of the Quick erase setting. Perhaps this is obvious to some, and even how it is supposed to work, but it was certainly enough to confuse me :-\
Title: Re: 5Dc in Unified doesn't compile
Post by: scrax on May 10, 2013, 12:10:35 AM
Quote from: Totte on May 09, 2013, 10:10:19 PM
I now see why I was so confused about the Quick erase option earlier: It works only when deleting via the Play menu. If the erase button is pressed just after taking a pic, Cancel is selected as default regardless of the Quick erase setting. Perhaps this is obvious to some, and even how it is supposed to work, but it was certainly enough to confuse me :-\

I use hold for review in canon menu and Hold->play in ML so didn't noticed that, you are right quick erase works only form play mode.