Compiling the 550D branch of Magic Lantern

192 views
Skip to first unread message

Alex

unread,
Sep 3, 2010, 12:22:23 PM9/3/10
to Magic Lantern firmware development
Hello and thanks for the great work!

I'm trying to compile Magic Lantern for 550d, under Ubuntu Karmic /
arm-elf-gcc 3.4.6. After generating magiclantern, magiclantern.bin,
autoexec and autoexec.bin, the Makefile calls a Python script which is
outside the magic-lantern directory:

../dumper/enc_upd550.py \
550d-empty.fir 550d-flasher.bin \
magiclantern.fir \

make: ../dumper/enc_upd550.py: Command not found

Where should I download enc_upd550.py? Is it possible to compile ML
without it?

Also, in firmware.h, struct fw_header_t, there are two fields with the
same name: data_len at offsets 0x64 and 0xBC. Some gcc versions
complain about it, others not. Is this a problem?

Thanks in advance,
Alex
Message has been deleted

arm.indy

unread,
Sep 3, 2010, 1:19:25 PM9/3/10
to Magic Lantern firmware development
Hello Alex,

The enc_upd550.py is not public because it contains AES keys, which
hack authors decided not to release.

And you do not need this tool to compile/execute custom code for your
550D.
The .fir only enable the boot flag (which is persistent) in the
camera, which then is
capable of booting the autoexec.bin file.

Be careful to read several times discussion here
http://groups.google.com/group/ml-devel/browse_thread/thread/0f87188ddff2cf50#
and the readme.txt provided here
http://magiclantern.wikia.com/wiki/550D.

Put the provided magiclantern.fir in the building tree and compile
your own autoexec.bin.

Arm.Indy

Alex Dumitrache

unread,
Sep 4, 2010, 5:05:50 AM9/4/10
to ml-d...@googlegroups.com
Thanks, Arm.Indy, it compiles now!

Here is a patch for the Makefile. If enc_upd550.py is found, it is executed; otherwise, a message is displayed, telling the user to download magiclantern.fir from ML wiki.

A hint for Ubuntu users: dd doesn't know about oseek, but sdd does. However, with sdd you have to say -notrunc instead of conv=notrunc.

Alex

--
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

Makefile-enc_upd550.patch

arm.indy

unread,
Sep 4, 2010, 9:40:42 AM9/4/10
to Magic Lantern firmware development, Philipp Fischer
Thanks Alex,

I have started a 500D development Wiki page. Feel free to improve it,
with compilation instructions and patches for example.

Arm.Indy

On Sep 4, 11:05 am, Alex Dumitrache <broscutama...@gmail.com> wrote:
> Thanks, Arm.Indy, it compiles now!
>
> Here is a patch for the Makefile. If enc_upd550.py is found, it is executed;
> otherwise, a message is displayed, telling the user to download
> magiclantern.fir from ML wiki.
>
> A hint for Ubuntu users: dd doesn't know about oseek, but sdd does. However,
> with sdd you have to say -notrunc instead of conv=notrunc.
>
> Alex
>
> On Fri, Sep 3, 2010 at 8:19 PM, arm.indy <arm.indi...@gmail.com> wrote:
> > Hello Alex,
>
> > The enc_upd550.py is not public because it contains AES keys, which
> > hack authors decided not to release.
>
> > And you do not need this tool to compile/execute custom code for your
> > 550D.
> > The .fir only enable the boot flag (which is persistent) in the
> > camera, which then is
> > capable of booting the autoexec.bin file.
>
> > Be careful to read several times discussion here
>
> >http://groups.google.com/group/ml-devel/browse_thread/thread/0f87188d...
> > ml-devel+u...@googlegroups.com<ml-devel%2Bunsu...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/ml-devel?hl=en
>
>
>
>  Makefile-enc_upd550.patch
> < 1KViewDownload

Trammell Hudson

unread,
Sep 4, 2010, 10:10:28 AM9/4/10
to ml-d...@googlegroups.com
On Sat, Sep 04, 2010 at 12:05:50PM +0300, Alex Dumitrache wrote:
> Here is a patch for the Makefile. If enc_upd550.py is found, it is executed;
> otherwise, a message is displayed, telling the user to download
> magiclantern.fir from ML wiki.

I have committed this patch to the 550d branch and pushed it to
bitbucket.

> A hint for Ubuntu users: dd doesn't know about oseek, but sdd does. However,
> with sdd you have to say -notrunc instead of conv=notrunc.

Does ubuntu dd know about the skip= parameter? I believe it has the same
meaning as oseek.

--
Trammell

Trammell Hudson

unread,
Sep 4, 2010, 10:16:01 AM9/4/10
to ml-d...@googlegroups.com

I just checked the man page -- iseek is the same as skip, oseek is the
same as seek. So we can probably just change the oseek= parameter to
seek= and have it work. Can you give it a try with your Ubuntu machine
and let me know if it works?

Thanks,
-- Trammell

arm.indy

unread,
Sep 4, 2010, 11:57:49 AM9/4/10
to Magic Lantern firmware development
On Sep 4, 3:40 pm, "arm.indy" <arm.indi...@gmail.com> wrote:
> I have started a 500D development Wiki page.

it is here:
http://magiclantern.wikia.com/wiki/550d_dev

Arm.Indy

Alex

unread,
Sep 6, 2010, 3:37:37 AM9/6/10
to Magic Lantern firmware development
Great!

> Does ubuntu dd know about the skip= parameter?
Yes, and you are right, oseek == seek and iseek == skip. They seem to
produce the same results (at least on simple tests).

> I have committed this patch to the 550d branch
Thanks. There is another one here (for comparing two strings without
warnings): http://groups.google.com/group/ml-devel/browse_thread/thread/8c02917ef7360b95

Also, the makefile only contains the firmware IDs for 5D and 7D, not
for 550D (0x80000270). I believe this is only required for building
the firmware dumper.

Is there a way to verify if the compiled autoexec.bin is valid without
running it on the camera? Mine starts with "gaonisoy" but has over
700k, while the one in magiclantern-550d.rc1.zip has only 168k, so
there may be something wrong with my arm-elf-gcc.

> I have started a 500D development Wiki page.

Very nice. I'd like to provide detailed compilation instructions, but
first I want to test them on a fresh installation of Linux. Also, may
I ask you which toolkit are you using, and where you downloaded it
from? If it's a custom build, what configure options did you use? I've
tried more versions of arm-elf-gcc (4.3.2 from CodeSourcery, 4.3.2
from OpenHardware, 4.3.2 and 4.3.3 built as explained at
http://chdk.wikia.com/wiki/Gcc433 , 4.3.1 from chdk-linux-compiler-
v1.py which works for CHDK but not for ML). Most of them complain
about missing headers (stdint.h, sys/types.h etc.) or inline assembler
errors (do not like PC-relative addressing).

The only compiler which worked for me was this one (3.4.6):
http://www.idt.mdh.se/kurser/cdt214/arm-elf-tools-linux.tar.bz2

In this toolkit, there are two versions of libc.a, so I'm not sure
which one is good. I guess it's not the one for Thumb. The objects in
libc.a are not named lib_a-setjmp.o, but simply setjmp.o (and so on),
so I've renamed them in the Makefile.

Alex

arm.indy

unread,
Sep 6, 2010, 4:08:30 PM9/6/10
to Magic Lantern firmware development
Hi,

I have just installed (from source) an ARM toolchain using the script
http://github.com/esden/summon-arm-toolchain/raw/master/summon-arm-toolchain
provided from
http://www.hermann-uwe.de/blog/building-an-arm-cross-toolchain-with-binutils-gcc-newlib-and-gdb-from-source
(thanks to Phil for the link)

for info:
BINUTILS=binutils-2.20
GCC=gcc-4.5.1
NEWLIB=newlib-1.18.0
GDB=gdb-7.2

I started with a fresh Ubuntu 10.04 Desktop VmWare image,
this one: http://www.vmware.com/appliances/directory/542303

then to get required packages
sudo apt-get install flex bison libncurses5-dev autoconf texinfo
build-essential

then

./summon-arm-toolchain
(it takes a long time...)

hg clone -r 550d https://bitbucket.org/hudson/magic-lantern

wget http://bitbucket.org/hudson/magic-lantern/downloads/magiclantern-550d.rc1.zip
unzip magiclantern-550d.rc1.zip magiclantern.fir
mv magiclantern.fir magic-lantern
cd magic-lantern/

I have modified the Makefile as below to fix/adapt minor things:

user@ubuntu1004desktop:~/magic-lantern$ hg diff Makefile
diff -r 7309f68e78ae Makefile
--- a/Makefile Sat Sep 04 10:07:59 2010 -0400
+++ b/Makefile Mon Sep 06 21:55:21 2010 +0200
@@ -1,8 +1,10 @@
-ARM_PATH=/opt/local/bin
-CC=$(ARM_PATH)/arm-elf-gcc-4.3.2
-OBJCOPY=$(ARM_PATH)/arm-elf-objcopy
-AR=$(ARM_PATH)/arm-elf-ar
-RANLIB=$(ARM_PATH)/arm-elf-ranlib
+ARM_PATH=/home/user/arm-toolchain
+ARM_BINPATH=$(ARM_PATH)/bin
+GCC_VERSION=4.4.2
+CC=$(ARM_BINPATH)/arm-elf-gcc-$(GCC_VERSION)
+OBJCOPY=$(ARM_BINPATH)/arm-elf-objcopy
+AR=$(ARM_BINPATH)/arm-elf-ar
+RANLIB=$(ARM_BINPATH)/arm-elf-ranlib
LD=$(CC)
HOST_CC=gcc
HOST_CFLAGS=-g -O3 -W -Wall
@@ -25,7 +27,8 @@
# Firmware file IDs
FIRMWARE_ID_5D = 0x80000218
FIRMWARE_ID_7D = 0x80000250
-FIRMWARE_ID = $(FIRMWARE_ID_5D)
+FIRMWARE_ID_550D = 0x80000270
+FIRMWARE_ID = $(FIRMWARE_ID_550D)

# PyMite scripting paths
PYMITE_PATH = $(HOME)/build/pymite-08
@@ -217,7 +220,7 @@
lib_a-strcoll.o \
lib_a-ctype_.o \

-ARM_LIBC_A = /opt/local/arm-elf/lib/libc.a
+ARM_LIBC_A = $(ARM_PATH)/arm-elf/lib/libc.a

$(STDIO_OBJ): $(ARM_LIBC_A)
$(AR) xv $? $(STDIO_OBJ)
@@ -326,7 +329,7 @@


%.dis: %.bin
- $(ARM_PATH)/arm-linux-objdump \
+ $(ARM_BINPATH)/arm-linux-objdump \
-b binary \
-m arm \
-D \
@@ -419,7 +422,7 @@
if=$< \
bs=1 \
conv=notrunc \
- oseek=0 \
+ seek=0 \

550d-empty.fir: 550d-empty.hdr
( cat $< ; \
@@ -489,7 +492,7 @@

# Quiet the build process
build = \
- @if [ "$V" == 1 ]; then \
+ @if [ X"$V" = X"1" ]; then \
echo '$2'; \
else \
printf "[ %-8s ] %s\n" $1 $@; \
user@ubuntu1004desktop:~/magic-lantern$

The produced autoexec.bin (172092 bytes) is running on the camera, the
audio meters are here, but almost nothing is written on screen, except
"gain 18/18 " at bottom/right. It looks like there is a font or color
problem...
And yes, the font data is produced...

user@ubuntu1004desktop:~/magic-lantern$ ls -lrt font-*
-rw-r--r-- 1 user user 8740 2010-09-06 20:25 font-small.in
-rw-r--r-- 1 user user 460 2010-09-06 20:30 font-huge.in
-rw-r--r-- 1 user user 460 2010-09-06 20:30 font-large.in
-rw-r--r-- 1 user user 460 2010-09-06 20:30 font-med.in
-rw-r--r-- 1 user user 502788 2010-09-06 21:54 font-huge.c
-rw-r--r-- 1 user user 103060 2010-09-06 21:54 font-huge.o
-rw-r--r-- 1 user user 112125 2010-09-06 21:54 font-large.c
-rw-r--r-- 1 user user 18072 2010-09-06 21:54 font-large.o
-rw-r--r-- 1 user user 56155 2010-09-06 21:54 font-med.c
-rw-r--r-- 1 user user 9868 2010-09-06 21:54 font-med.o
-rw-r--r-- 1 user user 45543 2010-09-06 21:54 font-small.c
-rw-r--r-- 1 user user 7832 2010-09-06 21:54 font-small.o
user@ubuntu1004desktop:~/magic-lantern$


Any idea ?

Kind regards,

Arm.Indy

arm.indy

unread,
Sep 6, 2010, 4:13:23 PM9/6/10
to Magic Lantern firmware development
Sorry, they updated the script
http://github.com/esden/summon-arm-toolchain/raw/master/summon-arm-toolchain
recently,
mine (from this WE) have

BINUTILS=binutils-2.19.1
GCC=gcc-4.4.2
NEWLIB=newlib-1.17.0
GDB=gdb-7.1

Arm.Indy

On Sep 6, 10:08 pm, "arm.indy" <arm.indi...@gmail.com> wrote:
> Hi,
>
> I have just installed (from source) an ARM toolchain using the scripthttp://github.com/esden/summon-arm-toolchain/raw/master/summon-arm-to...
> provided fromhttp://www.hermann-uwe.de/blog/building-an-arm-cross-toolchain-with-b...
> (thanks to Phil for the link)
>
> for info:
> BINUTILS=binutils-2.20
> GCC=gcc-4.5.1
> NEWLIB=newlib-1.18.0
> GDB=gdb-7.2
>
> I started with a fresh Ubuntu 10.04 Desktop VmWare image,
> this one:http://www.vmware.com/appliances/directory/542303
>
> then to get required packages
>  sudo apt-get install flex bison libncurses5-dev autoconf texinfo
> build-essential
>
> then
>
>  ./summon-arm-toolchain
> (it takes a long time...)
>
>  hg clone -r 550dhttps://bitbucket.org/hudson/magic-lantern
>
>  wgethttp://bitbucket.org/hudson/magic-lantern/downloads/magiclantern-550d...

Alex

unread,
Sep 7, 2010, 4:10:42 AM9/7/10
to Magic Lantern firmware development
Excellent! It worked from the first try on my machine! I've updated
the wiki with the new info:

http://magiclantern.wikia.com/wiki/Build_instructions/550D

About the fonts problem... CHDK wiki says there's a problem with
binutils 2.19.1 which you used ( http://chdk.wikia.com/wiki/Gcc433 ).
Just a guess...

The changes to the Makefile are also welcome. Thanks!

Alex

On Sep 6, 11:13 pm, "arm.indy" <arm.indi...@gmail.com> wrote:
> Sorry, they updated the scripthttp://github.com/esden/summon-arm-toolchain/raw/master/summon-arm-to...

arm.indy

unread,
Sep 10, 2010, 4:01:48 PM9/10/10
to Magic Lantern firmware development
Hi,

I managed to compile the 550D branch and run it, but still got a
problem with the fonts.
Could you please tell me versions of Binutils, gcc and newlib that had
worked for you ?

it was:
BINUTILS=binutils-2.19.1
GCC=gcc-4.4.2
NEWLIB=newlib-1.17.0
GDB=gdb-7.1

Thanks

Arm.Indy

Trammell Hudson

unread,
Sep 13, 2010, 6:36:49 AM9/13/10
to ml-d...@googlegroups.com
On Fri, Sep 10, 2010 at 01:01:48PM -0700, arm.indy wrote:
> I managed to compile the 550D branch and run it, but still got a
> problem with the fonts.

I must have missed the earlier emails. What is happening with the fonts?

> Could you please tell me versions of Binutils, gcc and newlib that had
> worked for you ?

I'm running arm-elf-gcc-4.3.2, installed via 'port install arm-elf-gcc'.
arm-elf-ld from binutils-2.20.51, also installed via Mac ports.
I don't believe that I have newlib installed (although ports might
have installed it as a dependency for one of the others).
gdb isn't used in the build process for the 5D and 550D (only the
7D), so its version should not matter.

--
Trammell

Piit

unread,
Sep 30, 2010, 4:16:42 PM9/30/10
to Magic Lantern firmware development
Hi,

I'm just trying to compile the 550D branch of Magic Lantern. Thanks a
lot for the info provided on the ML Wikia 550D dev page and 550D build
instructions page.

I have compiled the arm-elf toolchain using the summon-arm-toolchain
with recommended settings. However, when I try to make ML, I get
following errors (after successfully compiling a number of .c files):

[ LD ] magiclantern
5d-hack.o: In function `null_task':
/usr/src/magic-lantern/550d/5d-hack.c:151: relocation truncated to
fit:
R_ARM_PC24 against symbol `DebugMsg' defined in *ABS* section in
magiclantern
5d-hack.o: In function `my_init_task':
/usr/src/magic-lantern/550d/5d-hack.c:268: relocation truncated to
fit:
R_ARM_PC24 against symbol `init_task' defined in *ABS* section in
magiclantern
/usr/src/magic-lantern/550d/5d-hack.c:273: relocation truncated to
fit:
R_ARM_PC24 against symbol `dmstart' defined in *ABS* section in
magiclantern
/usr/src/magic-lantern/550d/5d-hack.c:275: relocation truncated to
fit:
R_ARM_PC24 against symbol `DebugMsg' defined in *ABS* section in
magiclantern
/usr/src/magic-lantern/550d/5d-hack.c:280: relocation truncated to
fit:
R_ARM_PC24 against symbol `DebugMsg' defined in *ABS* section in
magiclantern
/usr/src/magic-lantern/550d/5d-hack.c:303: relocation truncated to
fit:
R_ARM_PC24 against symbol `msleep' defined in *ABS* section in
magiclantern
/usr/src/magic-lantern/550d/5d-hack.c:308: relocation truncated to
fit:
R_ARM_PC24 against symbol `msleep' defined in *ABS* section in
magiclantern
/usr/src/magic-lantern/550d/5d-hack.c:327: relocation truncated to
fit:
R_ARM_PC24 against symbol `msleep' defined in *ABS* section in
magiclantern
5d-hack.o: In function `call_init_funcs':
/usr/src/magic-lantern/550d/5d-hack.c:237: relocation truncated to
fit:
R_ARM_PC24 against symbol `DebugMsg' defined in *ABS* section in
magiclantern
5d-hack.o: In function `my_init_task':
/usr/src/magic-lantern/550d/5d-hack.c:335: relocation truncated to
fit:
R_ARM_PC24 against symbol `msleep' defined in *ABS* section in
magiclantern
/usr/src/magic-lantern/550d/5d-hack.c:344: additional relocation
overflows omitted from the output
collect2: ld returned 1 exit status
make: *** [magiclantern] Error 1

I'm not quite sure what could be causing this linker error - I found
out
that it occurs when a long jump (over 32MB) is attempted or something
like that... Not really the case here though I think.

Any ideas?

I'm compiling on x86_64, Debian Lenny.

Thanks
Pete

Alex

unread,
Oct 2, 2010, 11:58:20 AM10/2/10
to Magic Lantern firmware development
Well... not sure if it helps, but I've solved some strange compiling
errors with:
make clean
make

I don't remember what the error was, but it happened when trying to
compile LUA support.

Try to run make with verbose option turned on, and post the log here:
make V=1

Petr Sedlacek

unread,
Oct 2, 2010, 2:09:45 PM10/2/10
to ml-d...@googlegroups.com
Hi Alex,

Thanks for the reply. I was compiling in Debian Lenny and today I tried
again in a Squeeze virtual machine (Debian testing, more up to date) and
it seems there are some issues cloning the repository with older version
of hg... The one in Lenny (1.0.1) doesn't seem to fetch all the files
(for example the stubs-550d.108.S was missing). The one in Squeeze
(1.6.2) works fine.

The compiled autoexec.bin runs fine, so I'm ready to start hacking -
for example to find out why is text rendering working fine while
cropmarks/zebra aren't :)

Cheers
Pete

L0RE

unread,
Oct 4, 2010, 7:52:27 AM10/4/10
to Magic Lantern firmware development

> > > > Any idea ?

I Added in the Makefile on:
CFLAGS=\

The option

-mlong-calls \

The Compile don't produce any errors anymore
Reply all
Reply to author
Forward
0 new messages