SD980 port - page 4 - DryOS Development - CHDK Forum supplierdeeply

SD980 port

  • 169 Replies
  • 58430 Views
*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #30 on: 24 / September / 2009, 01:21:42 »
Advertisements
Actually, I just wanted to ask if 0xFF8140DC was the correct address :D That's what calls 0xFF818D50, in a manner that was similar to the SX10 (but didn't notice that it needs two parameters).
I found it by looking for "memory", then found some "omfg, not enough memory" messages, and looked to see what code referenced them, and found what appeared to be a call to malloc.
I even tested it with the LED blinking, I compare the result of malloc with the range of >0x1900 - <0xff81000, and the result is ok (in beteween them).

Anyway, thanks a lot for looking into it.
BTW, another question: What is the difference between Open and open?

*

Offline reyalp

  • ******
  • 14080
Re: SD980 port
« Reply #31 on: 24 / September / 2009, 01:37:33 »
BTW, another question: What is the difference between Open and open?
http://chdk.setepontos.com/index.php/topic,2301.0.html

Note that was all in reference to vxworks, not sure how much carries over to dryos but looking at sig_ref_dryos_1.txt it appears similar.
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #32 on: 24 / September / 2009, 21:28:35 »
Ok, now another problem, open()
From looking at the source, open is actually calling Open().
I found Open manually, in the function table with the text/pointer thingy.
I even verified it manually, it does indeed call open(), but it looks a bit different than the SX10 version (there are some other calls before open()).

Now, the problem is, if I call that function, the camera crash. When replacing it in the wrappers with open() instead of Open() it didn't crash, although it didn't open the file either.

I noticed another problem, not sure if it is serios, but:

Code: [Select]
int open (const char *name, int flags, int mode )
{
    return _Open(name, flags, mode);//hmm
}

The function is called:
Code: [Select]
fd = open(file, O_RDONLY, 0777);So flags and mode are reversed. I guess it's just a naming mistake, because it works on other CHDK cameras, but just wanted to point this out.
« Last Edit: 24 / September / 2009, 21:33:14 by RaduP »

*

Offline reyalp

  • ******
  • 14080
Re: SD980 port
« Reply #33 on: 24 / September / 2009, 21:33:01 »

The function is called:
Code: [Select]
fd = open(file, O_RDONLY, 0777);So flags and mode are reversed. I guess it's just a naming mistake, because it works on other CHDK cameras, but just wanted to point this out.
Please think about this some more.
Don't forget what the H stands for.


*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #34 on: 24 / September / 2009, 21:35:23 »

The function is called:
Code: [Select]
fd = open(file, O_RDONLY, 0777);So flags and mode are reversed. I guess it's just a naming mistake, because it works on other CHDK cameras, but just wanted to point this out.
Please think about this some more.

Yeah, ok, makes sense now :D

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #35 on: 24 / September / 2009, 23:41:14 »
Well, I tried to use the Fut_ versions to write a whole memory dump on the SD.
Code: [Select]
void test_dbg()
{
int fd;
blink_led(1);
fd = Fopen_Fut("memdump.bin", "w");
blink_led(2);
if (fd)
{
blink_led(3);
    Fwrite_Fut((void*)0, 0x1900,1,fd);
    blink_led(4);
    Fwrite_Fut((void*)0x1900, 32*1024*1024-0x1900,1,fd);
    Fclose_Fut(fd);

}
}

It crashed during fd = Fopen_Fut("memdump.bin", "w");

The only thing that crossed my mind is that I do not remember doing this part from the porting guide: "MEMISOSTART is replaced; the CHDK core is now load at that address so we must adjust the memory pool accordingly."
So it might be possible that those function overwrite my code.. although malloc(20000) doesn't.
Anyway, where should I do that trick to adjust the memory?

*

Offline reyalp

  • ******
  • 14080
Re: SD980 port
« Reply #36 on: 25 / September / 2009, 00:17:53 »
It crashed during fd = Fopen_Fut("memdump.bin", "w");
Are you sure it was in the fopen, not the first fwrite ? Some cameras are known to crash when you try to dump starting at 0 (where the instruction TCM is)

You can try open() and write() instead.
Quote
So it might be possible that those function overwrite my code.. although malloc(20000) doesn't.
Anyway, where should I do that trick to adjust the memory?
This is
LDR R0,=new_sa
LDR R0,[R0]
 somewhere early in boot.c

I don't think your port would work at all if you hadn't done this, since the core would quickly be trashed by the canon firmware using malloc.
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #37 on: 25 / September / 2009, 00:28:56 »
Yes, I am positive, I make the LEDs blink a certain number of times in my code to keep track of where I am at.
I did try open, but that crashes too, so I thought maybe the high level stuff will work better. Without file i/o there is not much that can be done :/


*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #38 on: 25 / September / 2009, 00:36:56 »
Ok, I found the line, I assumed I have to do it myself.
Code: [Select]
const char * const new_sa = &_end;What exactly does &_end mean? Is it some compiler defined stuff?

*

Offline reyalp

  • ******
  • 14080
Re: SD980 port
« Reply #39 on: 25 / September / 2009, 00:42:14 »
Don't forget what the H stands for.

 

Related Topics