1000d - help needed with compiling

Started by Levas, October 08, 2016, 03:07:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Levas

Hi there,

I want to mess around with ML and the 1000d.

I don't no much(or anything at all) about compiling magic lantern and the c language.

Long ago some work has been done by Coutts
http://bitbucket.org/coutts/1000d_dev/src

I used the instructions in this post to be able to compile
http://www.magiclantern.fm/forum/index.php?topic=16012.0

I'm now able to compile the standard platforms, like for example the newest 6d build. I get the fir, autoexec.bin and the zipfile.
But I can't get it to work with the stuff Coutts has made.

I get this error message in terminal:

rm *.o; rm AUTOEXEC.arm.elf
rm: *.o: No such file or directory
rm: AUTOEXEC.arm.elf: No such file or directory
make: *** [clean] Error 1

So there are some linking problems, but I don't know where to link to these files, I know they are available in the 'gcc-arm-none-eabi-4_8-2013q4' folder on my home directory

Anyone here willing to help/ suggest ideas

eduperez

Quote from: Levas on October 08, 2016, 03:07:08 PM
I get this error message in terminal:

rm *.o; rm AUTOEXEC.arm.elf
rm: *.o: No such file or directory
rm: AUTOEXEC.arm.elf: No such file or directory
make: *** [clean] Error 1

Looks like you executed "make clean", and being the first execution, there was nothing to clean; I would just jump to the next step.

Levas

When I just do the command 'make' I get this error message:

arm-none-eabi-gcc    -c -o entry.o entry.S
make: arm-none-eabi-gcc: No such file or directory
make: *** [entry.o] Error 1

Still seems to be something wrong with the linking to the arm-none-eabi-gcc files  ???

Just to make sure I get things right how this compiling works:

You open Terminal, go to the directory where your source files for your camera are:
  In my case I've got these files from coutts to start with:

  1000d.fir
  AUTOEXEC.BIN
  assemble_fw
  e6kr5107.fir_0_header.bin
  e6kr5107.fir_1_flasher.bin
  entry.S
  entry_subs.S
  header.bin
  main.c
  main.h
  make_bootable.sh
  makefile

Then in terminal run the command 'make' and the it follows the rules in the makefile file.
The makefile contains this:
-------------------------------------------------
name=AUTOEXEC
entryadr=0x800000

CFLAGS=-nostdlib -march=armv5te -fno-builtin -Wall -pedantic -std=gnu99
LDFLAGS=-Wl,-Ttext,$(entryadr)
CC=arm-none-eabi-gcc
AS=arm-none-eabi-as
OBJCOPY=arm-none-eabi-objcopy

all: $(name).BIN

$(name).BIN: $(name).arm.elf
   $(OBJCOPY) -O binary $(name).arm.elf $(name).BIN
$(name).arm.elf:entry.o entry_subs.o main.o link.script
   $(CC) $(CFLAGS) -Wl,-T,link.script -o$@ $^

entry.o:entry.S

main.o:main.c

entry_subs.o: entry_subs.S


clean:
   rm *.o; rm $(name).arm.elf
-------------------------------------------------

when stuff works, I should end up with a new autoexec.bin file.



dfort

I suggested running "make clean && make zip" in order to put things in a pristine state and if that works, start compiling. Looks you're working on an old port so you might have to run those commands separately.

Long story short--run this:

make zip


Sent from my iPad using Tapatalk

Levas

It's indeed very old, all the files are from 2011  ;D

Make zip gives this error

make: *** No rule to make target `zip'.  Stop.


dfort

Wow, really old code. Try just "make"


Sent from my iPad using Tapatalk

dfort

Just looked into it some more and this is a very early developer's version.

http://bitbucket.org/coutts/1000d_dev/src

Notice that the source directory already has the binaries for AUTOEXEC.BIN, 1000d.fir and a few others so you don't really need to compile anything. However, it doesn't look like this is very far along and it certainly isn't useable in this state. There's a lot more work that needs to be done on this platform.

Levas

The binaries are already there, I know.

I would like to mess around with the main.c file and try some basic stuff.

See this topic:
http://www.magiclantern.fm/forum/index.php?topic=14732.msg172779#msg172779

I'm now trying to make both LEDs blink, in alternating sequence

But at the moment I can get it to make a new autoexec.bin from the changes I made in the Main.c file

dfort

Ok took another look at it and you'll need to modify the makefile to point to the path where you have the arm compiler. Assuming you followed my tutorial these are the paths:

CC=~/gcc-arm-none-eabi-4_8-2013q4/bin/arm-none-eabi-gcc
AS=~/gcc-arm-none-eabi-4_8-2013q4/bin/arm-none-eabi-as
OBJCOPY=~/gcc-arm-none-eabi-4_8-2013q4/bin/arm-none-eabi-objcopy


I just tried it and successfully built AUTOEXEC.BIN. Good luck!

Levas

Thanks!  it works  :D
It creates a autexec.bin file.
Time to mess around with the main.c and other files  8)

Hmmm :-\
I don't get it.

At this moment when I do a firmware update with the 1000d.fir file from Coutts, it let's the blue led blinking.
I was thinking that the camera was executing the blue led blinking from the autoexec.bin
But even without a autoexec.bin on the SD card, the blue led is blinking after firmware update with the 1000d file...

What am I missing, how can I make the code I change in the main.c file to take effect on my 1000d ?

Looks that I need to compile a new fir file, how do I do that ?


I found the 'assemble_fw' command  :)

Now I'm messing around with the code.
I perform the 'make' command to get the autoexec.bin
The I do the 'assemble_fw' command
The I do the make clean command

Is this the right way ?


dfort

The "make clean" command deletes the binaries so you probably don't want it to be your last step. Technically when you make a change to the source code "make" is supposed to figure out what needs to be built and what can be left alone but if it sees a completed binary there are times when it doesn't re-compile when it should. I prefer running "make clean" before running "make" so that it starts compiling on a clean slate.

In any case, it looks like you're on your way. Glad I was able to help you on this first step. There's a lot to do on that port. Try to get a ROM dump, check out what the finished code on other platforms looks like, see if you can get QEMU running and ask for some help from the developers that are maintaining the various platforms.

Levas

The camera LEDs don't do what I expect based on the code  ???

Now I do see with compiling, that it shows a lot of error messages in the main.c so that could explain why it doesn't work as expected.
This main.c is from Coutts, http://bitbucket.org/coutts/1000d_dev/src

The error messages while compiling are:
-----------------------------------------------------------------------------------------------------------
~/gcc-arm-none-eabi-4_8-2013q4/bin/arm-none-eabi-gcc    -c -o entry.o entry.S
~/gcc-arm-none-eabi-4_8-2013q4/bin/arm-none-eabi-gcc    -c -o entry_subs.o entry_subs.S
~/gcc-arm-none-eabi-4_8-2013q4/bin/arm-none-eabi-gcc -nostdlib -march=armv5te -fno-builtin -Wall -pedantic -std=gnu99   -c -o main.o main.c
main.c: In function 'dumpmemo':
main.c:19:3: warning: implicit declaration of function 'FIO_CloseFile' [-Wimplicit-function-declaration]
   FIO_CloseFile(f);
   ^
main.c:22:2: warning: implicit declaration of function 'FIO_OpenFile' [-Wimplicit-function-declaration]
  f = FIO_OpenFile("B:/ROMDUMP.BIN", 0, 0644);
  ^
main.c: In function 'MyTask2':
main.c:34:2: warning: implicit declaration of function 'msleep' [-Wimplicit-function-declaration]
  msleep(5000);
  ^
main.c:37:5: warning: implicit declaration of function 'prop_request_change' [-Wimplicit-function-declaration]
     prop_request_change(0x80040007, &x, 4);
     ^
main.c: In function 'CreateMyTask':
main.c:92:2: warning: ISO C forbids passing argument 4 of 'CreateTask' between function pointer and 'void *' [-Wpedantic]
  CreateTask("MyTask2", 0x1A, 0x2000, MyTask2, 0);
  ^
In file included from main.c:1:0:
main.h:2:12: note: expected 'void *' but argument is of type 'void (*)()'
extern int CreateTask (const char *name, int prio, int stack_size /*?*/, void *entry, long parm /*?*/);
            ^
~/gcc-arm-none-eabi-4_8-2013q4/bin/arm-none-eabi-gcc -nostdlib -march=armv5te -fno-builtin -Wall -pedantic -std=gnu99 -Wl,-T,link.script -oAUTOEXEC.arm.elf entry.o entry_subs.o main.o link.script
~/gcc-arm-none-eabi-4_8-2013q4/bin/arm-none-eabi-objcopy -O binary AUTOEXEC.arm.elf AUTOEXEC.BIN

-----------------------------------------------------------------------------------------------------------

dfort

Those are warnings, not error messages. Try compiling any of the other platforms and you'll see that this is "normal" for Magic Lantern code.

As for not behaving as expected--

QuoteThe first 90 percent of the code accounts for the first 90 percent of the development time. The remaining 10 percent of the code accounts for the other 90 percent of the development time.

— Tom Cargill, Bell Labs

I find this is an optimistic statement.

Levas

Thanks for sending that motivating quote from Tom   :P

No worries I just wanna try to mess around a little with the 1000d code and see where I can get (probably nowhere... :P)
There is no rush for me, I've got my 6D to use with magic lantern.
And I'v got my good old trusty 1000D to do some try and error with Magic Lantern code on it.

Some other questions, what is the sequence the code is read.
There are some files:

Main.c
Main.h
Entry.s
Entry_subs.s

It looks to me that things are run/started with the code in the Main.c file.
But where does it use the Main.h file for ?

Looks like the entry.s contains the ASM code for the canon cam, so here are the actual commands for the camera actions.
But where is the Entry_subs.s file for ?


SysCall

Thanks guys, I can cofirm I'm also able to compile and start it on my Canon 1000D.

This also looks promising:
https://www.magiclantern.fm/forum/index.php?topic=14732.75

Levas

I did some messing around to get the leds blinking. But I only could let them burn permanently, both the blue and the red led...
Then 10 bit raw video came along...

So at this moment, time goes in to messing around with my 6d and 10bit video.

http://www.magiclantern.fm/forum/index.php?topic=5601.msg175664#msg175664