CHDK Forum
CHDK Development => General Discussion and Assistance => Topic started by: Bernd R on 31 / December / 2010, 11:53:30
-
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%
-
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
-
@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);
-
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%
-
You need to make _strcat, not strcat. You could also put an #ifdef in the strcat wrapper and implement it there...
-
@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).
-
@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.
-
@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?
-
>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 (http://chdk.setepontos.com/index.php?topic=5972.0)
because that shoot command not work is problem on more camera