60D development

291 views
Skip to first unread message

jason

unread,
Jan 2, 2011, 5:01:30 AM1/2/11
to Magic Lantern firmware development
So, any thoughts on why the menus don't work? Also has anyone got a
map on the memory locations of all the buttons for the 60D? I know
there's one for the 550D. I'm not terribly familiar with the ML code,
I've just managed to inch myself through the audio file and the menu
file, and of course 5dhack.c

Heres a screen shot of someone running it on their 60D (not me).
http://img.laoupload.com/images/09806664327084371442.jpg

(taken from this forum http://www.dvxuser.com/V6/showthread.php?232452-Magic-Lantern-for-60D-In-Progress)

arm.indy

unread,
Jan 2, 2011, 7:46:43 AM1/2/11
to Magic Lantern firmware development
Welcome Jason,

you've got this better version (try2):
http://groups.google.com/group/ml-devel/browse_thread/thread/f4b54ae5fdbc385

Menus can be activated by intercepting key events in gui.c

all 60d information are gathered here:
http://magiclantern.wikia.com/wiki/60D

source code is available as well as a working .fir to enable 'autoexec
code execution', like on 550d.
send me an email if you want to improve 60d support.

I personnaly do not have a 60d. I wanted trying a port anyway to
enable 'autoexec' code execution, which is an achieved step on 60d.

Indy
> (taken from this forumhttp://www.dvxuser.com/V6/showthread.php?232452-Magic-Lantern-for-60D...)

jason

unread,
Jan 2, 2011, 7:56:41 AM1/2/11
to Magic Lantern firmware development
So, its basically just the garbage bin button is a different key
event?
I have a 60D and I can do some debugging, I'm just a bit more cautious
about testing as this is my current source of income. I don't have
access to a PC that often, so i haven't gone through the effort to
load ML up yet.

On Jan 2, 4:46 am, "arm.indy" <arm.indi...@gmail.com> wrote:
> Welcome Jason,
>
> you've got this better version (try2):http://groups.google.com/group/ml-devel/browse_thread/thread/f4b54ae5...

arm.indy

unread,
Jan 2, 2011, 11:29:03 AM1/2/11
to Magic Lantern firmware development
this is an interesting hypothesis. I noticed 4 changes in this only
function comparing to 550d:

- the functions table address
- 7 functions instead of 8 in 550d
- the msg_queue offset=0x30 instead of 0x38 for 550d and 0x34 for 5d2.
- msg counter at offset 0xc instead of 4.

the 2 first seems normal, but I suspect the 2 others a way to
complexify the enabling of menu button for ML.

if you remove the comment before bmp_printf()
you should since the event number corresponding to key press

you can use Alex's tools to analyse the firmware.

Indy

arm.indy

unread,
Jan 2, 2011, 11:34:00 AM1/2/11
to Magic Lantern firmware development, Alex
Jason,


Alex (who enabled buttons for menus on 550d) just gave me advices:

"Step by step:
1) Does task override works? Call some debugmsgs (maybe with a few
seconds delay) from gui_main_task_60d.
2) Are the button codes the same? I've got them using "toggle
draw_event" from debug.c; at the beginning, I've looked at debugmsg
output.

Not all buttons generate events in gui_main_task (at least on 550) so
it may be tricky.

Can you send me some dumpf logs?"

Indy

On 2 jan, 13:56, jason <jsncarr...@gmail.com> wrote:

Jason Carrier

unread,
Jan 2, 2011, 11:34:21 AM1/2/11
to ml-d...@googlegroups.com
Im not sure if you've played with a 60D before but theres some interesting changes in the firmware, mostly in the custom buttons and the custom functions. I also dont knot if it makes much of a difference ( i dont imagine it does ) but i've set a lot of those custom functions. Theres also an aperture wheel. Like i said, i dont know this code very well but do you think that 1 less function could be because the aperture wheel is not a button?

--
http://magiclantern.wikia.com/

To post to this group, send email to ml-d...@googlegroups.com
To unsubscribe from this group, send email to ml-devel+u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/ml-devel?hl=en

Jason Carrier

unread,
Jan 2, 2011, 11:36:10 AM1/2/11
to ml-d...@googlegroups.com
Yeah I was looking through them, the logs record button presses right? I'll boot up and press a series of buttons and a certain order and see if we can see which is which

Jason Carrier

unread,
Jan 2, 2011, 11:40:49 AM1/2/11
to ml-d...@googlegroups.com
I did this string on three boots, i figured they were useful ones to do first. Also there should be 3 chains of these events so it should be easy to spot among 3 log files
up up down down left left right right trash trash set set unlock unlock

sending the file in next email, gotta switch comps

jason

unread,
Jan 2, 2011, 9:22:15 PM1/2/11
to Magic Lantern firmware development
To let more people know if anyone else is working on this. the 0.2.0
release for the 60D does not generate log files unless you take a
picture in video mode, in which case it takes pictures endlessly. Also
if you press the Q, info, and menu buttons sequentially, in any order
it does the same thing as pressing the shutter button. I'm thinking
the buttons are set up somewhat differently in memory because there
are more. I haven't quite set my system up to build ML yet and I do
have a fear of bricking my 60D. :)

Alex

unread,
Jan 3, 2011, 12:28:54 AM1/3/11
to ml-d...@googlegroups.com
This sounds like you need to disable trap focus (or maybe the entire
shoot module).

I'd start with a minimal build (no audio, no zebras, just booting) and
then enable each feature individually. This is much easier to
troubleshoot. But you do need to be able to compile ML in order to do
this.

Bricking is unlikely with a clean build imo; the hardest job (i.e.
booting the fw) has been done successfully by Indy.

I smell some memory corruption in audio.c and shoot.c (at least on
550d), so be careful with those.

Jason Carrier

unread,
Jan 3, 2011, 2:40:57 AM1/3/11
to ml-d...@googlegroups.com
That make sense on the trap focus/shoot module. I had thought about disabling everything and getting a bare bones system running. Thanks for comforting me on the bricking issue, I've got my copy of ubuntu and im going to work on it tonight. My only question is; I saw a jpg of someone reading events going through memory, im just curious what file thats in for me to enable it?

I'd planned on having a version without audio.c running anyway since the 60D doesnt have AGC. The biggest thing would be to have the meters running and have a button so it could be adjusted with the wheel in real time, while filming. That doesnt seem out of the realm of the possible for me, has anyone run into this issue?

Alex

unread,
Jan 3, 2011, 2:55:34 AM1/3/11
to ml-d...@googlegroups.com
If you are talking about this: http://magiclantern.wikia.com/wiki/GUI_Events
that's Trammell's event log on the 5D2. Look at his commit history to find it.

If you are talking about this:
http://magiclantern.wikia.com/wiki/GUI_Events/550D
that's my event log, inspired from Trammell's work. Code:
https://bitbucket.org/a1ex/magic-lantern/changeset/5cefa40dd254

To disable the modules, remove the <modulename.o> entries in the
Makefile, compile, and if there are some module dependencies (e.g.
shoot calls something from zebra and you've disabled zebra), either
comment out that functionality or add some dummy function.

Jason Carrier

unread,
Jan 3, 2011, 2:58:02 AM1/3/11
to ml-d...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
sounds good, thanks for the links as well

Alex

unread,
Jan 3, 2011, 2:58:20 AM1/3/11
to ml-d...@googlegroups.com
DebugMsg and bmp_printf in gui_main_task can make the camera not to
boot (or other nasty things), so make sure you only call them after
the camera is fully initialized. I didn't know this when I wrote that
code... so you have to fix it.

Jason Carrier

unread,
Jan 3, 2011, 2:59:39 AM1/3/11
to ml-d...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
oh good to know, thanks for the heads up.

Alex

unread,
Jan 3, 2011, 4:55:08 AM1/3/11
to ml-d...@googlegroups.com, de...@42u.de
It seems Deti is silently doing some work on the 60D branch, and
posted some builds at http://129.187.43.19/download/ , but without
source code.

Deti, please be aware that Magic Lantern is licensed under the GPL,
and therefore you should publish the source code of all your builds.
Thanks.

Deti

unread,
Jan 3, 2011, 6:50:25 AM1/3/11
to Magic Lantern firmware development
On 01/03/2011 10:55 AM, Alex wrote:
> Deti, please be aware that Magic Lantern is licensed under the GPL,
> and therefore you should publish the source code of all your builds.
> Thanks.
I just built the code from the 60D repository without any changes. I am
sorry, there is nothing to publish.

Deti

Alex

unread,
Jan 3, 2011, 7:42:49 AM1/3/11
to Magic Lantern firmware development
I've seen the 3 60d builds and the 2 550d hdr builds, and that made me
think they are slightly different than the ones posted here.

Deti

unread,
Jan 3, 2011, 10:23:40 AM1/3/11
to ml-d...@googlegroups.com
On 01/03/2011 01:42 PM, Alex wrote:
> I've seen the 3 60d builds and the 2 550d hdr builds, and that made me
> think they are slightly different than the ones posted here.
Alex, I am very familiar with the open source concept as I am a Linux
kernel developer (check the sources for my name). All my patches for
Magic Lantern will end up in the official repository.

Deti

Jason Carrier

unread,
Jan 4, 2011, 4:14:10 AM1/4/11
to ml-d...@googlegroups.com
which modules are needed for booting and which are extra?



Deti

Alex

unread,
Jan 4, 2011, 4:25:03 AM1/4/11
to ml-d...@googlegroups.com
My (not so) minimal build for experimenting with the "MagicLOO" is this:

# magiclantern.lds script MUST be first
# entry.o MUST be second
# menu.o and debug.o must come before the modules
ML_OBJS-y = \
magiclantern.lds \
entry.o \
5d-hack.o \
stubs-550d.109.o \
version.o \
bmp.o \
font-large.o \
font-med.o \
font-small.o \
config.o \
menu.o \
debug.o \
stdio.o \
lens.o \
property.o \
gui.o \

NO=\
audio.o \
bootflags.o \
zebra.o \
shoot.o \
focus.o \
hotplug.o \
bracket.o \
ptp.o \
spotmeter.o \

Comment out config file parsing from 5d-hack (or debug.c). I think you
can also remove lens.

Jason Carrier

unread,
Jan 4, 2011, 4:30:59 AM1/4/11
to ml-d...@googlegroups.com
thanks, hoping to get the buttons figured out by the end of the week

Jason Carrier

unread,
Jan 5, 2011, 2:47:17 AM1/5/11
to ml-d...@googlegroups.com
How do you know when the camera is fully initialized?

Alex

unread,
Jan 5, 2011, 2:54:51 AM1/5/11
to ml-d...@googlegroups.com
Well... when you can take pictures with it :)

Jason Carrier

unread,
Jan 5, 2011, 3:19:43 AM1/5/11
to ml-d...@googlegroups.com
thats a painfully simple answer ;)

Alex

unread,
Jan 5, 2011, 3:22:35 AM1/5/11
to ml-d...@googlegroups.com
That's why we used delays in init code...

Jason Carrier

unread,
Jan 5, 2011, 3:29:53 AM1/5/11
to ml-d...@googlegroups.com
Hey everyone, who wants to hook some keys with their 60D ??? eh eh? im exhauuuuuusted. I had my first ever funeral photo gig and no one spoke the only language that i know. english. because im a typical American. I also had no idea what was going on or what kind of pictures they wanted. Buddhist funeral culture is over my head.

anyways firmware is attached. I can post source if needed? its nothing special.

NOTE: make sure you pull your battery out when you're done. The SD led stays on and i dont know why or what its doing.
autoexec.bin

Jason Carrier

unread,
Jan 5, 2011, 3:34:32 AM1/5/11
to ml-d...@googlegroups.com
hey wait wrong file, that one works too, but this one will be far easier to hook with.

Jason Carrier

unread,
Jan 5, 2011, 3:35:15 AM1/5/11
to ml-d...@googlegroups.com
as i forget the file. The first one is reading all memory events, this one is just button related things.. i think.. like i said, im new
autoexec.bin

Jason Carrier

unread,
Jan 5, 2011, 3:39:22 AM1/5/11
to ml-d...@googlegroups.com
trash can reads 0 f=ff0248x4 p=0000000c o=00000000 a=00000000
up  press : 0 f=ff0248x4 p=00000024 o=00000000 a=00000000
up release :0 f=ff0248x4 p=0000002c o=00000000 a=00000000

now the interesting part (for me at least
down  press : 0 f=ff0248x4 p=00000028 o=00000000 a=00000000
 down release :0 f=ff0248x4 p=0000002c o=00000000 a=00000000

Alex

unread,
Jan 5, 2011, 3:47:09 AM1/5/11
to ml-d...@googlegroups.com
Good, so menu should come up by putting 0xC instead of 0xA. You should
arrive at this step:
http://groups.google.com/group/ml-devel/msg/07ce8d093453b747

On 550D, press/release codes are consecutive (e.g. 1c = press left, 1d
= unpress left).

Jason Carrier

unread,
Jan 5, 2011, 3:53:46 AM1/5/11
to ml-d...@googlegroups.com
it seems that on the 60D, at least for the dirrectional buttons that they're all the same unpress code.

also, im not sure what step that is? just enabling the menu?

Alex

unread,
Jan 5, 2011, 3:59:31 AM1/5/11
to ml-d...@googlegroups.com
yes, just enabling the menu (without the navigaton).

If you are lucky and the other set of button codes are the same as on
550D, navigation may work out of the box.

Jason Carrier

unread,
Jan 5, 2011, 4:49:06 AM1/5/11
to ml-d...@googlegroups.com
kinda doubt it

Alex

unread,
Jan 5, 2011, 4:50:42 AM1/5/11
to ml-d...@googlegroups.com
Didn't work at all?

Jason Carrier

unread,
Jan 5, 2011, 4:52:48 AM1/5/11
to ml-d...@googlegroups.com
didnt try yet, not around my camera at the moment but im pretty sure about half the buttons are different. It might be similar to the 5D however?.. the dial and all

Alex

unread,
Jan 5, 2011, 5:06:39 AM1/5/11
to ml-d...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
See https://bitbucket.org/a1ex/magic-lantern/history/gui.h and
https://bitbucket.org/hudson/magic-lantern/history/gui.h

=> many codes identical with the 5D; when I've enabled the menu, no
change to gui.h was needed.

Jason Carrier

unread,
Jan 5, 2011, 6:05:54 PM1/5/11
to ml-d...@googlegroups.com
Issue:  when I hit the menu button, it pops up, which is good. But it then stops responding and even if i turn the camera off nothing happens, have to pull the battery.

Alex

unread,
Jan 5, 2011, 6:09:54 PM1/5/11
to ml-d...@googlegroups.com
Now you need to troubleshoot the menu task and turn on event dump from
there. In 550 ML, that's toggle draw_event.

> have to pull the battery
This is good, menu task started and blocks events. Now find the new
button codes.

Jason Carrier

unread,
Jan 5, 2011, 6:15:20 PM1/5/11
to ml-d...@googlegroups.com
yes but i couldn't turn the menu off. Also i do have a large portion of the modules turned off.. do you think that could make it hate me?

Alex

unread,
Jan 5, 2011, 6:16:10 PM1/5/11
to ml-d...@googlegroups.com
You don't have to turn it off (in fact, you need it on to dump events).

Jason Carrier

unread,
Jan 5, 2011, 6:18:14 PM1/5/11
to ml-d...@googlegroups.com
well yeah.. but shouldnt it turn off if i hit the trash bin again?

Alex

unread,
Jan 5, 2011, 6:27:15 PM1/5/11
to ml-d...@googlegroups.com
It depends on who's sending the trash bin message for gui_main_task.
If that comes from an event blocked by the menu_handler (return 0),
you won't receive it.

Latest builds return 1 whenever possible (from menu_handler). This is
the reason for menu flickering: I'm not blocking the events in order
to leave the camera as stable as possible (and some of those events
trigger redraws). It's annoying, but at least it works.

What you have to do now is to troubleshoot menu_handler (put
bmp_printf's or debugmsgs and see what codes it receives).

Jason Carrier

unread,
Jan 7, 2011, 9:22:53 PM1/7/11
to ml-d...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
I wont be working on this for the next week, got really busy. However I still frequent the google group so if anyone else is working on the 60D source I can still help

xaos

unread,
Jan 7, 2011, 10:02:00 PM1/7/11
to ml-d...@googlegroups.com
Any new sources or bin to test with my 60d? :)

Jason Carrier

unread,
Jan 7, 2011, 10:33:19 PM1/7/11
to ml-d...@googlegroups.com
I have a autoexec with the menu enabled but it crashes the camera. Wont turn off and the sensor stops capturing but it keeps an image up. So.. no haha

On Fri, Jan 7, 2011 at 7:02 PM, xaos <hipo...@gmail.com> wrote:
Any new sources or bin to test with my 60d? :)

--

xaos

unread,
Jan 8, 2011, 5:29:49 AM1/8/11
to ml-d...@googlegroups.com
Could you sent me your sources or diff's?

Jason Carrier

unread,
Jan 8, 2011, 5:41:54 AM1/8/11
to ml-d...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
yeah, i'll send them in the morning when i have access to them

Alex

unread,
Jan 9, 2011, 4:35:35 AM1/9/11
to ml-d...@googlegroups.com
I think it will be useful for other 60D developers to see this discussion between xaos and me.

---------- Forwarded message ----------
From: Alex <broscu...@gmail.com>
Date: Sun, Jan 9, 2011 at 11:30 AM
Subject: Re: 60d and ml
To: xaos <hipo...@gmail.com>


Yes, that's one.

Next, the menu uses other set of button codes. Look in menu.c.

There is:
- menu_task (which is woke up by gui_main_task when you press Del... the semaphores do this)
- menu_handler: this receives button codes.

Next step (after menu appears): find button codes which arrive at menu_handler (use DebugMsg or bmp_printf).

On Sun, Jan 9, 2011 at 10:02 AM, xaos <hipo...@gmail.com> wrote:
No problem with compile and run minimal ml.

"menu should come up by putting 0xC instead of 0xA" - you mean in
gui.c at this line?
if( gui_state != GUISTATE_PLAYMENU && event->type == 0 && event->param
== 0xA ) // trash button

Somewhere else? I attached my full dump file with pressing erase/trash
button. Any advice what next?



On Sun, Jan 9, 2011 at 6:30 AM, Alex <broscu...@gmail.com> wrote:
> Hello,
> Are you able to compile and run your code?
>
> See the advice I've given to Jason, and:
> http://magiclantern.wikia.com/wiki/Debugging_Magic_Lantern
> http://magiclantern.wikia.com/wiki/550d_dev
>
> On Sun, Jan 9, 2011 at 3:13 AM, xaos <hipo...@gmail.com> wrote:
>>
>> Hello Alex.
>>
>> I have a new 60d to bricking :) Could you help me with debug 60d to
>> activate menu. Up to now I have working firmware from
>> http://magiclantern.wikia.com/wiki/60D. What I shoud do next?
>>
>> Regards, xaos.
>
>


xaos

unread,
Jan 9, 2011, 3:13:05 PM1/9/11
to ml-d...@googlegroups.com
Thanks Alex, thanks Jason.

I have enabled the menu and navigaton (4 from 8-way controller)
without DISP button. Some things work out of the box but some make the
camera freeze. No brick for now, but who know when... :) I have
uploaded the video to show where I am with code. Alex, Indy what
should I do next? How to eliminate freezes? Alex, should I send you
modified sources?

xaos

P.S. http://www.youtube.com/watch?v=m28QmqnzMys (some debugs at screen)

Jason Carrier

unread,
Jan 9, 2011, 3:15:04 PM1/9/11
to ml-d...@googlegroups.com
totally dont need my source lol.

xaos

unread,
Jan 9, 2011, 3:34:54 PM1/9/11
to ml-d...@googlegroups.com
Yeah, Sunday at work :)

Problem with auto-disabling - don't start again. Second press
trash/erase freezes cam.

Menu Audio - all ok and working (without ext mic, not tested)
Menu Video - ok, but
CropM: - Error
Shot - ok, but
Intervalometr: OFF/ON - Error (reboot)
LCD RemoteShot: - Error (reboot)
Brack - ok, but
Test bracket - Error

I think that is a problem with disabling menu and accessing card (save
config rebooted cam).

Jason Carrier

unread,
Jan 9, 2011, 3:38:08 PM1/9/11
to ml-d...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
i can test ext mic for you sometime this week. Theres a lot of things the 60D doesnt need that the t2i does. like the histogram for example, it has one.


--

Alex

unread,
Jan 9, 2011, 4:03:32 PM1/9/11
to ml-d...@googlegroups.com
xaos,

Do you have FONT_LARGE enabled? if yes, remove it. It may be a good idea to merge with my latest sources, since I've got rid of many crashes in 2011 builds.

Also look at my changes in menu.c (especially return values from menu_handler).

arm.indy

unread,
Jan 9, 2011, 5:13:04 PM1/9/11
to Magic Lantern firmware development
Xaos,

good work!

yes, please submit a patch or the modified files.

do you have a bitbucket account ?
I can try setting up write access for you on 60d branch.

Indy


On 9 jan, 21:13, xaos <hipotu...@gmail.com> wrote:
> Thanks Alex, thanks Jason.
>
> I have enabled the menu and navigaton (4 from 8-way controller)
> without DISP button. Some things work out of the box but some make the
> camera freeze. No brick for now, but who know when... :) I have
> uploaded the video to show where I am with code. Alex, Indy what
> should I do next? How to eliminate freezes? Alex, should I send you
> modified sources?
>
> xaos
>
> P.S.http://www.youtube.com/watch?v=m28QmqnzMys(some debugs at screen)
>
> On Sun, Jan 9, 2011 at 10:35 AM, Alex <broscutama...@gmail.com> wrote:
> > I think it will be useful for other 60D developers to see this discussion
> > between xaos and me.
>
> > ---------- Forwarded message ----------
> > From: Alex <broscutama...@gmail.com>
> > Date: Sun, Jan 9, 2011 at 11:30 AM
> > Subject: Re: 60d and ml
> > To: xaos <hipotu...@gmail.com>
>
> > Yes, that's one.
>
> > Next, the menu uses other set of button codes. Look in menu.c.
>
> > There is:
> > - menu_task (which is woke up by gui_main_task when you press Del... the
> > semaphores do this)
> > - menu_handler: this receives button codes.
>
> > Next step (after menu appears): find button codes which arrive at
> > menu_handler (use DebugMsg or bmp_printf).
>
> > On Sun, Jan 9, 2011 at 10:02 AM, xaos <hipotu...@gmail.com> wrote:
>
> >> No problem with compile and run minimal ml.
>
> >> "menu should come up by putting 0xC instead of 0xA" - you mean in
> >> gui.c at this line?
> >> if( gui_state != GUISTATE_PLAYMENU && event->type == 0 && event->param
> >> == 0xA ) // trash button
>
> >> Somewhere else? I attached my full dump file with pressing erase/trash
> >> button. Any advice what next?
>
> >> On Sun, Jan 9, 2011 at 6:30 AM, Alex <broscutama...@gmail.com> wrote:
> >> > Hello,
> >> > Are you able to compile and run your code?
>
> >> > See the advice I've given to Jason, and:
> >> >http://magiclantern.wikia.com/wiki/Debugging_Magic_Lantern
> >> >http://magiclantern.wikia.com/wiki/550d_dev
>

arm.indy

unread,
Jan 9, 2011, 5:15:27 PM1/9/11
to Magic Lantern firmware development
could you please send to Alex and me (privately) your last log00*.log
file ?
it may help understand what is happening

Indy

On 9 jan, 21:13, xaos <hipotu...@gmail.com> wrote:
> Thanks Alex, thanks Jason.
>
> I have enabled the menu and navigaton (4 from 8-way controller)
> without DISP button. Some things work out of the box but some make the
> camera freeze. No brick for now, but who know when... :) I have
> uploaded the video to show where I am with code. Alex, Indy what
> should I do next? How to eliminate freezes? Alex, should I send you
> modified sources?
>
> xaos
>
> P.S.http://www.youtube.com/watch?v=m28QmqnzMys(some debugs at screen)
>
> On Sun, Jan 9, 2011 at 10:35 AM, Alex <broscutama...@gmail.com> wrote:
> > I think it will be useful for other 60D developers to see this discussion
> > between xaos and me.
>
> > ---------- Forwarded message ----------
> > From: Alex <broscutama...@gmail.com>
> > Date: Sun, Jan 9, 2011 at 11:30 AM
> > Subject: Re: 60d and ml
> > To: xaos <hipotu...@gmail.com>
>
> > Yes, that's one.
>
> > Next, the menu uses other set of button codes. Look in menu.c.
>
> > There is:
> > - menu_task (which is woke up by gui_main_task when you press Del... the
> > semaphores do this)
> > - menu_handler: this receives button codes.
>
> > Next step (after menu appears): find button codes which arrive at
> > menu_handler (use DebugMsg or bmp_printf).
>
> > On Sun, Jan 9, 2011 at 10:02 AM, xaos <hipotu...@gmail.com> wrote:
>
> >> No problem with compile and run minimal ml.
>
> >> "menu should come up by putting 0xC instead of 0xA" - you mean in
> >> gui.c at this line?
> >> if( gui_state != GUISTATE_PLAYMENU && event->type == 0 && event->param
> >> == 0xA ) // trash button
>
> >> Somewhere else? I attached my full dump file with pressing erase/trash
> >> button. Any advice what next?
>
> >> On Sun, Jan 9, 2011 at 6:30 AM, Alex <broscutama...@gmail.com> wrote:
> >> > Hello,
> >> > Are you able to compile and run your code?
>
> >> > See the advice I've given to Jason, and:
> >> >http://magiclantern.wikia.com/wiki/Debugging_Magic_Lantern
> >> >http://magiclantern.wikia.com/wiki/550d_dev
>

xaos

unread,
Jan 9, 2011, 6:43:59 PM1/9/11
to ml-d...@googlegroups.com
It is possible that value 0xff3065bc for gui_task_destroy is incorrect?

Jason Carrier

unread,
Jan 10, 2011, 6:04:28 PM1/10/11
to ml-d...@googlegroups.com
could I get your source actually?

Alex

unread,
Jan 11, 2011, 4:58:38 AM1/11/11
to ml-d...@googlegroups.com
Hi,

See this page for hints on how to find VRAM segments (on 60D or any
other camera):
http://magiclantern.wikia.com/wiki/VRAM/550D

arm.indy

unread,
Jan 11, 2011, 9:37:48 AM1/11/11
to Magic Lantern firmware development
See consts-60d.108.h there may be remaining hardcoded values I forgot
(display_sensor?) And still related to 550d
Indy

On 11 jan, 10:58, Alex <broscutama...@gmail.com> wrote:
> Hi,
>
> See this page for hints on how to find VRAM segments (on 60D or any
> other camera):http://magiclantern.wikia.com/wiki/VRAM/550D
>
>
>
> On Tue, Jan 11, 2011 at 1:04 AM, Jason Carrier <jsncarr...@gmail.com> wrote:
> > could I get your source actually?
>
> > On Sun, Jan 9, 2011 at 3:43 PM, xaos <hipotu...@gmail.com> wrote:
>
> >> It is possible that value 0xff3065bc for gui_task_destroy is incorrect?
>

xaos

unread,
Jan 17, 2011, 9:15:11 AM1/17/11
to ml-d...@googlegroups.com
Yes, it's hardcoded (display_sensor). How can I get this value for
60d? With http://magiclantern.wikia.com/wiki/Memory_Addresses is a
little helper, but I don't know, what should I be looking for..

P.S. I attached a patch needed to enable menu (to version try2).

menu.patch.gz

Alex

unread,
Jan 17, 2011, 9:23:39 AM1/17/11
to ml-d...@googlegroups.com
Basically, you should look for a value which is 0 when display sensor
is active and 1 when it's not (or viceversa). Or it may be just a bit
which toggles.

In 550D I've found 2 possible values:
#define DISPLAY_SENSOR 0x2dec
#define DISPLAY_SENSOR_MAYBE 0xC0220104

=> scan around these addresses with mem-spy.

xaos

unread,
Jan 17, 2011, 10:30:52 AM1/17/11
to ml-d...@googlegroups.com
Ok, you mean "Two panels below the finder eyepiece control the
display-off sensor, which switches off the LCD screen when your eye is
near the viewfinder."? Oops, there is no eye-sensor to control the LCD
display on the 60D, I'll "ifdef" this code for 60d.

Alex

unread,
Jan 17, 2011, 10:38:15 AM1/17/11
to ml-d...@googlegroups.com
Huh? So you have to turn off the LCD manually every time you look
through the viewfinder?!

xaos

unread,
Jan 17, 2011, 10:58:19 AM1/17/11
to ml-d...@googlegroups.com
Anytime you half-press the shutter button, the display will turn
off... There is no problem, but RemoteShot is a great idea :(

Alex

unread,
Jan 17, 2011, 11:17:07 AM1/17/11
to ml-d...@googlegroups.com
Hmm... and I always use half-shutter to redraw the screen and get
metering info in manual mode...

You can use the audio trigger instead. Does the 60D have some other
sensor? like for adjusting the backlight? (I've heard that 5D2 does
that)

On Mon, Jan 17, 2011 at 5:58 PM, xaos <hipo...@gmail.com> wrote:
> Anytime you half-press the shutter button, the display will turn
> off... There is no problem, but RemoteShot is a great idea :(
>

xaos

unread,
Jan 17, 2011, 3:06:08 PM1/17/11
to ml-d...@googlegroups.com
Possible (more or less) remote triggers (60D):
* IR remote sensor - I don't think that it will be possible to
trigger this way (human body temperature)
* wireless flash triggering (maybe by external flash, in live view mode)
and, of course
* audio trigger

Alex

unread,
Jan 17, 2011, 3:11:11 PM1/17/11
to ml-d...@googlegroups.com
:) you may try to trigger the camera by flashing with a compact

Or you may try to port CHDK's motion detection routine ;)

Or you may use focus peaking info to implement trap focus in LiveView mode.

xaos

unread,
Jan 23, 2011, 5:08:47 PM1/23/11
to ml-d...@googlegroups.com
Stable recording (audio+video) with ML for over 4 hours (max temp: 201
/canon scale/) :)

Problem with gui_task_destroy resolved about week ago:

grep -i gui_task_destroy stubs-60d.108.S
NSTUB( 0xff3065bc, gui_task_destroy )
NSTUB( 0xFF2B4D30, gui_task_destroy )

Value 0xff3065bc is correct.


What doesn't work? Silence picture (no surprise) and
LoadCalendarFromRTC (Err 80). Any ideas with LoadCalendarFromRTC..?


I merged (partially) my build with latest sources for 550d, but Alex
is so fast with coding... :)

P.S. Example from my bench tests:
Stable video recording (no audio) with qscale=-16 and ISO=3200
VIDEO: [H264] 1920x1088 24bpp 25.000 fps 89150.9 kbps (10882.7 kbyte/s)
Audio: no sound
Transcend SDHC class 10, 32GB

arm.indy

unread,
Jan 24, 2011, 5:57:56 PM1/24/11
to Magic Lantern firmware development
FF068204 LoadCalendarFromRTC

Indy

xaos

unread,
Jan 24, 2011, 7:37:54 PM1/24/11
to ml-d...@googlegroups.com
On Mon, Jan 24, 2011 at 11:57 PM, arm.indy <arm.i...@gmail.com> wrote:
> FF068204 LoadCalendarFromRTC
Thank You, it works :)

I have next ones - FIO_FindFirstEx & FIO_FindNextEx
Is it possible to generate new stubs for 60d?

x.

Alex

unread,
Jan 25, 2011, 1:04:21 AM1/25/11
to ml-d...@googlegroups.com
Not verified:
0xFF1C7760 (FIO_FindFirst_maybe) === 0xFF1CB510 (mean=21, stdev=6.6, num=6)
findnext: 0xFF1C7854 === 0xFF1CB604 (mean=22, stdev=6.6, num=5)

What's missing next?

arm.indy

unread,
Jan 25, 2011, 6:38:11 AM1/25/11
to Magic Lantern firmware development
FF1CB510 FIO_FindFirst
FF1CA93C FIO_SetFileAttributes
FF1CB780 FIO_FindNextEx
or
FF1CB604 FIO_FindNextEx_0

On 25 jan, 07:04, Alex <broscutama...@gmail.com> wrote:
> Not verified:
> 0xFF1C7760 (FIO_FindFirst_maybe) === 0xFF1CB510 (mean=21, stdev=6.6, num=6)
> findnext: 0xFF1C7854 === 0xFF1CB604 (mean=22, stdev=6.6, num=5)
>
> What's missing next?
>
> On Tue, Jan 25, 2011 at 2:37 AM, xaos <hipotu...@gmail.com> wrote:

arm.indy

unread,
Jan 25, 2011, 6:39:11 AM1/25/11
to Magic Lantern firmware development
Xaos,
do you have (want) write access to 60d branch ?

Indy

On 25 jan, 07:04, Alex <broscutama...@gmail.com> wrote:
> Not verified:
> 0xFF1C7760 (FIO_FindFirst_maybe) === 0xFF1CB510 (mean=21, stdev=6.6, num=6)
> findnext: 0xFF1C7854 === 0xFF1CB604 (mean=22, stdev=6.6, num=5)
>
> What's missing next?
>
> On Tue, Jan 25, 2011 at 2:37 AM, xaos <hipotu...@gmail.com> wrote:

xaos

unread,
Jan 25, 2011, 11:34:11 AM1/25/11
to ml-d...@googlegroups.com
FF1CB510 FIO_FindFirst - correct
FF1CB780 FIO_FindNextEx - incorrect, not working
FF1CB604 FIO_FindNextEx_0 - correct
Thank you, Alex, Indy.

=Alex=
I merged sources for 550d rev 819 (Mon Jan 24 22:06:47 2011 +0200) and
main problem I have now is to determine
* FreeMemory addr
* FOCUS_CONFIRMATION

draw_zebra_and_focus():
* YUV422_LV_BUFFER
* YUV422_HD_BUFFER
(err 70)

Silent pic

I have read
http://magiclantern.wikia.com/wiki/VRAM/550D
http://magiclantern.wikia.com/wiki/VRAM
http://magiclantern.wikia.com/wiki/ASM_Zedbra
but without success. I have dumps for 0-7 segments x3 (LV, CAM LV, CAM
LV REC) but I don't understand how you found e.g. address
0x04000080...
You can find all my dumps (gzipped) here http://andromeda.ap.krakow.pl/60d/

=Indy=
I don't have but now I want :) I will disable all not working code
(lv buffers, lcd remote shot).

Alex

unread,
Jan 25, 2011, 11:43:14 AM1/25/11
to ml-d...@googlegroups.com
AllocateMemory 0xFF06FFD0
FreeMemory 0xFF070360

Will look at the dumps. Did it freeze at segment 8? (550D does).

Antony Newman

unread,
Jan 25, 2011, 12:11:13 PM1/25/11
to ml-d...@googlegroups.com
Xaos,


"I don't understand how you found e.g. address 0x04000080..."

I wrote a few routines .. a bit like the code below.

Alex used Fourier analysis.

AJ






/************************************************************************************************
*  aj_find_changing_memory()  *   CCC
*************************************************************************************************/
#define AJ_changing_max_sections 1   // 400  AJAJ FIX to use this
#define AJ_changing_chunk_size 1     // 8192    // be Careful about increasig this.
                                       // Something breaks when this is 16384
                                       // ended up having to wipe out the magic lantern cfg!
void aj_find_changing_memory( void )
{
   unsigned int  min_segment_size=8192;               // in bytes.  Previously 16384
   unsigned int  consider_static_segment_after=32770; // 1024;   // in bytes.

   unsigned int x;
   static unsigned int vram_width_displayed = 240;

   static unsigned int scan_state = 0;   /* 0 = not done   = Waiting for focus to change
                                            1 = scanning,
                                            2 = done */

//JJJJ
   static unsigned int mem_ptr              = 0x60000000;     // Start of scan whole of memory
   unsigned int        top_of_mem_to_search = 0x7F000000;     // End of scan = 0xFFFF0000  
 

   unsigned int        first_log_seg_num    = 34;              // fname num of first segment

   static unsigned int first_time = 1;

   // chunk is the bit of memory that we copy between calls to compare with last call

   static unsigned int in_changing_chunk =0;    // =1 when in a changing chunk  
   static unsigned int chunk[AJ_changing_chunk_size];

   // Sections will contain the start and end addresses of what we find

   static unsigned int section_start[AJ_changing_max_sections];
   static unsigned int section_end[AJ_changing_max_sections];
   static unsigned int sections_found=0;
    
  
   /**************************************
   *  If we are scanning through memory  *
   **************************************/

   if (scan_state == 1)
   {
      bmp_printf( FONT_MED, 0, 16 * 0,
                  "Scan[%X] ", mem_ptr);
     
      if ( first_time == 0)   // first_time=0 if not first time.  
      {                       // first_time=1 if first time
         /***********************************************************************
         *  If NOT first time - compare previously captured chunk with memory   *
         ***********************************************************************/
             
         for(x=0; x<AJ_changing_chunk_size; x ++)
         {
            /**********************************************
            *  If we are in a section of 'static' data'   *
            **********************************************/

            if (in_changing_chunk == 0)
            {
               /********************************************
               *  If it is still static - then do nothing  *
               ********************************************/

               if ( chunk[x] == * (unsigned int *) mem_ptr)
               {
                    // do nothing 
               }
               else
               /*********************************************
               * We going from Static -> Changing data area *
               *********************************************/
               {
                  section_start[sections_found] = mem_ptr;  
                  section_end[sections_found] = mem_ptr;   // Mark the end as the start for now
                  in_changing_chunk = 1;
               }
            
            }
            else
            /************************************************
            *  If we are in a section of 'changing' data'   *
            ************************************************/
            {
               /************************************************
               *  If the data is different - mark the new end  *
               ************************************************/
               if ( chunk[x] != * (unsigned int *) mem_ptr)
               {
                  section_end[sections_found] = mem_ptr;
               }
               else
               /*************************************************
               *  Once the data has not changed for a period    *
               *  we know we have found the end of the segment  *                   
               ************************************************/
               {
                  if (mem_ptr - section_end[sections_found] > consider_static_segment_after)
                  {
                     /****************************************************************************
                     *  if static gap after segment is large enough,we've found end of a segment *
                     ****************************************************************************/
                     in_changing_chunk = 0;   // change back to not being in changing memory

                     /****************************
                     *  How big is the segment?  *
                     ****************************/

                     if ( section_end[sections_found] - section_start[sections_found] >
                          min_segment_size )
                     {
                        /*****************************************
                        *  Here if segment size is large enough  *
                        *****************************************/
                        sections_found ++;  /* = 1 when one section found */
                        bmp_printf( FONT_SMALL, 180, 16 * 0,"C=%d ", sections_found);
                     }
                     else
                     {
                        /******************************************
                        *  Here if segment size is was too small  *
                        *****************************************/
                        static unsigned int rejected_segments = 0;
                        rejected_segments++;

                        bmp_printf( FONT_SMALL, 250, 16 * 2,
                                    "rjcted=%d lstSz=%d", rejected_segments,
                                    section_end[sections_found] - section_start[sections_found]);

                        section_start[sections_found] = 0;  // reset for completeness
                        section_end[sections_found] = 0;    // reset for completeness
                     }
                  }
                  else
                  {
                     /*********************************************************************
                     *  Here if the static gap after the segment is not yet large enough  *
                     *********************************************************************/

                     // do nothing
                  }
               } /* end of (in_changing_chunk != 0) */
            } /* end of if (in_changing_chunk ==0) / else  (in_changing_chunk !=0)  */

            /**********************************************************
            * Do we have any array space left to list more segments?  *
            **********************************************************/
      
            if (sections_found == AJ_changing_max_sections)
            {
               scan_state = 2;  /* ran out of space */
               bmp_printf( FONT_SMALL, 180, 16 * 0,"C=%d+ ", sections_found);
               bmp_printf( FONT_SMALL, 0, 16 * 0, "            ");
            }
               
            /****************************************************
            * Move memory pointer on to next 4 bytes in memory  *
            ****************************************************/
    
            mem_ptr += 4;

            /**************************************************************
            *  If we have scanned through memory  - Dump structure to CF  *
            **************************************************************/

            if (mem_ptr > top_of_mem_to_search)
            {

               /****************************************************
               *  If we were in the middle of a chunk - include it *
               ****************************************************/

               if (in_changing_chunk == 1)             
               {  
                  bmp_printf( FONT_SMALL, 250, 16 * 3,
                     "Adding Unfinished section ");

                  sections_found ++; 
               }

               /*****************************
               *  Dump out sections to CF  *
               *****************************/

               unsigned int dump_ele;

               scan_state = 2;  /* ie scan complete */        
               bmp_printf( FONT_SMALL, 0, 16 * 0, "Scan Complete  ");

               /*************************************
               *  Write memory details to log file  *
               *************************************/
 
               if (aj_create_log_file( "A:/aj.log" ) == 0)
               {
                  bmp_printf( FONT_LARGE, 0, 16 * 0, "Err: creating aj.log  ");
                  break;
               }


               for( dump_ele=0; dump_ele < sections_found; dump_ele++)
               {

                  fprintf( g_aj_logfile,
                             "Seg=%d Start=%X End=%X Size=%X\n", 
                           first_log_seg_num + dump_ele,
                           section_start[dump_ele],
                           section_end[dump_ele],
                           section_end[dump_ele] - section_start[dump_ele] +4
                        );                
               }

               aj_close_log_file();

                 

               /***********************************
               * Now dump the Fragments to disc   *
               ***********************************/              

               for( dump_ele=0; dump_ele < sections_found; dump_ele++)
               {
                  unsigned int segment_num;

                  segment_num = first_log_seg_num + dump_ele;

                  char seg_fname[0x12];

                  seg_fname[0x00] = 'A';    // no sprintf (AI found sig?)
                  seg_fname[0x01] = ':';
                  seg_fname[0x02] = '/';
                  seg_fname[0x03] = 'a';
                  seg_fname[0x04] = 'j';
                  seg_fname[0x05] = '_';
                  seg_fname[0x06] = 's';
                  seg_fname[0x07] = 'e';
                  seg_fname[0x08] = 'g';
                  seg_fname[0x09] = (char)  (  (segment_num / 100) % 10) + 48;
                  seg_fname[0x0A] = (char)  (  (segment_num / 10 ) % 10) + 48;
                  seg_fname[0x0B] = (char)  (  (segment_num      ) % 10) + 48;
                  seg_fname[0x0C] = '.';
                  seg_fname[0x0D] = 'l';
                  seg_fname[0x0E] = 'o';                 
                  seg_fname[0x0F] = 'g';
                  seg_fname[0x10] =  0;
                 
                  bmp_printf( FONT_SMALL, 400, 16 * 4,
                              "%s %d ",
                              seg_fname, segment_num);

                  if (aj_create_log_file( seg_fname ) == 0)
                  {
                      bmp_printf( FONT_LARGE, 0, 16 * 0,
                                  "Err fcreate %d",
                                  segment_num);
                      break;
                  }
                  else
                  {
                      bmp_printf( FONT_LARGE, 0, 16 * 0, "Writing seg %d to CF!  ",
                                  segment_num);
                  }
                 
              
                  unsigned int write_length = section_end[dump_ele] - section_start[dump_ele] +4;

                  FIO_WriteFile( g_aj_logfile,
                                 (const void *) section_start[dump_ele],
                                 write_length
                               );
              
                  aj_close_log_file();
               }

              

               /***************************************
               *  Here if everthing has been created  *
               ***************************************/

               bmp_printf( FONT_LARGE, 0, 16 * 0, "SUCCESS -> CF Ready  ");
             
               break;

            } /* end of if mem_ptr > end of memory to search */

         } /* end of comparing previous chunk / copying in new sect info */

      }  /* end of if (first_time == 0) */




      /****************************************************************
      * if this is was the first time, there was not data to compare  *
      * against - just copy in vram data for next pass                *
      ****************************************************************/
 
      if (first_time == 1)
      {
         first_time = 0;
      }
  

      /**********************************************************************************
      *  copy in chunk of memory into array - maintain mem_ptr for next pass of routine *
      **********************************************************************************/
    
      unsigned int tmp_ptr = mem_ptr;

      for(x=0; x<AJ_changing_chunk_size; x ++)
      {
         if (tmp_ptr > top_of_mem_to_search)
         {
            bmp_printf( FONT_SMALL, 0, 16 * 5, "tmp_ptr > top_of_mem_to_search ");   // AJFIX

            break;    /* end of memory reached! */
         }

         chunk[x] = * (unsigned int *) tmp_ptr;
         tmp_ptr += 4;
      }


   } /* end of if (scan_state == 1)  ie scanning memory */

 
   /**************************************
   * If first time here - record focus   *
   **************************************/

   static unsigned int last_focus=9999;   // 9999 = this is first time routine called

   if (last_focus == 9999)
   {
      last_focus = lens_info.focus_dist;   // init to current focus
      return;
   }
 
   /**************************************
   *  Only start scanning first time     *
   *  when focus is altered.             *
   **************************************/

   if ( (scan_state == 0)  &&
        last_focus != lens_info.focus_dist)
   {  
       scan_state = 1;
       return;
   }


   /********************************
   *  If no chunks available to    *
   *  display - then return        *
   ********************************/

   if ( sections_found == 0)
   {
       return;
   }


   /*************************************************************************
   *  Here only if there are Chunks available to Display available chunks   *
   *  What is the velocity (lines of vram / frame) that user has selected?  *
   *************************************************************************/

   static int vram_velocity = 0;
 
   if  (lens_info.focus_dist != last_focus)
   {
      vram_velocity = last_focus - lens_info.focus_dist ;

      /*  If focus changes by a small amount - make it zero */

      vram_velocity = vram_velocity / 4;

      if ( aj_abs( vram_velocity ) < 7 )
      {
          vram_velocity = 0;
      }
      else if ( aj_abs( vram_velocity ) < 22)
      {
          vram_velocity = vram_velocity/3;
      }

      if (vram_velocity < -22)
      {
         last_focus = lens_info.focus_dist;
         vram_velocity = -22;
      }
      else if (vram_velocity > 22)
      {
         last_focus = lens_info.focus_dist;
         vram_velocity = 22;
      }
     


      bmp_printf( FONT_SMALL, 500, 16 * 2,
                   "V=%d   ",   
                   vram_velocity);                  
   }

 
   /*************************************************************************
   *  Update vram position                                                  *
   *************************************************************************/

   static unsigned int set_vram_address_to_first_chunk=1;
   static unsigned int vram_addr;     
   static unsigned int viewing_chunk;
 
 
   if (set_vram_address_to_first_chunk == 1)
   {
      viewing_chunk = 0;
      vram_addr = section_start[0];
      set_vram_address_to_first_chunk = 0;
   }

   /***************************************************
   *  Only move through vram if there is space to     *
   *  move forward or backward.                       *
   ***************************************************/
 
   unsigned int vram_change = aj_abs(vram_velocity) * vram_width_displayed;

   if (  (vram_velocity > 0)    &&
         (vram_addr < section_end[sections_found-1] - vram_change) 
      )
   {
      vram_addr += vram_change;
   }
   else if (  (vram_velocity < 0)  &&
              (vram_addr > section_start[0] + vram_change) 
           ) 
   {
      vram_addr -= vram_change;
   }


   /***************************************************
   *  If vram address is beyond the range of the      *
   *  current section - adjust to next section        *
   ***************************************************/

   if (vram_addr < section_start[viewing_chunk])     // Before Start of current segment
   {
       if (viewing_chunk >0 )
       {
          viewing_chunk--;
          vram_addr = section_end[viewing_chunk] - vram_width_displayed;
       }
       else // viewing_chunk == 0
       {
          vram_addr = section_start[0];
       }
   }
   else if (vram_addr > section_end[viewing_chunk])   // After End of current segment
   {
       if (viewing_chunk < sections_found -1 )
       {
          viewing_chunk++;
          vram_addr = section_start[viewing_chunk];  /* start of next section */
       }
       else  /* viewing_chunk = sections_found */
       {
          vram_addr = section_end[viewing_chunk] - vram_width_displayed; 
       }
      
   }

   /***************************************************
   *  Display details where where we are              *
   ***************************************************/


   bmp_printf( FONT_SMALL, 500, 16 * 0, 
               "siz=%X   ",   
                section_end[viewing_chunk] - section_start[viewing_chunk] + 4); 


   bmp_printf( FONT_SMALL, 600, 16 * 0,
               "start=%08X ",   
                section_start[viewing_chunk]); 

   bmp_printf( FONT_SMALL, 500, 16 * 1,
               "Seg=%d  ",   
                viewing_chunk); 

   bmp_printf( FONT_SMALL, 600, 16 * 1,
               "View->%08X ",   
                vram_addr); 

   bmp_printf( FONT_SMALL, 600, 16 * 2,
               "end  =%08X ",   
                section_end[viewing_chunk]); 

 

   /*********************************
   * OK - Copy vram as is to bmp    *
   *********************************/

   unsigned int y;
   unsigned int vram_copy_addr = vram_addr;
   unsigned int vp;

   unsigned int disp_chunk = viewing_chunk;

   for (y = 0; y< AJ_active_search_y_height; y++)
   {
      /**************************************************************
      *  If were have run out of the current chunk to display       *
      *  put some buffer lines in, and start displayin the next     *
      *  chunk.                                                     *
      **************************************************************/

      if (vram_copy_addr > section_end[disp_chunk])
      {
         unsigned int y_after_gap = y + 5;   // gap between sections
 
         if (y_after_gap > AJ_active_search_y_height)
            y_after_gap = AJ_active_search_y_height;

         for (;y< y_after_gap; y++)
         {
            for (x=0; x< AJ_active_search_x_bytes; x+=4)      /* do 2 vram pixels at the time */
            {                                                 /* = 4 bytes a time             */
           
               vram_copy_addr +=4;
            
               // aj_draw_pixel_word(x+100,   y+100,  0x01010101, 0);        /* White */ 
               aj_draw_pixel_word(x+100,   y+100,  0x00000000, 0);        /* Black */   
            }
         }
                  
         disp_chunk += 1;

         if (disp_chunk > sections_found -1)
         {
            /**************************
            *  Clear rest of screen   *
            **************************/
            for (; y< AJ_active_search_y_height; y++)
            {
               for (x=0; x< AJ_active_search_x_bytes; x+=4)      /* do 2 vram pixels at the time */
               {                                                 /* = 4 bytes a time             */                    
                  aj_draw_pixel_word(x+100,   y+100,  0x00000000, 0);          
               }   
            }

            break;  // not more sections to display
         }

         vram_copy_addr = section_start[disp_chunk];
      }
      else
      {
         /**************************************************************
         *  Display a line of Vram on the bmp display                  *
         **************************************************************/

         for (x=0; x< AJ_active_search_x_bytes; x+=4)      /* do 2 vram pixels at the time */
         {                                                 /* = 4 bytes a time             */
            vp = * (unsigned int *) vram_copy_addr;        /* 2 vram pixels */ 
            vram_copy_addr +=4;
            
            aj_draw_pixel_word(x+100,   y+100,  vp, 0);          
         }
      }

 
   } /* end of y for loop */
     
} /* end of aj_find_changing_memory() */


xaos

unread,
Jan 25, 2011, 12:12:32 PM1/25/11
to ml-d...@googlegroups.com
On Tue, Jan 25, 2011 at 5:43 PM, Alex <broscu...@gmail.com> wrote:
> AllocateMemory 0xFF06FFD0
> FreeMemory 0xFF070360
Thank you.

> Did it freeze at segment 8? (550D does).

No... Only:
DUMP 0 80000000
and suddenly
DUMP F 8F000000

without 81.. 8E on screen, without any file.

xaos

unread,
Jan 25, 2011, 12:31:25 PM1/25/11
to ml-d...@googlegroups.com
AJ

aj_find_changing_memory.c:550:19: error: 'AJ_active_search_y_height'
undeclared (first use in this function)
aj_find_changing_memory.c:567:26: error: 'AJ_active_search_x_bytes'
undeclared (first use in this function)

arm.indy

unread,
Jan 25, 2011, 12:52:14 PM1/25/11
to Magic Lantern firmware development
Xaos,

we can notice that Alex's addresses were good.

are you registered to bitbucket and a 60d branch follower ?

Indy

On 25 jan, 17:34, xaos <hipotu...@gmail.com> wrote:
> FF1CB510 FIO_FindFirst - correct
> FF1CB780 FIO_FindNextEx - incorrect, not working
> FF1CB604 FIO_FindNextEx_0 - correct
> Thank you, Alex, Indy.
>
> =Alex=
> I merged sources for 550d rev 819 (Mon Jan 24 22:06:47 2011 +0200) and
> main problem I have now is to determine
> * FreeMemory addr
> * FOCUS_CONFIRMATION
>
> draw_zebra_and_focus():
> * YUV422_LV_BUFFER
> * YUV422_HD_BUFFER
> (err 70)
>
> Silent pic
>
> I have readhttp://magiclantern.wikia.com/wiki/VRAM/550Dhttp://magiclantern.wikia.com/wiki/VRAMhttp://magiclantern.wikia.com/wiki/ASM_Zedbra
> but without success. I have dumps for 0-7 segments x3 (LV, CAM LV, CAM
> LV REC) but I don't understand how you found e.g. address
> 0x04000080...
> You can find all my dumps (gzipped) herehttp://andromeda.ap.krakow.pl/60d/
>
> =Indy=
> I don't have but now I want  :) I will disable all not working code
> (lv buffers, lcd remote shot).
>

Antony Newman

unread,
Jan 25, 2011, 12:55:26 PM1/25/11
to ml-d...@googlegroups.com
Xaos,

I've sent you a private email with some of my old experimental routines!

If I know what I'd know now ... I would be spending my time following the bmpVramallocate() like Canon DryOs routines to find where the address of dma memory allocated to the segments is stored (it'd take me less time!).

I have my hands full at the moment ...

AJ

xaos

unread,
Jan 25, 2011, 1:01:59 PM1/25/11
to ml-d...@googlegroups.com
Ok, thank you, AJ.

xaos

unread,
Jan 25, 2011, 1:04:00 PM1/25/11
to ml-d...@googlegroups.com
On Tue, Jan 25, 2011 at 6:52 PM, arm.indy <arm.i...@gmail.com> wrote:

> we can notice that Alex's addresses were good.

Yes :)

> are you registered to bitbucket and a 60d branch follower ?

And yes.

Alex

unread,
Jan 25, 2011, 1:07:03 PM1/25/11
to ml-d...@googlegroups.com
Xaos,

Here's my method, with the code from the wiki, step-by-step (with images):

First, notice 0.bin and 1.bin refer to the same memory, maybe with
different caching bits (and also 4.bin). Maybe it's true for others,
too. As the wiki says, we can make the difference between the dumps,
and the large contiguous different blocks are possible VRAM buffers.

alex@karmic:~/src/ml/AJ mem scan$ ipython
...
In [1]: run -i img.py # load the code from the wiki

In [2]: a = readsampled("60d/0.BIN") # this reads the file
downsampled by 100, 'cause the dumps are large

In [3]: b = readsampled("60d/1.BIN")

In [4]: d = array(a) - array(b) # difference...

In [5]: d[d != 0] = 1 # do this to get a nice plot

In [6]: plot(d); show() # notice one of the
blocks starting around 1000000
Out[6]: [<matplotlib.lines.Line2D object at 0x9c93c2c>]

In [7]: x = 1000000*100 # remember downsampling factor

In [8]: s = readseg("60d/0.BIN", x, 1000000) # read 1MB from there

In [9]: guesspitch(s) # guess pitch with FFT
2114.16490486

In [10]: imgseq(s, 2114) # starts to look like an image!

In [11]: imgseq(s, 2112) # perfect sync :)

In [12]: s = readseg("60d/0.BIN", x+316*2112, 2112*704) # image data
starts from line 316; from 550d we know buffer is 1056*704

In [13]: imgseq(s, 2112) # almost there

In [14]: hex(x+316*2112)
Out[14]: '0x6001000'

In [15]: s = readseg("60d/0.BIN", 0x6000080, 2112*704) #
from 550D, I guess it should end in 0080

In [16]: imgseq(s, 2112) # bingo!

Final result: 0x46000080 (with the caching bit from 550D).

Was it difficult?

Next:
- Can you format it nicely and put it on the wiki?
- Find the other buffers

6. dif.png
10. first guess.png
11. second guess.png
13. almost there.png
16. bingo!.png

Alex

unread,
Jan 25, 2011, 1:12:28 PM1/25/11
to ml-d...@googlegroups.com
Attached img.py .
img.py

xaos

unread,
Jan 25, 2011, 1:30:02 PM1/25/11
to ml-d...@googlegroups.com
On Tue, Jan 25, 2011 at 7:07 PM, Alex <broscu...@gmail.com> wrote:
(...)
> Was it difficult?
Not now :D

> Next:
> - Can you format it nicely and put it on the wiki?

Yes.

> - Find the other buffers

Ok.

xaos

unread,
Jan 25, 2011, 1:31:35 PM1/25/11
to ml-d...@googlegroups.com
Alex, Thank you for lesson ;)

xaos

unread,
Jan 25, 2011, 4:10:45 PM1/25/11
to ml-d...@googlegroups.com
And now... Problem with memory allocation, few seconds after boot LV mode

zebra.c:
static void bvram_mirror_init()
{
if (!bvram_mirror)
{
bvram_mirror = AllocateMemory(bmp_pitch()*540 + 100);
if (!bvram_mirror)
{
bmp_printf(FONT_MED, 30, 30, "Failed to
allocate BVRAM mirror");
msleep(2000);
return;
}
bzero32(bvram_mirror, 960*540);
}
}

where bmp_pitch() return 960 and for a while I see "Failed to allocate
BVRAM mirror" an then
Err 70, shooting is not possible due to an error..

AllocateMemory is 0xFF06FFD0

Alex

unread,
Jan 25, 2011, 4:19:17 PM1/25/11
to ml-d...@googlegroups.com
This sounds either like there's not enough memory, or AllocateMemory
is not at the right address.

To debug this, try allocating smaller amounts of RAM, until it fails.

I also suggest to do this:
- after failed allocation, don't return from that function, e.g. put a
while(1) msleep(100).
- do a Debug->dump dmlog and see what happened (AllocateMemory will
say something).

Code which uses the bvram mirror should check first if it's not null;
maybe it's one where I forgot to check.

Fernando Freire

unread,
Jan 25, 2011, 4:36:08 PM1/25/11
to ml-d...@googlegroups.com
Or try this progresive malloc (changing mallocs for AllocateMemory):


//from CHDK
static unsigned calc_free_memory() {
   unsigned size, l_size;
   int d;
   char* ptr;

   size = 16;
   while (1) {
      ptr= malloc(size);
      if (ptr) {
         free(ptr);
            size <<= 1;
      } else
        break;
    }

   l_size = size;
   size >>= 1;
   d=1024;
   while (d) {
      ptr = malloc(size);
      if (ptr) {
         free(ptr);
         d = l_size-size;
         if (d<0) d=-d;
         l_size = size;
         size += d>>1;
      } else {
         d = size-l_size;
         if (d<0) d=-d;
         l_size = size;
         size -= d>>1;
      }
   }
   return size -1;
}


Alex

unread,
Jan 25, 2011, 4:47:44 PM1/25/11
to ml-d...@googlegroups.com
This seems nice, I'll try it on 550D, too.

Antony Newman

unread,
Jan 25, 2011, 5:01:41 PM1/25/11
to ml-d...@googlegroups.com
I think this is the DryOs routine that does 'memset to space'

bzero32(bvram_mirror, 960*540);

I am not sure you can call this with DMA contending with it.

You many need to consider 'NOP's 

(my 10 second analysis).

AJ

xaos

unread,
Jan 25, 2011, 5:08:26 PM1/25/11
to ml-d...@googlegroups.com
static void bvram_mirror_init()
{
if (!bvram_mirror)
{
bmp_printf(FONT_MED, 0, 400, "Free mem: %d",
calc_free_memory());
msleep(5000);

bvram_mirror = AllocateMemory(bmp_pitch()*540 + 100);
(...)

Free mem: 24088

Alex
I can't msleep(whatever) and dump dmlog, it's always happen too fast,
but.. it works:

bvram_mirror = AllocateMemory(bmp_pitch()*540 + 100);

dumpf();


^@ 14185: 12727.154 [STARTUP] ERROR ^GASSERT : Memory\Memory.c, Task =
zebra_task
^@ 14186: 12727.190 [STARTUP] ERROR ^GASSERT : Line 188
^@ 14187: 12727.202 [STARTUP] ERROR ^GASSERT : FALSE
^@ 14188: 12727.353 [STARTUP] startupErrorRequestChangeCBR (0x1d)
^@ 14189: 12727.382 [STARTUP] startupErrorRequestChangeCBR : ErrorSend
(101, ABORT)
^@ 14190: 12727.618 [STARTUP] ASSERT Time 2011/1/25 22:59:33.

LOG007.LOG.gz
LOG008.LOG.gz

Alex

unread,
Jan 26, 2011, 10:45:39 AM1/26/11
to ml-d...@googlegroups.com
On 550D, Fernando's routine says 2.4 MB free (outside LV, right after
starting the camera), but it also gives ERR70.

arm.indy

unread,
Jan 26, 2011, 4:14:52 PM1/26/11
to Magic Lantern firmware development
Xaos,

you should now have write access to 60d -fork- (I'm admin).
https://bitbucket.org/arm_indy/magic-lantern-for-60d/src

but as I remember, content is identical to 60d -branch- (Trammel
Hudson is admin).
https://bitbucket.org/hudson/magic-lantern/src/0196ff9c4e86

you can also choose to ask write access to 60d branch to Trammel
Hudson, as you prefer.
it seems easier to merge branches than forks...

Once we'll have a stable 60d version, we'll see how to merge with
550d==Alex version

Indy


On 26 jan, 16:45, Alex <broscutama...@gmail.com> wrote:
> On 550D, Fernando's routine says 2.4 MB free (outside LV, right after
> starting the camera), but it also gives ERR70.
>

xaos

unread,
Jan 26, 2011, 6:27:18 PM1/26/11
to ml-d...@googlegroups.com
Indy, thank you for access, commits done.

Alex, can you look at this pictures from silent pic
http://andromeda.ap.krakow.pl/60d/sp/
What's your opinion?

K.

unread,
Jan 26, 2011, 7:05:43 PM1/26/11
to ml-d...@googlegroups.com
i wish i had such toys in childhood :)

2011/1/26 xaos <hipo...@gmail.com>

Alex

unread,
Jan 27, 2011, 2:01:15 AM1/27/11
to ml-d...@googlegroups.com
Silent pics:

5 is OK, 1056x704. Was it photo mode or fullhd video?
6 is 1016x1344. Was it in 2x1 hi-res mode?
1 has pitch 2112 (1056 horizontal). There may be two buffers right one
after another (i.e. first read data from sensor in buffer A and
process buffer B, second, read data in buffer B and process buffer A).
The base address of that segment may start a bit earlier (if you crop
first 704 pixels, you also get pixels from the bottom half).

The artifacts you see in the pictures are present on the 550D, too
(but not always).

000-odd.png

arm.indy

unread,
Jan 27, 2011, 3:01:22 PM1/27/11
to Magic Lantern firmware development
Xaos,

you made good progress since the beginning!
please what is the status ?
what is working and not ?

Indy

On 27 jan, 08:01, Alex <broscutama...@gmail.com> wrote:
> Silent pics:
>
> 5 is OK, 1056x704. Was it photo mode or fullhd video?
> 6 is 1016x1344. Was it in 2x1 hi-res mode?
> 1 has pitch 2112 (1056 horizontal). There may be two buffers right one
> after another (i.e. first read data from sensor in buffer A and
> process buffer B, second, read data in buffer B and process buffer A).
> The base address of that segment may start a bit earlier (if you crop
> first 704 pixels, you also get pixels from the bottom half).
>
> The artifacts you see in the pictures are present on the 550D, too
> (but not always).
>
> On Thu, Jan 27, 2011 at 1:27 AM, xaos <hipotu...@gmail.com> wrote:
> > Indy, thank you for access, commits done.
>
> > Alex, can you look at this pictures from silent pic
> >http://andromeda.ap.krakow.pl/60d/sp/
> > What's your opinion?
>
> > --
> >http://magiclantern.wikia.com/
>
> > To post to this group, send email to ml-d...@googlegroups.com
> > To unsubscribe from this group, send email to ml-devel+u...@googlegroups.com
> > For more options, visit this group athttp://groups.google.com/group/ml-devel?hl=en
>
>
>
>  000-odd.png
> 946KAfficherTélécharger

Alex

unread,
Jan 27, 2011, 3:40:19 PM1/27/11
to ml-d...@googlegroups.com
Indy,

From what I understand, the only major issue left is that
AllocateMemory can't be used for large amounts of RAM. As a result,
cropmarks and the mirror algorithm (which prevents zebra & friends
from overwriting Canon menus and other ML elements) do not work.

We had the same issue on the 550D, and it was solved with your
suggestion of using AllocateMemory instead of malloc.

Xaos, is that correct?

It is loading more messages.
0 new messages