Gettings started as developer

Started by Strahlex, September 26, 2012, 07:12:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Strahlex

Hello ML developers,

I'm a hobby open source developer and electronic engineering student. As I'm quite familiar with C development and embedded systems, I wan't to join the ML development team. I have a EOS 7D, so I'm especially interested in porting ML to this DSLR. I already got ML classic to compile, but then I found out that ML Unified is the way to go. So can anybody please introduce my to the development community and help me getting started with development and testing?

Strahlex

Marsu42

Quote from: Strahlex on September 26, 2012, 07:12:54 PM
Hello ML developers,

I'm a hobby open source developer and electronic engineering student. As I'm quite familiar with C development and embedded systems, I wan't to join the ML development team. I have a EOS 7D, so I'm especially interested in porting ML to this DSLR. I already got ML classic to compile, but then I found out that ML Unified is the way to go. So can anybody please introduce my to the development community and help me getting started with development and testing?

Strahlex

Just code away (maybe after getting feedback for your idea) and then do a mercurial pull request, that's what I just did with focus bracketing. But it's easier for me since ml already works on my 60d, little chance to brick it at this stage.

a1ex

For 7D, you need to wait until G3gg0 publishes the boot hack. For other cameras, just compile and run.

Strahlex

Yes, boot hack will be there in time (i hope).  Started by setting up the compiler and trying to compile ML. Got the following error:

boot-hack.o: In function `my_init_task':
boot-hack.c:(.text+0x14): relocation truncated to fit: R_ARM_PC24 against symbol `get_current_task' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x4c): relocation truncated to fit: R_ARM_PC24 against symbol `init_task' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x100): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x128): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x138): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x154): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x16c): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x1e8): relocation truncated to fit: R_ARM_PC24 against symbol `task_create' defined in *ABS* section in magiclantern
boot-hack.o: In function `my_assert_handler':
boot-hack.c:(.text+0x234): relocation truncated to fit: R_ARM_PC24 against symbol `get_current_task' defined in *ABS* section in magiclantern
boot-hack.o: In function `my_big_init_task':
boot-hack.c:(.text+0x2b8): relocation truncated to fit: R_ARM_PC24 against symbol `call' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x2e8): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
make[1]: *** [magiclantern] Error 1
make[1]: Leaving directory `/home/alexander/projects/magic-lantern/platform/60D.111'
make: *** [60D] Error 2

nanomad

It's a "feature" of magic lantern, do a make clean and re-compile :P
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

adijiwa

Quote from: Strahlex on September 27, 2012, 12:40:34 AM
Yes, boot hack will be there in time (i hope).  Started by setting up the compiler and trying to compile ML. Got the following error:

boot-hack.o: In function `my_init_task':
boot-hack.c:(.text+0x14): relocation truncated to fit: R_ARM_PC24 against symbol `get_current_task' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x4c): relocation truncated to fit: R_ARM_PC24 against symbol `init_task' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x100): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x128): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x138): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x154): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x16c): relocation truncated to fit: R_ARM_PC24 against symbol `msleep' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x1e8): relocation truncated to fit: R_ARM_PC24 against symbol `task_create' defined in *ABS* section in magiclantern
boot-hack.o: In function `my_assert_handler':
boot-hack.c:(.text+0x234): relocation truncated to fit: R_ARM_PC24 against symbol `get_current_task' defined in *ABS* section in magiclantern
boot-hack.o: In function `my_big_init_task':
boot-hack.c:(.text+0x2b8): relocation truncated to fit: R_ARM_PC24 against symbol `call' defined in *ABS* section in magiclantern
boot-hack.c:(.text+0x2e8): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
make[1]: *** [magiclantern] Error 1
make[1]: Leaving directory `/home/alexander/projects/magic-lantern/platform/60D.111'
make: *** [60D] Error 2


It seems you're using 64 bit compiler (CMIIW). You have to pass -mlong-calls parameter to compiler.

Strahlex

Quote from: adijiwa on September 27, 2012, 05:26:28 AM
It seems you're using 64 bit compiler (CMIIW). You have to pass -mlong-calls parameter to compiler.
You mean when compiling the arm-toolchain with gcc or when compiling ML with the arm-toolchain?

nanomad

You compiled arm-toolchain on a 64 bit environment, try using a pre-built toolchain like https://launchpad.net/gcc-arm-embedded (it works on every major linux distribution)
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

Strahlex

Where can I set what toolchain is used? I already would have a CodeSourcery arm toolchain installed for embedded systems development, maybe it would work. The prebuilt toolchain on launchpad has the same names, it probably would make problems to have them both installed.

nanomad

Make a copy of Makefile.user.defaults, rename it to Makefile.user and edit the paths.
There's no conflict between the toolchains as long as you keep them in separate folders (on the ML server I've got 3 and I can switch between them by editing the Makefile.user file)
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

Strahlex

Well it seems to work, but now I get following errors:
[ CC       ]   ltablib.o
[ CC       ]   ltm.o
[ CC       ]   lundump.o
[ CC       ]   lvm.o
[ CC       ]   lzio.o
[ CC       ]   lua-handler.o
[ LD       ]   lua
[ OBJCOPY  ]   lua.bin.reloc
[ SYMTBLG  ]   lua.bin
sh: /home/alexander/arm-toolchain462/bin/arm-none-eabi-readelf: No such file or directory
Found 0 symbols
rm lua.bin.reloc
make[2]: Leaving directory `/home/alexander/projects/magic-lantern/plugins/lua'
make[2]: Entering directory `/home/alexander/projects/magic-lantern/plugins/testplug'
[ CC       ]   testplug.o
[ LD       ]   testplug
[ OBJCOPY  ]   testplug.bin.reloc
[ SYMTBLG  ]   testplug.bin
sh: /home/alexander/arm-toolchain462/bin/arm-none-eabi-readelf: No such file or directory
Found 0 symbols
rm testplug.bin.reloc
make[2]: Leaving directory `/home/alexander/projects/magic-lantern/plugins/testplug'
make[1]: Leaving directory `/home/alexander/projects/magic-lantern/plugins'

/home/alexander/arm-toolchain462/bin/ was my old directory

Marsu42

Quote from: Strahlex on September 27, 2012, 08:58:28 PM
Well it seems to work, but now I get following errors

You have to edit plugins/symtblgen.rb too for the correct path to the toolchain. And please come up with a smart way for symtblgen.rb to pull the path from Makefile.user in the root directory and submit the solution as a pull request asap :->

nanomad

You people are too lazy :P

Just kidding, I somehow overlooked a really simple solution  ::)

Do a hg pull && hg update and you're ready to go
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

Marsu42

Quote from: nanomad on September 27, 2012, 09:22:18 PM
Just kidding, I somehow overlooked a really simple solution  ::)

Thanks, and you're indeed correct, I was too lazy to look how the vars are relayed to the ruby script :-p

Pelican

I'm trying to setup my computer to compile ML source again.
Once it worked fine I was able to compile ML code before but now I cannot.

I installed cygwin 1.7.16-1 with the setup.exe.
Installed yagarto-bu-2.21_gcc-4.6.2-c-c++_nl-1.19.0_gdb-7.3.1_eabi_20111119
Downloaded latest source code from bitbucket.
I changed Makefile.user.default ARM_ABI=none-eabi

$ make
make -C /home/Pel/magic-lantern/platform/60D.111
make[1]: Entering directory `/home/Pel/magic-lantern/platform/60D.111'
[ CPP      ]   magiclantern.lds
[ AS       ]   ../../src/entry.o
../../Makefile.inc:159: recipe for target `../../src/entry.o' failed
make[1]: *** [../../src/entry.o] Error 1
make[1]: Leaving directory `/home/Pel/magic-lantern/platform/60D.111'
Makefile:30: recipe for target `60D' failed
make: *** [60D] Error 2

What's wrong? Did I forget something?
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

nanomad

- Never edit Makefile.user.default, place your custom settings in Makefile.user. This avoids conflicting changes in the repository
- Make sure that:
ARM_ABI and ARM_PATH are correct. You may have to edit the paths of the other executables too if cygwin expects windows-slash notation
If the build still fails it may be an incompatibility with cygwin. Paste the output of make V=1 in a code bbtag here and I'll see what I can do
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

Pelican

Quote from: nanomad on October 01, 2012, 04:39:52 PMPaste the output of make V=1 in a code bbtag here and I'll see what I can do

$ make V=1
make -C /home/Pel/magic-lantern/platform/60D.111
make[1]: Entering directory `/home/Pel/magic-lantern/platform/60D.111'
~/arm-toolchain462/bin/arm-none-eabi-gcc-4.6.2 -Wp,-MMD,../../src/.entry.o.d  -Wp,-MT,../../src/entry.o  -nostdlib  -fomit-frame-pointer  -fno-strict-aliasing -DCONFIG_MAGICLANTERN=1  -DCONFIG_60D=1  -DRESTARTSTART=0x0005f000  -DROMBASEADDR=0xFF010000  -DVERSION=\"v2.3.NEXT.2012Oct01.60D111\"  -DCONFIG_DEBUGMSG=0 -c -o ../../src/entry.o ../../src/entry.S
../../Makefile.inc:159: recipe for target `../../src/entry.o' failed
make[1]: *** [../../src/entry.o] Error 1
make[1]: Leaving directory `/home/Pel/magic-lantern/platform/60D.111'
Makefile:30: recipe for target `60D' failed
make: *** [60D] Error 2

Thanks in advance!

What is the recommended developing tool under Windows 7 x64?
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

nanomad

I don't think anyone of us works under windows
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

Pelican

I'm a little bit further now...

"make" cannot extract the neccessary objects from libc.a but I've extracted them manually and copy them to the specific folder.
The menuindex.py cannot open menuindex.txt but I could build an autoexec.bin for my 7D... and it's WORKING!!!

[/b]$ make V=1
( echo const char build_version[] = v2.3.NEXT.2012Oct02.7D203
/bin/sh:  ; echo const: command not found
/bin/sh:  ; echo const: command not found
/bin/sh:  ; echo const: command not found
/bin/sh:  ; ) > ../../platform/7D.203/version.c: No such file or directory
~/arm-toolchain462/bin/arm-none-eabi-gcc-4.6.2 -Wp,-MMD,./.version.o.d  -Wp,-MT,version.o  -nostdlib  -fomit-frame-pointer  -fno-strict-aliasing  -DCONFIG_MAGICLANTERN=1  -DCONFIG_7D=1  -DRESTARTSTART=0xC80100  -DROMBASEADDR=0xFF010000  -DVERSION=\"v2.3.NEXT.2012Oct02.7D203\"  -DCONFIG_DEBUGMSG=0    -Os  -Wall  -W  -mstructure-size-boundary=32  -Wno-unused-parameter  -Wno-implicit-function-declaration  -Wno-unused-function  -Wno-missing-field-initializers  -Wno-format  -std=gnu99  -D__ARM__  -I.  -I../../src    -c -o version.o ../../platform/7D.203/version.c
cd ../../doc; python2 menuindex.py
Could not open menuindex.txt
mkdir: cannot create directory `cam': File exists
~/arm-toolchain462/bin/arm-none-eabi-gcc-4.6.2 -Wp,-MMD,./.menuindex.o.d  -Wp,-MT,menuindex.o  -nostdlib  -fomit-frame-pointer  -fno-strict-aliasing  -DCONFIG_MAGICLANTERN=1  -DCONFIG_7D=1  -DRESTARTSTART=0xC80100  -DROMBASEADDR=0xFF010000  -DVERSION=\"v2.3.NEXT.2012Oct02.7D203\"  -DCONFIG_DEBUGMSG=0    -Os  -Wall  -W  -mstructure-size-boundary=32  -Wno-unused-parameter  -Wno-implicit-function-declaration  -Wno-unused-function  -Wno-missing-field-initializers  -Wno-format  -std=gnu99  -D__ARM__  -I.  -I../../src    -c -o menuindex.o ../../src/menuindex.c
~/arm-toolchain462/bin/arm-none-eabi-gcc-4.6.2 -o magiclantern -N -nostdlib -mthumb-interwork -march=armv5te -T magiclantern.lds ../../src/entry.o boot-hack.o stubs.o version.o bmp.o font-dyn.o config.o menu.o debug.o stdio.o audio.o bitrate.o property.o propvalues.o gui.o gui-common.o misc.o tweaks.o lens.o picstyle.o cfn.o zebra.o shoot.o chdk-gui_draw.o movtweaks.o my_memset.o menuhelp.o menuindex.o af_patterns.o focus.o notify_box.o bootflags.o dialog_test.o vram.o morse.o aj_port.o fps-engio.o hdr.o lv-img-engio.o state-object.o tasks.o beep.o ptp.o ptp-ml.o ptp-chdk.o libstdio.a -lm -lgcc -Xlinker -Map=location.map
~/arm-toolchain462/bin/arm-none-eabi-objcopy -O binary magiclantern magiclantern.bin
~/arm-toolchain462/bin/arm-none-eabi-gcc-4.6.2 -Wp,-MMD,./.reboot.o.d  -Wp,-MT,reboot.o  -nostdlib  -fomit-frame-pointer  -fno-strict-aliasing  -DCONFIG_MAGICLANTERN=1  -DCONFIG_7D=1  -DRESTARTSTART=0xC80100  -DROMBASEADDR=0xFF010000  -DVERSION=\"v2.3.NEXT.2012Oct02.7D203\"  -DCONFIG_DEBUGMSG=0    -Os  -Wall  -W  -mstructure-size-boundary=32  -Wno-unused-parameter  -Wno-implicit-function-declaration  -Wno-unused-function  -Wno-missing-field-initializers  -Wno-format  -std=gnu99  -D__ARM__  -I.  -I../../src    -c -o reboot.o ../../src/reboot.c
~/arm-toolchain462/bin/arm-none-eabi-gcc-4.6.2 -o autoexec -nostdlib -march=armv5te -e _start -Ttext 0x40800000 reboot.o -Xlinker --cref -Xlinker -Map=autoexec.map
autoexec.bin: 315392 bytes

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000060 0x00c80100 0x00c80100 0x4a8bd 0x55d8b RWE 0x10

~/arm-toolchain462/bin/arm-none-eabi-objcopy -O binary autoexec autoexec.bin


Edit:


$ ~/arm-toolchain462/bin/arm-none-eabi-ar x /home/Pel/arm-toolchain462/arm-none-eabi/lib/libc.a lib_a-setjmp.o
/home/Pel/arm-toolchain462/arm-none-eabi/lib/libc.a: No such file or directory
D:\util\cygwin\home\Pel\arm-toolchain462\bin\arm-none-eabi-ar.exe:

$ ls /home/Pel/arm-toolchain462/arm-none-eabi/lib/libc.a                           
/home/Pel/arm-toolchain462/arm-none-eabi/lib/libc.a
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

Pelican

For those who want to develop under Windows:


Download cygwin http://cygwin.com/setup.exe

Install cygwin for windows
- Check the following packages:
Archive: unzip, zip
Base: Everything
Devel: automake, autoconf, binutils, bison, byacc, gcc, gcc-core, gcc-g++, libtool, make, nasm, patchutils, subversion
Libs: libbz2-devel
Perl: perl
Python: python
Utils: bzip2, cygutils, diffutils, patch, patchutils
Web: wget
- confirm to download the dependencies too

Get http://sourceforge.net/projects/yagarto/files/YAGARTO%20for%20Windows/20111119/yagarto-bu-2.21_gcc-4.6.2-c-c%2B%2B_nl-1.19.0_gdb-7.3.1_eabi_20111119.exe/download file and run it
Install it to "yourcygwindir"/home/"yourusername"/arm-toolchain462

Download http://mercurial.selenic.com/release/windows/mercurial-2.3.2-x64.msi and install it.
(If you have a 32-bit Windows then download the 32 bit mercurial here : http://mercurial.selenic.com/release/windows/mercurial-2.3.2-x86.msi )
Start cygwin, go to your home folder ("yourcygwindir"/home/"yourusername") and get the source:

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

Go to the magic-lantern folder and create Makefile.user
Edit Makefile.user:
ARM_ABI=none-eabi
ARM_LIBC_A=../../../arm-toolchain462/arm-none-eabi/lib/libc.a
PYTHON=python2.6

Run make to compile your own autoexec.bin
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

ilguercio

So basically, if i follow these guidelines i can build my own autoexec.bin without knowing a thing about developing?
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

ilguercio

I still haven't finished with the installing. Meanwhile, you or any mod could merge your post to the thread in sticky so any windows user can find this bit of precious info in a second.
;)
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

ilguercio

By the way, i'm lost.
I installed cygwin, downloaded all the packages and waited for it to complete (a loooong time) .
After the installation was completed i installed mercurial and then i installed yagarto.
As it asked me for the directory i entered what you said even though there wasn't any directory yet (so i guess i had to create it for some reason) .
Now i am in the terminal and can't go on, i need some help, maybe a step to step tutorial.

Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

ilguercio

Ok, i made sure i was running the application as admin.
Downloaded source code.
Now i created makefile.user and set the stuff pelican said.
has ARM_LIBC_A= to be the complete windows path?
I entered C:/cygwin/home/Giovanni/arm-toolchain462/arm-none-eabi/lib/libc.a
Now i try to make and it says there's no operation to make.
What am i doing wrong?
$ make magic-lantern/Makefile.user
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

ilguercio

Ok, command "cd" worked to enter ML folder but now i get an error as i try to "make"

$ make
make -C /home/Giovanni/magic-lantern/platform/60D.111
make[1]: ingresso nella directory "/home/Giovanni/magic-lantern/platform/60D.111"
../../Makefile.inc:258: *** il modello dell'obiettivo non contiene alcun "%".  Arresto.
make[1]: uscita dalla directory "/home/Giovanni/magic-lantern/platform/60D.111"
Makefile:30: recipe for target `60D' failed
make: *** [60D] Error 2

It's in italian, if anybody knows how to revert it to english it would be better for me as well.
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.