Software architectural relationship between firmware, DryOS, ML and "canon stuff

Started by mark.farnell, March 15, 2013, 09:36:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mark.farnell

Quote from: 1% on March 15, 2013, 01:00:19 AM
6D has a few more (ie timecode) but 600D had the same stuff. Its not DryOS, its canon stuff on top of it.

Ptool directly modifies fw (AFAIK) and they have a software encoder.

I am a total newbie to ML development and I am just starting to learn...
Where can I find a diagram explaining the architectural relationship between:

- Canon camera hardware
- DryOS
- ML
- other "canon stuff" above the DryOS that 1% mentioned

When people say firmware and software, I am a bit confused about where do they sit on the above list.  Does firmware cover DryOS or does it only cover things below the DryOS?  What does "firmware" cover for our purpose?

Also does ML work by replacing part of the "other canon stuff" above the DryOS, or the DryOS, or both?

Thanks!

Mark

g3gg0

i have no picture for you, but some words.

DryOS is the operating system, the canon firmware uses and is widely used on cameras in field.
Operating system = basic I/O, tasks, semaphores, memory management, etc.

canon firmware is the DryOS plus a lot of application code like menu, state machines for every camera function.

Boot loader is the first code executed after processor reset. it checks flash and jumps to canon firmware.
it also checks for boot flag and autoexec.bin on card and executes it (ML loading)

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

mark.farnell

Quote from: g3gg0 on March 16, 2013, 12:52:30 AM
i have no picture for you, but some words.

DryOS is the operating system, the canon firmware uses and is widely used on cameras in field.
Operating system = basic I/O, tasks, semaphores, memory management, etc.

canon firmware is the DryOS plus a lot of application code like menu, state machines for every camera function.

Boot loader is the first code executed after processor reset. it checks flash and jumps to canon firmware.
it also checks for boot flag and autoexec.bin on card and executes it (ML loading)

Thanks!  So where does ML sit?  Is ML augmenting/patching the  "application code" that you talked about, or the DryOS code, or both?  I am confused........

Also are camera functions such as recording movies, and limiting movie time length to 1799 seconds belong to the user space application code rather than the DryOS code?

1%

Its all compiled together into a rom.... you can patch code in memory throughout or execute new code. The different functions i.e. movie recorder, color calc are kind of like apps or modules. ML is somewhat like that, it runs with all the other stuff.




a1ex

Most of ML code is running as a couple of user tasks on DryOS (look for TASK_CREATE lines in the source code). It calls Canon functions - see platform/stubs.S - to do its job (e.g. to take a picture, to change shutter speed etc).

Some code is called back from DryOS when some events happen (e.g. you change some setting, or you start recording, etc). These are the property handlers (PROP_HANDLER), see http://magiclantern.wikia.com/wiki/Properties .

The GUI event handlers run in Canon's GUI task (so when a button is pressed, ML code looks at it, and decides whether it's for its own use - e.g. ML menu or shortcut keys - or just passes it to Canon code).

And finally, you can patch small bits of Canon code, usually with cache hacks, or by relocating some code into RAM. This is used, for example, for modifying Canon's startup code in order to load ML. The patching is temporary, the ROM is not altered, just the RAM or CPU cache.

If you want diagrams, you can look here: http://a1ex.bitbucket.io/ML/states/index.html (these are Canon tasks implemented as state objects).

g3gg0

as explained the bootloader loads autoexec.bin [into RAM and executes it] expecting some canon debug/development code but it is Magic Lantern.

then ML has control over the system before the OS is booting.
ML patches some stuff in the OS init code, putting its own init task into DryOS startup.
(patching is tricky, as we cannot and do not want to modify flash content -> advanced topic)
after this patching is done, ML jumps to the original DryOS entry point as the bootloader would do it.

DryOS boots, but with some things changed (call it "infected with ML code").
now we have our own tasks running and can modify variables in RAM etc while the camera operates normally.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

g3gg0

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

g3gg0

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!


g3gg0

well, its not perfect and for sure not 100% correct.
its just a visualization of basic things.
https://bitbucket.org/hudson/magic-lantern/commits/55da5b5d4cd41d30df888462b6232025af3ffd11

feel free to edit the drawing using yEd (you can start that tool from its web page, needs no extra installation. java webstart)
http://www.yworks.com/de/products_yed_about.html (click start)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

mark.farnell

Thanks g3gg0 for these very illustrative diagrams...... Should they go to the developer's documentation on the ML website?  Newbie developers do need to understand the big picture first before they can progress further......


kitor

Too many Canon cameras.
If you have a dead R, RP, 250D mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

names_are_hard

They're in the repo at doc/Architecture_Drawings.graphml - or at least that's the file from the ref'd commit.

g3gg0

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!