Magic Lantern Firmware Wiki
Line 85: Line 85:
 
It is hard to predict how much effort will be required to implement new features. Disabling existing features is fairly easy, which is why AGC support was the first target. Disabling auto-exposure should be easy as well, but an accurate estimate is difficult to give since I'm only working on this in my spare time.
 
It is hard to predict how much effort will be required to implement new features. Disabling existing features is fairly easy, which is why AGC support was the first target. Disabling auto-exposure should be easy as well, but an accurate estimate is difficult to give since I'm only working on this in my spare time.
   
== How about 7, 9 or more bracketing shots? ==
+
== How about 5, 7, 9 or more bracketing shots? ==
This will be supported with the scripting interface and you will be able to write your own bracketing algorithm to vary shutter, ISO, aperture and focus. Scripts will be triggered via a menu item, IR remote or perhaps a USB remote.
+
Release 0.1.6 has support for {{bug|18|custom brackets}}. Eventaully this will also be supported with the scripting interface and you will be able to write your own bracketing algorithm to vary shutter, ISO, aperture and focus. Scripts will be triggered via a menu item, IR remote or perhaps a USB remote.
   
 
== What are the next steps? ==
 
== What are the next steps? ==

Revision as of 12:13, 4 August 2009

General

Zebra-stripes

Zebra stripes demo

What is it?

Magic Lantern is an enhancement atop of Canon's firmware that makes your 5D Mark II into the 5D Mark Free. It adds new features like onscreen audio meters and zebra stripes, as well as disables the audio AGC. It is an open (GPL) framework for developing extensions to the official software, tailored for film making needs.

Where do I get it?

You can download pre-build firmware files or the GPL licensed sources. This is still a beta version and there are some rough edges.

What can I do to help?

If you're a programmer skilled in ARM assembly, embedded systems, GUI programming and don't mind risking your expensive camera, join the Magic Lantern devel mailing list, edit the wiki and make improvements.

Where do I report bugs?

For general tech-support, post questions to dvinfo's 5D forum or cinema5d's firmware forum. For bugs and enhancement requests, use the issue tracker.

Can I donate / pay for it?

You can donate via PayPal. I'm also looking for used film making equipment (steadicams, rails systems and lenses), so if you have any older ones that are no longer being used please let me know. Or you can make a donation to the EFF for me.

Why not just buy a video camera?

If you can find a video camera that a) shoots HD, b) has a 50 mbps data rate, c) has interchangable lenses, d) has a 35 mm or larger sensor and e) costs less than $150k (without lenses, like the CineAlta F35), then buy that one instead. There are limitations to shooting movies on a 5D Mark II, notably the limited 12 minute recording time and lack of balanced audio inputs, but a ArriCam Lite only records 5 minutes of Super 35 and a high quality preamp like the juicedLink CX231 provides balanced inputs. The lack of auto-focus in movie mode isn't a problem either -- movies are focused manually with a follow-focus like the RedRock microFollowFocus.

Will it work on a 40D, 50D, T1i, GH1, etc?

Short answer: No. Longer answer: It is likely that the 50D and T1i are close enough to the 5D Mark 2 that the same techniques can be applied to building similar firmware. The CHDK project successfully supports many different cameras running different operating systems, but finding the necessary kernel entry points is a very time consuming process. Once the 5D Mark Free software is publicly available, some one with the inclination to port it to the 50D can do so. The 40D is similar in hardware, but runs vxWorks and would be lots of effort to support The GH1 is a completely different bit of hardware and would require an entire from-scratch reverse engineering effort. Until Panasonic releases a firmware update it is unlikely that any such efforts can be begun and even then it would require someone with a camera, the inclination and the skills to work on it.

However, there is an effort in reverse engineering the Pentax K10/GX10 and K20/GX20 cameras. As of August 2009 they have been able to decrypt the firmware update and are making progress in understanding how the camera works.


Installation

Firmware-screenshot

How is it installed?

As shown in the video, a file named 'magiclantern.fir' is copied to the CF card and "Update firmware" is selected from the menu. The running firmware shuts down, loads the file into RAM and starts it running. Rather than reflashing the ROMs, this new program starts the DryOS boot process to install itself.

Does it modify the camera?

Nothing is written into the ROMs. When the camera reboots, the RAM image is flushed and the bootloader FROMUTIL at 0xFFFF0000 starts the pristine copy in ROM at 0xff810000. After any reboot (or even powersave), you must select the "Update firmware" menu item. Eventually we want to be able to boot directly from the AUTOBOOT.BIN file on the CF card.

Is it dangerous?

I haven't bricked my camera yet, but that is no guarantee. It doesn't write to the ROMs at all, so it should be fairly safe, but anytime software is interacting with hardware there is possibility of significant damage. The FROMUTILITY appears to have a way to reflash even a bricked camera, but I don't know how to access the console.

Does it void my warranty?

It is very similar to CHDK, which has a FAQ: Does using the CHDK program void your warranty?:

First, please bear in mind that CHDK comes with no warranty for any use; you use it at your own risk. What follows is just a few thoughts, and is not a legal opinion. Many believe that using the CHDK does not harm your warranty, since it is said to be loaded into the memory only temporarily (turn off the cam and it's gone completely) and that it leaves the original camera firmware untouched

They include an email exchange with Canon:

After researching this software on the internet it appears that CHDK doesn't make any actual changes to your camera. If you delete the CHDK software from your memory card, or if you choose not to activate the CHDK software on the card (or remove and replace the batteries), then the camera will behave absolutely normally - nothing has been (or ever is) changed, so the warranty is not affected.

The Magic Lantern firmware is distributed with NO WARRANTY and NO GUARANTEES are provided. It might work. It might not. It hasn't destroyed any cameras yet, but who knows.

How will it interact with future upgrades from Canon?

The current code is very tightly integrated with the 1.1.0 firmware image; it modifies specific instructions at hard-coded addresses and uses function addresses that will change in a new firmware. The initial Magic Lantern firmware was written to support 1.0.7; we learned some things during the port to 1.1.0 and hopefully have abstracted out enough to make it easy to move to a new Canon firmware version.

Despite this tight integration, the 5D Mark Free software does not contain any Canon code. It is entirely a clean-room implementation that runs along side the official Canon firmware as a separate DryOS task.


Features

How do I bring up the Magic Lantern menus?

Press Picture Style button once LiveView is displayed to bring up the Magic Lantern menu. Once in the menu:

  • Use the joystick to move between items.
  • Click the joystick to select items to toggle them.
  • Press Picture Style to exit the menu.
  • If Zebras are not turned on, the menu may not be cleared; press digital zoom or Menu to refresh the display

How do I save the gain/zebra/etc configuration?

The configuration is not saved between runs. Instead you must edit the magiclantern.cfg file with a text editor on your Mac or PC to change settings. Eventually there will be a way to store the current settings, but for now they are read at boot from the config file.

When will 24p be available?

I know that 24p and 25p frame rates are very important for film makers and folks in PAL countries, but one that I have not (yet) been able to achieve. While I have been able to reverse engineer most of the Canon DryOS that runs on the ARM CPU in the camera, there is no documentation at all on the DIGIC4 that is doing the actual h.264 encoding and reading from the sensor.

It may be possible to select different frame rates, and if someone is able to find the register inside the DIGIC4 to set the frame rate, we can easily toggle it in Magic Lantern. Without any documentation, however, our best hope might be that Canon will add these two frame rates to compete with the new DSLR cameras from its competitors.

It is hard to predict how much effort will be required to implement new features. Disabling existing features is fairly easy, which is why AGC support was the first target. Disabling auto-exposure should be easy as well, but an accurate estimate is difficult to give since I'm only working on this in my spare time.

How about 5, 7, 9 or more bracketing shots?

Release 0.1.6 has support for custom brackets. Eventaully this will also be supported with the scripting interface and you will be able to write your own bracketing algorithm to vary shutter, ISO, aperture and focus. Scripts will be triggered via a menu item, IR remote or perhaps a USB remote.

What are the next steps?

See Todo list for more details:

  • Onscreen level meters Done!
  • Zebra stripes Done!
  • Debug manager Done!
  • Audio monitoring Done!
  • Lens focal length and focus distance Done!
  • Some Better Compression ... even 18 raw files - even jpg fine dont have that blocks.. capture whitout moving the mirror..can be interpolated in autodesk software.. even for one minute is ok.. or in mov but less compression less or no blocking. even send the data to card and only preview in the less resolution possible for not tax it..
  • Figuring out how to create additional menus
  • Understanding localization and string pointers into ROM1.bin
  • Adding custom functions for enabling/disabling new features
  • Overriding lvae_task() to remap buttons and functions
  • AUTOBOOT.BIN to automatically start the new firmware from the CF card
  • Adjusting frame rate of video
    • 24p
    • 25p (PAL)
    • 29.97 (NTSC)
    • Overcrank (48 fps or faster)
  • 720p option
  • 4 GB file limit
  • Scripting language (or full CHDK port)
  • HDR / Timelapse / etc
  • Record lens focal length, focal distance, shutter, iso, aperture, etc metadata into a file while recording movies
  • Linker script to map data and bss Done!
  • Adjustable analog/digital audio gains Done!
  • Splash screen Done!
  • Design new logo
  • HDMI video ouput for external monitors Mostly done!
  • Prevent HDMI video mode switch when recording
  • better BKT (at least 5 images in AEB, better: choose: 2,3,5,7,9)
  • Customizable Auto-ISO
  • Auto-ISO and Manual mode - User selects lens apperture and shutter speed - firmware adjusts ISO gain to get the correct exposure.
  • Support user scripts with RC-1 remote control
  • Timed Continuous Shooting / Time Lapse feature like in lower end Canon DSLR's
  • Peaking Filter and False Color filter as seen here http://www.lcdracks.com/monitors/v-lcd70p-hdmi.html Sobel Edge detection is sort of done!
  • Framerates higher than 30 fps
  • Less obtrusive zebra lines Now transparent!
  • More attractive Interface
  • Dedicated website so that people like me can't just change whatever they want.
  • Focus Bracketing for focus stacking
  • Posibility to shoot more than one picture with the same parameters - AV - FOCUS, etc to mean the images to get less noise.
  • Digital zoom while recording. Perhaps a 'picture-in-picture' - full screen that shows digital zoom, while PIP shows the full frame. To help focus while recording.
  • Simple 1-button white-balance method

What about feature X?

See New feature requests for details.

Why is the recorded audio so quiet?

The 5D has low-quality analog amps, so it is best to boost it in post. It will be no noisier than if we boosted it in the camera with digital gain, but if we boost too much in the camera, it's impossible to get a low noise result with a hot mic or preamp. We have selected the best balance available with a single value.

Why is the internal mic disabled?

Do you really care about the audio quality when recording with the built-in mic? Since almost all users will be recording with an external balanced mic pre-amp, it was easier to not figure out the part of the hotplug task that dealt with switching between inputs and just force the AK4646 into external input mode.

Why is the external video disabled?

For a similar reason -- the hotplug task that handles switching between different video modes was disabled so that the A/V jack could be used for audio monitoring. There are reports of audio noise when NTSC video is being output on the jack, so HDMI is likely to be the only supported output format.

Technical

Does it work with chdk?

I've used some of the CHDK tools to learn about Canon firmware files, but this is all new code. They have done an amazing job of supporting hundreds of different camera models across multiple architectures and operating systems. At some point in the future chdk might be ported to the 5D Mark 2, but this project is much more focused on just the 5D Mark II and the needs of film makers. CHDK is a great project for Canon's Point-and-Shoot cameras. Without their initial effort in understanding DryOS, Canon's firmware files and the boot process, I wouldn't have been able to make as much progress as quickly as I did. While I was able to use modern tools to analyze dump files of ROM images thanks to their efforts, they got started bitbanging a UART via the status LED on a camera body. That's truly hardcore.

Why the name change?

Originally the project was called just "5D Mark Free", but out of an abundance of caution it seemed best to avoid Canon's trademarks.

What is it written in? Can I get the source?

The firmware hack is in C, with some inline assembly for boot strapping. The firmware build tools are in Perl and use Makefiles for dependency tracking. You need an arm-linux-elf build of gcc and binutils. Most of the code analysis has been done with objdump, strings and the IDA demo. No tech support will be provided. If it breaks you get to keep both pieces. If you know what all of these terms mean and aren't scared of the possibility of breaking your camera, you can download the Magic Lantern firmware source code.

How do I get a ROM0.bin firmware image?

I've written a modified version of the 1.0.7 firmware image that uses the embedded DryOS to dump out the firmware. Since it is a derived work of Canon's firmware, I am not comfortable distributing it. There is no reason that this could not be added to the new 5d2-ml.fir file once we have custom menus, which should avoid any IP issues. We do not distribute ROM images, nor IDAPro .idb files, since they are verbatim copies of Canon's copyrighted code. You can generate the ROM images from your own camera and use the .map file to apply our names to the file inside of IDA.

What are all of the 0xff81beef things and funny names like EP_SetManualMovieMode()?

These are the addresses in the official ROM firmware for different functions and names that we have given to functions. If you load the ROM0.bin image into IDA or use objdump you can trace through the instructions to determine how the software works. If you are just using the camera, they don't need to mean anything to you, but they give other developers a place to look in the firmware image.

The function names are unlikely to be the same as the ones in Canon's source code, which we have never seen. We name functions based on what they seem to do, or debugging / diagnostic strings embedded in the function. It isn't perfect, but it is sufficient to locate the important things for task creation, file I/O and GUI operation.

Is it legal?

This is a "clean room" / "black box" reverse engineering effort and as such should be ok. Frequently asked questions about reverse engineering addresses the legality question; producing an interoperable product is one of the explicit allowances enshrined in law.

Misc

Who is that guy in the corner?

He is the chemist Robert Cornelius and the self-portrait photograph is considered to be the first picture of a person.