SD980 port - page 7 - DryOS Development - CHDK Forum

SD980 port

  • 169 Replies
  • 65416 Views
*

Offline reyalp

  • ******
  • 14128
Re: SD980 port
« Reply #60 on: 26 / September / 2009, 21:35:36 »
Advertisements
That would be my stat_2 function. On the SX10, that function calls the real stat function. This one doesn't appear to do so.
Yes, what I'm saying is that this function behaves very similarly to stat. You should be able to fix up the results to be compatible, if they aren't already.

Outside of lua, I think only st_size is used in CHDK anyway.
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #61 on: 26 / September / 2009, 21:43:10 »
Well, I already wrote my wrapper to get the size, I'll try your function when I will be able to get some text onscreen, so I can have better debugging than just blinking LEDs :D
I think I am pretty close to that, I can already display garbage on screen.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #62 on: 26 / September / 2009, 22:34:23 »
Is free() with a possibly invalid pointer supposed to crash the camera?

*

Offline reyalp

  • ******
  • 14128
Re: SD980 port
« Reply #63 on: 26 / September / 2009, 22:41:08 »
Is free() with a possibly invalid pointer supposed to crash the camera?
Yes, free on a pointer that is neither null or allocated with malloc is likely to crash. edit: this includes freeing the same thing twice.
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #64 on: 26 / September / 2009, 22:48:28 »
Ok, this is interesting, because I tried free right after a malloc() and it worked.
But I am having problems with the free in script.c in this if()
if(state_ubasic_script && state_ubasic_script != ubasic_script_default)

It will crash the camera, when the script_load() function is called the second time from conf_load_defaults()
The pointer seems to be valid, although I couldn't yet locate where is is initialized. I will do more testing.

*

Offline reyalp

  • ******
  • 14128
Re: SD980 port
« Reply #65 on: 26 / September / 2009, 23:33:11 »
state_ubasic_script should start out NULL, since it's a global...

but err wtf,
Code: [Select]
   CONF_INFO( 38, conf.reader_file,            CONF_DEF_PTR,   ptr:"A/README.TXT", conf_change_script_file)
Code: [Select]
static void conf_change_script_file() {
    script_load(conf.script_file, 2);
}
Uhm.... I guess that shouldn't break it but  :blink:
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #66 on: 26 / September / 2009, 23:40:03 »
Yes, I was like WTF too about the README.TXT. And yes, it did not start NULL, but I NULLed it anyway, and still didn't fix that.

I am still looking, I placed my LED blinking at some possible locations where the pointer might be allocated, such as here:
Code: [Select]
        if (rcnt > 0){
            buf[rcnt] = 0;
            blink_led(6);
            state_ubasic_script = buf;
            strcpy(conf.script_file, fn);
        }
But it didn't get there.

So I still have no idea where it is changed..

*

Offline reyalp

  • ******
  • 14128
Re: SD980 port
« Reply #67 on: 27 / September / 2009, 00:11:07 »
Yes, I was like WTF too about the README.TXT. And yes, it did not start NULL, but I NULLed it anyway, and still didn't fix that.
What do you mean it did not start NULL ?

If globals aren't starting zeroed, something is horribly wrong. That function should be the only place state_ubasic_script is assigned, and the only possible values are the default script and a malloc buffer.

platform/<camera>/main.c startup() should initialize the BSS.
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #68 on: 27 / September / 2009, 00:27:05 »
I mean, it wasn't declared as NULL initially, I had to do it manually. I don't know what value it had by default. And yes, I did notice that there are only two possible values, I'll have to do more testing :/

*

Offline RaduP

  • *****
  • 926
Re: SD980 port
« Reply #69 on: 27 / September / 2009, 01:51:59 »
Ok, after a lot of debugging, I narrowed down the problem to script_scan()
After that function is called, the pointer changes the value.. I will have to dig deeper, but perhaps some buffer over/underflow?

 

Related Topics


SimplePortal © 2008-2014, SimplePortal