stubs_entry.s autogenerate work wrong for strcat. - General Discussion and Assistance - CHDK Forum supplierdeeply

stubs_entry.s autogenerate work wrong for strcat.

  • 8 Replies
  • 3438 Views
stubs_entry.s autogenerate work wrong for strcat.
« on: 31 / December / 2010, 11:53:30 »
Advertisements
Seem new Camera Firmware(Ixus 1000 HS) have no strcat func.
So the stubs generator use for strcat same address as strncpy.

But thats wrong.whats best to do then ?

Happy new year to all.

see here the snippet of the file.Ypu can see same address for strcat and strncpy

NSTUB(strcat, 0xff81402c)
// Best match: 56%
NSTUB(strchr, 0xff8140b4)
NSTUB(strcmp, 0xff82070c)
NSTUB(strcpy, 0xff8206f4)
NSTUB(strftime, 0xff8b56d0)
// Best match: 79%
NSTUB(strlen, 0xff82072c)
NSTUB(strncmp, 0xff814068)
// Best match: 73%
NSTUB(strncpy, 0xff81402c)
// Best match: 71%


Ixus 1000 HS

*

Offline reyalp

  • ******
  • 13673
Re: stubs_entry.s autogenerate work wrong for strcat.
« Reply #1 on: 31 / December / 2010, 12:26:42 »
Seem new Camera Firmware(Ixus 1000 HS) have no strcat func.
So the stubs generator use for strcat same address as strncpy.
Doesn't have it, or is not found correctly ?
If it's not found correctly, but you know the correct address, put the correction in stubs_entry_2.s

If it doesn't exist at all or you haven't found it, then implement _strcat it yourself in camara/lib.c
Don't forget what the H stands for.

Re: stubs_entry.s autogenerate work wrong for strcat.
« Reply #2 on: 31 / December / 2010, 13:32:38 »
@reyalp
>Doesn't have it, or is not found correctly ?

I dont know exact, maybe other with new firmware camera as SX30 S95 can look in their stubs_entry.s file if it correct detect.if so can tell how asm code should look.But i think its wrong on other Camera too.

use strncpy instead of strcat give not a soon visible mailfunction, if no stringpart is before and the register for length is large enough by random.

or better i add in lib.c a strcat func as this.

long offset = strlen(cur);
            strcpy(cur+offset, str);

« Last Edit: 31 / December / 2010, 13:37:23 by Bernd R »
Ixus 1000 HS

Re: stubs_entry.s autogenerate work wrong for strcat.
« Reply #3 on: 01 / January / 2011, 08:43:02 »
I test now to write own strcat.I add that in 100d lib.c

char * strcat( char *dst, char *src)
{
long offset = strlen(dst);
            strcpy(dst+offset, src);
            return dst;
}

I see then in new build stubs_entry.s too a entry strcat which is wrong.

also give linker error, because in wrapper.c is too this.

char *strcat(char *dest, const char *app) {
    return _strcat(dest, app);
}
 
so it seem cant work without change of common chdk file.

thats error i get

./platform/ixus1000_sd4500/sub/100d/libplatformsub.a(lib.o): In function `strcat':
lib.c:(.text+0x0): multiple definition of `strcat'
../platform/ixus1000_sd4500/libplatform.a(wrappers.o):wrappers.c:(.text+0x51c): first defined here
E:\chdk\gcc\bin\..\lib\gcc\arm-elf\3.4.6\..\..\..\..\arm-elf\bin\ld.exe: Warning: size of symbol `strcat' changed from 24 in ../platform/ixus1000_sd4500/libplatform.a(wrappers.o) to 48 in ../platform/ixus1000_sd4500/sub/100d/libplatformsub.a(lib.o)
collect2: ld returned 1 exit status
E:\chdk\gcc\bin\gmake.exe[1]: *** [main.elf] Error 1
gmake: *** [all-recursive] Error 1


Edit:

I download the S95 sources, and S95 have same problem as IX1000

addresses of code are same.

thats from the S95 source

NSTUB(strcat, 0xff81402c)
// Best match: 56%
NSTUB(strchr, 0xff8140b4)
NSTUB(strcmp, 0xff82069c)
NSTUB(strcpy, 0xff820684)
NSTUB(strftime, 0xff8b8660)
// Best match: 79%
NSTUB(strlen, 0xff8206bc)
NSTUB(strncmp, 0xff814068)
// Best match: 73%
NSTUB(strncpy, 0xff81402c)
// Best match: 71%
« Last Edit: 01 / January / 2011, 08:54:02 by Bernd R »
Ixus 1000 HS


*

Offline reyalp

  • ******
  • 13673
Re: stubs_entry.s autogenerate work wrong for strcat.
« Reply #4 on: 01 / January / 2011, 16:10:33 »
You need to make _strcat, not strcat. You could also put an #ifdef in the strcat wrapper and implement it there...
Don't forget what the H stands for.

*

Offline pixeldoc2000

  • ****
  • 356
  • IXUS900Ti 1.00C, IXUS300HS 1.00D
    • pixel::doc homebase
Re: stubs_entry.s autogenerate work wrong for strcat.
« Reply #5 on: 03 / January / 2011, 18:13:03 »
@Bernd R

On IXUS300 / SD4000 strcat does point to strncpy too.
I did cross referencing SD4000 disassemble with G11 and D10 to find the hopefully correct strcat address.

Edit: i guess strcat is 0xFF8B5484 for SD4500 (below eventproc_export_atol).
« Last Edit: 03 / January / 2011, 19:24:41 by pixeldoc2000 »

Re: stubs_entry.s autogenerate work wrong for strcat.
« Reply #6 on: 12 / January / 2011, 12:53:48 »
@pixeldoc2000
thanks, this work on IX1000 D firmware now

NHSTUB(strcat, 0xFF8B5484)

BTW: during test i see that when press shoot not long enough, there come script interrupt message.

but i still have problem that shoot not work.on intervalometer show 2 and nothing happen.
Ixus 1000 HS

*

Offline pixeldoc2000

  • ****
  • 356
  • IXUS900Ti 1.00C, IXUS300HS 1.00D
    • pixel::doc homebase
Re: stubs_entry.s autogenerate work wrong for strcat.
« Reply #7 on: 12 / January / 2011, 18:27:42 »
@pixeldoc2000
thanks, this work on IX1000 D firmware now
Your welcome.

BTW: during test i see that when press shoot not long enough, there come script interrupt message.

but i still have problem that shoot not work.on intervalometer show 2 and nothing happen.
Don't quite get what you mean. You mean basic shoot() command?
But this is probably OT, maybe we head back to porting thread?


Re: stubs_entry.s autogenerate work wrong for strcat.
« Reply #8 on: 14 / January / 2011, 09:30:48 »
>Don't quite get what you mean. You mean basic shoot() command?

Yes

>But this is probably OT, maybe we head back to porting thread?

i have add what i find out now written here

http://chdk.setepontos.com/index.php?topic=5972.0

because that shoot command not work is problem on more camera
Ixus 1000 HS

 

Related Topics